Integrations

/api/v1 operations for integrations. See HTTP API for authentication, the error envelope, and rate limits.

Operations

GET /api/v1/integrations

List integrations

Returns the organization's connected mailbox integrations (first-party, org-owned). Responses never include token material; use the token endpoint to mint an access token.

Auth: API key required.

Operation ID: listIntegrations

Responses:

CLI: khotan integrations list

POST /api/v1/integrations

Start connecting an integration

Begins a Gmail (google) or Outlook (microsoft) mailbox connection and returns a connect URL. The provider defaults to google. OAuth consent happens in a browser, so a human must open the returned URL to authorize; the connection appears in the list once approved. Returns 503 provider_not_configured when the requested provider is not configured in this environment.

Auth: API key required.

Operation ID: connectIntegration

Request body (application/json, required):

Responses:

CLI: khotan integrations connect

GET /api/v1/integrations/{integrationId}

Get an integration

Returns one connected mailbox integration. Responses never include token material.

Auth: API key required.

Operation ID: getIntegration

Path parameters:

Responses:

CLI: khotan integrations get

PATCH /api/v1/integrations/{integrationId}

Update an integration

Updates an integration's display name. Pass null to clear it. Tokens and the mailbox are fixed by OAuth and cannot be changed.

Auth: API key required.

Operation ID: updateIntegration

Path parameters:

Request body (application/json, required):

Responses:

CLI: khotan integrations rename

DELETE /api/v1/integrations/{integrationId}

Disconnect an integration

Disconnects a mailbox: the stored credentials are revoked and the connection stops driving sync. This is permanent; reconnecting requires a fresh OAuth consent.

Auth: API key required.

Operation ID: deleteIntegration

Path parameters:

Responses:

CLI: khotan integrations delete

POST /api/v1/integrations/{integrationId}/token

Mint an access token (secret)

Mints a fresh, short-lived OAuth access token for a Gmail or Outlook integration using its stored refresh token, and returns it with its expiry and scopes. The token grants access to the connected mailbox; treat it as a secret. Returns 409 connection_unusable if the grant was revoked at the provider, and 503 provider_not_configured if the integration's provider is not configured in this environment.

Auth: API key required.

Operation ID: mintIntegrationToken

Path parameters:

Responses:

CLI: khotan integrations token