# API: Website chat

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/inbound/avatar` | The video avatar's setup: whether the organization's Anam key is saved and Anam's browser SDK is installed (and its version) | `settings:read` |
| PUT | `/v1/inbound/avatar` | Save (or with null remove) the organization's own Anam API key for the video avatar (owners). It's kept encrypted, used only on our server to mint short session tokens, and never shown again (web app only) | `settings:write` |
| GET | `/v1/inbound/chats` | Website chats, newest first (status: waiting for a person, with a person, the agent's, closed) | `inbound:read` |
| GET | `/v1/inbound/chats/:id` | A website chat: messages with citations, the visitor, flags and qualification | `inbound:read` |
| POST | `/v1/inbound/chats/:id/close` | Close a chat | `inbound:write` |
| POST | `/v1/inbound/chats/:id/hand-back` | Give the chat back to the agent (it answers the visitor again) | `messages:send` |
| POST | `/v1/inbound/chats/:id/reply` | Reply to the visitor as yourself (takes the chat over from the agent) | `messages:send` |
| POST | `/v1/inbound/chats/:id/take-over` | Take over a chat from the agent: you answer the visitor from here (or Slack) | `inbound:write` |
| GET | `/v1/inbound/community` | Community channels connected to this organization (GitHub App installations, Discord servers, Slack channels) | `inbound:read` |
| DELETE | `/v1/inbound/community/:id` | Disconnect a community channel (owners) | `integrations:write` |
| PATCH | `/v1/inbound/community/:id` | Choose the repositories or channels the agent answers in, its hourly cap, or pause it (owners) | `integrations:write` |
| POST | `/v1/inbound/community/complete` | Finish connecting GitHub or Discord with what the provider sent back (owners) | `integrations:write` |
| POST | `/v1/inbound/community/slack` | Answer community questions in your Slack workspace (the organization's Slack connection; choose the channels next) (owners) | `integrations:write` |
| POST | `/v1/inbound/community/start` | Start connecting GitHub or Discord (owners): returns the page to install or add the app on; it comes back to the Inbound page | `integrations:write` |
| GET | `/v1/inbound/knowledge-gaps` | Questions the website agent couldn't answer from public knowledge, most asked first (last 30 days) | `inbound:read` |
| GET | `/v1/inbound/live` | Visitors on your websites right now (who consented to tracking or are chatting): page, company, chat | `inbound:read` |
| GET | `/v1/inbound/sites` | Websites with the chat widget: origins, settings and the snippet to paste | `settings:read` |
| POST | `/v1/inbound/sites` | Add a website (owners): the widget runs only on its allowed origins | `settings:write` |
| PATCH | `/v1/inbound/sites/:id` | Change a website's origins, settings or turn its widget off (owners) | `settings:write` |
| POST | `/v1/inbound/sites/:id/guide-secret` | Create or replace the in-product guide's signing secret (owners); shown once. Your server signs users' tokens (HS256) with it | `settings:write` |
| DELETE | `/v1/inbound/sites/:id/logo` | Remove the chat launcher's logo (owners): it goes back to the assistant's initial or a chat bubble | `settings:write` |
| PUT | `/v1/inbound/sites/:id/logo` | Upload the chat launcher's logo (owners): PNG, JPEG or WebP, at most 256 KB and 16 to 1024 pixels a side; it's rebuilt without metadata and served from our origin. Without one the launcher shows the assistant's initial or a chat bubble | `settings:write` |
| POST | `/v1/inbound/sites/:id/rotate-key` | Replace the site's public key (the old snippet stops working) (owners) | `settings:write` |
| DELETE | `/v1/inbound/visitors/:id` | Delete a website visitor and everything recorded about them: chats, messages, events (a data-subject request) (owners) | `settings:write` |
| GET | `/v1/me/inbound-alerts` | Your quiet hours and snooze for website visitor alerts (your time zone), and whether they're held right now | — |
| PUT | `/v1/me/inbound-alerts` | Set your quiet hours (HH:MM to HH:MM your time, overnight allowed; null for none) or snooze website visitor alerts for some minutes (0 ends a snooze). While held they wait in your in-app list; a visitor asking for a person still reaches you (web app only) | — |

## Examples

### GET /v1/inbound/avatar

The video avatar's setup: whether the organization's Anam key is saved and Anam's browser SDK is installed (and its version)

```bash
curl -s "https://api.closefinch.com/v1/inbound/avatar" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/avatar`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/inbound/chats

Website chats, newest first (status: waiting for a person, with a person, the agent's, closed)

```bash
curl -s "https://api.closefinch.com/v1/inbound/chats" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/chats`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/inbound/chats/$ID

A website chat: messages with citations, the visitor, flags and qualification

```bash
curl -s "https://api.closefinch.com/v1/inbound/chats/$ID" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/chats/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/inbound/chats/$ID/close

