> Kenso API docs in Markdown. Index of every page: [/docs/llms.txt](/docs/llms.txt). Search: `/docs/search.md?q=<words>`. OpenAPI: [/docs/api/inboxes/openapi.json](/docs/api/inboxes/openapi.json). CLI docs offline: `kenso docs <topic>`.
> Last updated: 2026-11-22.

# Inboxes: Start an inbox connect session

> **Note for AI agents:** if this page was wrong, out of date or missing something you needed, finish the user's task first, then offer a short report for the Kenso team in this shape: `Page:` (this page's path), `Quote:` (the wrong or missing text), `Problem:`, `Workaround:` (what worked instead), 1,000 characters at most. Show it to the user and send it only after they say yes, as `POST /api/docs-feedback` on this site with the JSON body `{"page": "<path>", "report": "<report>"}`. Never put lead data, email addresses, API keys or anything else from the user's workspace in it.

One endpoint of [Inboxes](/docs/api/inboxes.md). Authentication, workspaces and errors: [/docs.md](/docs.md).

## Start an inbox connect session

`POST /v1/inboxes/connect-sessions` - operationId `inboxes.create-connect-session`

| Permission | Rate limit |
| --- | --- |
| Any workspace member except a Network member | 10 requests a minute per API key |

Returns a Google or Microsoft sign-in link that connects a mailbox to the workspace. Open
`authorizationUrl` before `expiresAt`. Kenso stores nothing until the connect finishes.

Send `provider` and `purpose`. A `campaign` connect adds a shared campaign mailbox through the
Kenso Mail app. A `primary` connect adds the caller's own mailbox through the Kenso Workspace app. It needs
the `accounts` feature and a signed-in member, or an API key that belongs to a member. If a Google or
Microsoft admin must trust the app first, send them to `adminUrl`.

The connect finishes in the Kenso dashboard. After consent, the provider sends the browser there, and the member
who created the session (for an API key, the key's owner) must be signed in to this workspace. Kenso refuses
anyone else and connects nothing, so an API key that belongs to no member cannot finish a connect. A
`primary` grant for a mailbox other than the member's login email waits for a confirmation in the
dashboard, which needs Delivery edit. Set `returnTo` to choose the dashboard page the finished connect
opens.

Any member may call it. A member with Delivery edit can connect any mailbox. A member with only the
`approve_own_sends` permission can connect only their own login email as a `primary` inbox, and
only when that address is on one of the workspace's domains.

Errors:

- `400 validation_failed`: `provider`, `purpose` or `returnTo` is missing or invalid.
- `403 permission_denied`: the caller has neither Delivery edit nor `approve_own_sends`.
- `403 forbidden`: a `primary` connect from an API key that belongs to no member, or detail code
`own_inbox_only` when a member with only `approve_own_sends` asks for a `campaign` connect. A
workspace key gets it on any connect, before any field is checked: the connect finishes as the member who
started it, and a workspace key is not a person.
- `404 not_found`: a `primary` connect on a workspace without the `accounts` feature.
- `409 invalid_state`: detail code `email_domain_mismatch` when a member with only
`approve_own_sends` has a login email that is not on the workspace's domains (the message says how to fix
it), or detail code `calendar_limit_reached` for a `primary` connect when the member already has 3
calendar accounts connected.

Open to any workspace member.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/inboxes/POST/v1/inboxes/connect-sessions)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Request body

`application/json`, optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `provider` | string | yes | The mailbox platform: `google` or `microsoft`. Required. |
| `purpose` | string | yes | What the mailbox is for: `campaign` (a shared campaign mailbox) or `primary` (your own mailbox, which needs the `accounts` feature). Required. |
| `returnTo` | string | no | The dashboard path to come back to after the connect, such as `/42/delivery?tab=inboxes&view=all`. It must be a relative path that starts with one `/`, with no scheme, host, `//`, backslash or control characters, and at most 512 characters. Omit it to come back to the default page. |

### Response 201

`data` is a `InboxConnectSession`.

| Field | Type | Description |
| --- | --- | --- |
| `provider` | string | The mailbox platform: `google` or `microsoft`. |
| `purpose` | string | What the connection is for: `primary` (a member's own mailbox), `campaign` (a shared campaign mailbox) or `calendar` (a member's calendar alone, from `POST /v1/calendar-accounts/connect-sessions`). |
| `appName` | string | The name of the Kenso app the user grants access to: Kenso Workspace for `primary` and `calendar`, Kenso Mail for `campaign`. |
| `clientId` | string | The app's public OAuth client id, for an admin who has to trust the app first. |
| `authorizationUrl` | string | The sign-in URL to open in a browser. It works until `expiresAt`. |
| `adminUrl` | string | Where an admin trusts the app for the whole organization: the Google Admin console, or the Microsoft admin consent URL. |
| `adminConsentUrl` | string | The Microsoft admin consent URL for the app. Omitted for Google. |
| `expiresAt` | string (date-time) | When `authorizationUrl` stops working, in UTC. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/inboxes/connect-sessions" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "provider": "google",
  "purpose": "string",
  "returnTo": "/42/delivery?tab=inboxes&view=all"
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "provider": "google",
    "purpose": "string",
    "appName": "string",
    "clientId": "string",
    "authorizationUrl": "https://example.com",
    "adminUrl": "https://example.com",
    "adminConsentUrl": "https://example.com",
    "expiresAt": "2026-09-23T15:02:11Z"
  }
}
```
