# API reference: API keys and webhook

[Guide index](../../v1.md) · [API reference](../api-reference.md) · [Developer API](../api.md)

## `GET /v1/companies/{companyId}/api-keys`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with list of ApiKeyResponse.

## `POST /v1/companies/{companyId}/api-keys`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Body (application/json): `IssueApiKeyRequest`

Answers 201 with `IssuedApiKeyResponse`.

## `POST /v1/companies/{companyId}/api-keys/revoke-all`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with object.

## `PATCH /v1/companies/{companyId}/api-keys/{keyId}`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `keyId` | path | string (uuid) | yes |  |

Body (application/json): `UpdateApiKeyRequest`

Answers 200 with `ApiKeyResponse`.

## `POST /v1/companies/{companyId}/api-keys/{keyId}/revoke`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `keyId` | path | string (uuid) | yes |  |

Answers 200 with `ApiKeyResponse`.

## `DELETE /v1/companies/{companyId}/api-keys/{keyId}/webhook`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `keyId` | path | string (uuid) | yes |  |

Answers 204.

## `PUT /v1/companies/{companyId}/api-keys/{keyId}/webhook`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `keyId` | path | string (uuid) | yes |  |

Body (application/json): `SetWebhookRequest`

Answers 200 with `WebhookResponse`.

## `GET /v1/companies/{companyId}/webhook/deliveries`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `apiKeyId` | query | string (uuid) |  |  |
| `status` | query | string |  |  |
| `limit` | query | integer (int32) |  |  |
| `page` | query | integer (int32) |  |  |

Answers 200 with list of DeliveryResponse.

## `GET /v1/companies/{companyId}/webhook/events`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with list of string.

## `GET /v1/companies/{companyId}/widgets`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with list of WidgetResponse.

## `POST /v1/companies/{companyId}/widgets`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Body (application/json): `CreateWidgetRequest`

Answers 201 with `CreatedWidgetResponse`.

## `PATCH /v1/companies/{companyId}/widgets/{widgetId}`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `widgetId` | path | string (uuid) | yes |  |

Body (application/json): `UpdateWidgetRequest`

Answers 200 with `WidgetResponse`.

## `POST /v1/companies/{companyId}/widgets/{widgetId}/revoke`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `widgetId` | path | string (uuid) | yes |  |

Answers 200 with `WidgetResponse`.

## Types

**ApiKeyResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `keyPrefix` | string | yes |  |
| `label` | string |  |  |
| `sections` | list of `COMPANY` \| `CHANNELS` \| `KEYS` \| `RESOURCES` \| `RULES` \| `IDENTITIES` \| `THREADS` \| `REQUESTS` \| `AUDIT` \| `BILLING` \| `BILLING_CAP` \| `SUB_USERS` \| `CHAT` | yes |  |
| `folders` | list of FolderGrant | yes |  |
| `status` | `ACTIVE` \| `REVOKED` | yes |  |
| `createdAt` | string (date-time) | yes |  |
| `revokedAt` | string (date-time) |  |  |
| `lastUsedAt` | string (date-time) |  |  |
| `summary` | string |  |  |
| `webhookUrl` | string |  |  |
| `webhookEvents` | list of string | yes |  |
| `restrictedTo` | list of string (uuid) | yes |  |

**IssueApiKeyRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `label` | string |  | at most 100 characters |
| `sections` | list of `COMPANY` \| `CHANNELS` \| `KEYS` \| `RESOURCES` \| `RULES` \| `IDENTITIES` \| `THREADS` \| `REQUESTS` \| `AUDIT` \| `BILLING` \| `BILLING_CAP` \| `SUB_USERS` \| `CHAT` |  | at most 2147483647 items |
| `folders` | list of FolderGrant |  | at most 200 items |
| `notes` | `MIRROR` \| `SEPARATE` \| `LEAVE` |  |  |
| `summary` | string |  | at most 2000 characters |
| `webhook` | SetWebhookRequest |  |  |

**IssuedApiKeyResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `apiKey` | ApiKeyResponse | yes |  |
| `key` | string | yes |  |
| `signingSecret` | string | yes |  |
| `webhookSecret` | string |  |  |

**UpdateApiKeyRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `label` | string |  | at most 100 characters |
| `summary` | string |  | at most 2000 characters |

**SetWebhookRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `url` | string | yes | at most 2000 characters |
| `events` | list of string |  | at most 50 items |
| `rotateSecret` | boolean | yes |  |

**WebhookResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `url` | string |  |  |
| `events` | list of string | yes |  |
| `secret` | string |  |  |

**DeliveryResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `apiKeyId` | string (uuid) |  |  |
| `event` | string | yes |  |
| `threadId` | string (uuid) |  |  |
| `seq` | integer (int64) |  |  |
| `status` | string | yes |  |
| `attempts` | integer (int32) | yes |  |
| `nextAttemptAt` | string (date-time) |  |  |
| `lastStatus` | integer (int32) |  |  |
| `lastError` | string |  |  |
| `createdAt` | string (date-time) | yes |  |
| `deliveredAt` | string (date-time) |  |  |

**WidgetResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `label` | string |  |  |
| `summary` | string |  |  |
| `status` | `ACTIVE` \| `REVOKED` | yes |  |
| `allowedOrigins` | list of string | yes |  |
| `look` | WidgetLook | yes |  |
| `userMessagesPerMinute` | integer (int32) | yes |  |
| `restrictedTo` | list of string (uuid) | yes |  |
| `createdAt` | string (date-time) | yes |  |
| `lastUsedAt` | string (date-time) |  |  |
| `revokedAt` | string (date-time) |  |  |

**CreateWidgetRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `label` | string |  | at most 100 characters |
| `summary` | string |  | at most 2000 characters |
| `allowedOrigins` | list of string | yes | at most 50 items |
| `look` | WidgetLook |  |  |
| `userMessagesPerMinute` | integer (int32) |  | from 0; up to 1000 |

**CreatedWidgetResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `widget` | WidgetResponse | yes |  |
| `signingSecret` | string | yes |  |

**UpdateWidgetRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `label` | string |  | at most 100 characters |
| `summary` | string |  | at most 2000 characters |
| `allowedOrigins` | list of string |  | at most 50 items |
| `look` | WidgetLook |  |  |
| `userMessagesPerMinute` | integer (int32) |  | from 0; up to 1000 |

**FolderGrant**

| Field | Type | Required | Notes |
|---|---|---|---|
| `nodeId` | string (uuid) |  |  |
| `level` | `READ` \| `MANAGE` | yes |  |

**WidgetLook**

| Field | Type | Required | Notes |
|---|---|---|---|
| `title` | string |  | at most 60 characters |
| `logoUrl` | string |  | at most 500 characters |
| `color` | string |  |  |
| `greeting` | string |  | at most 500 characters |
| `position` | string |  |  |
| `theme` | string |  |  |