Close a chat

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/chats/$ID/close" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/chats/${id}/close`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/chats/$ID/hand-back

Give the chat back to the agent (it answers the visitor again)

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/chats/$ID/hand-back" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/chats/${id}/hand-back`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/chats/$ID/reply

Reply to the visitor as yourself (takes the chat over from the agent)

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/chats/$ID/reply" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/chats/${id}/reply`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/chats/$ID/take-over

Take over a chat from the agent: you answer the visitor from here (or Slack)

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/chats/$ID/take-over" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/chats/${id}/take-over`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/inbound/community

Community channels connected to this organization (GitHub App installations, Discord servers, Slack channels)

```bash
curl -s "https://api.closefinch.com/v1/inbound/community" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/community`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### DELETE /v1/inbound/community/$ID

Disconnect a community channel (owners)

```bash
curl -s -X DELETE "https://api.closefinch.com/v1/inbound/community/$ID" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/community/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### PATCH /v1/inbound/community/$ID

Choose the repositories or channels the agent answers in, its hourly cap, or pause it (owners)

```bash
curl -s -X PATCH "https://api.closefinch.com/v1/inbound/community/$ID" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/community/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/community/complete

Finish connecting GitHub or Discord with what the provider sent back (owners)

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/community/complete" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/community/complete`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/community/slack

Answer community questions in your Slack workspace (the organization's Slack connection; choose the channels next) (owners)

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/community/slack" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/community/slack`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/community/start

Start connecting GitHub or Discord (owners): returns the page to install or add the app on; it comes back to the Inbound page

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/community/start" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/community/start`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/inbound/knowledge-gaps

Questions the website agent couldn't answer from public knowledge, most asked first (last 30 days)

```bash
curl -s "https://api.closefinch.com/v1/inbound/knowledge-gaps" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/knowledge-gaps`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/inbound/live

Visitors on your websites right now (who consented to tracking or are chatting): page, company, chat

```bash
curl -s "https://api.closefinch.com/v1/inbound/live" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/live`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/inbound/sites

Websites with the chat widget: origins, settings and the snippet to paste

```bash
curl -s "https://api.closefinch.com/v1/inbound/sites" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/inbound/sites

Add a website (owners): the widget runs only on its allowed origins

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/sites" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### PATCH /v1/inbound/sites/$ID

Change a website's origins, settings or turn its widget off (owners)

```bash
curl -s -X PATCH "https://api.closefinch.com/v1/inbound/sites/$ID" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/sites/$ID/guide-secret

Create or replace the in-product guide's signing secret (owners); shown once. Your server signs users' tokens (HS256) with it

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/sites/$ID/guide-secret" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites/${id}/guide-secret`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/inbound/sites/$ID/logo

Remove the chat launcher's logo (owners): it goes back to the assistant's initial or a chat bubble

```bash
curl -s -X DELETE "https://api.closefinch.com/v1/inbound/sites/$ID/logo" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites/${id}/logo`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/inbound/sites/$ID/logo

Upload the chat launcher's logo (owners): PNG, JPEG or WebP, at most 256 KB and 16 to 1024 pixels a side; it's rebuilt without metadata and served from our origin. Without one the launcher shows the assistant's initial or a chat bubble

```bash
curl -s -X PUT "https://api.closefinch.com/v1/inbound/sites/$ID/logo" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites/${id}/logo`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/inbound/sites/$ID/rotate-key

Replace the site's public key (the old snippet stops working) (owners)

```bash
curl -s -X POST "https://api.closefinch.com/v1/inbound/sites/$ID/rotate-key" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/sites/${id}/rotate-key`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/inbound/visitors/$ID

Delete a website visitor and everything recorded about them: chats, messages, events (a data-subject request) (owners)

```bash
curl -s -X DELETE "https://api.closefinch.com/v1/inbound/visitors/$ID" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/inbound/visitors/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/me/inbound-alerts

Your quiet hours and snooze for website visitor alerts (your time zone), and whether they're held right now

```bash
curl -s "https://api.closefinch.com/v1/me/inbound-alerts" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/me/inbound-alerts`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

Request and response schemas: [https://www.closefinch.com/openapi.json](https://www.closefinch.com/openapi.json). All resources: [API reference](https://www.closefinch.com/docs/api).
