Create a Koil Connection from a credential you already hold
Create a Koil Connection from a credential you already hold: for method: "oauth", a platform grant an end user gave your App, so adopting Koil costs no reauthorization; for method: "key", a key the brand gave you, as key: the config and secret its issuer declares (GET /v1/issuers), with no App. Requires an Idempotency-Key. The credential is first checked with the platform, and refused with connection_invalid if the platform rejects it, with nothing stored. It always creates: a credential for an account that already has a Connection under the same issuer, App (none for a key) and clientUserId is refused with conflict (409), whose meta.resourceId names that Connection; replace its credential with PUT /v1/connections/{connectionId}/credential. The new Connection takes the request's metadata. A grant whose access token has expired is renewed first and its fresh token checked, and refused if the platform refuses to renew it or nothing can. A key's secret is sealed and never returned. For method: "oauth", the answer names the App's scopes the grant lacks (missingScopes), as a completed Connect Session does.
Authorization
bearerAuth An API key from the Koil admin console, sent as Authorization: Bearer <key>. A live key starts koil_live_ and a sandbox key koil_sandbox_; the key alone selects the Organization and mode. See https://docs.koil.co/concepts/authentication.
In: header
Header Parameters
The dated API version the request is written against; it fixes the request and response shapes. Every response echoes the version it is rendered in.
"2026-12-01"A unique key for this request, scoped to the Organization and operation. Retrying with the same key and payload returns the first result instead of repeating the work, or runs a request that failed again; the same key with a different payload is refused with 409 conflict. Keys expire 24 hours after first use, and a request still in flight after 15 minutes releases its key to a retry with the same payload.
\S1 <= length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
From a grant an end user gave your App.
Koil App identifier: your OAuth app that authorizes the Connection.
1 <= lengthYour own identifier for the end user the Connection belongs to.
1 <= length <= 255An end user's OAuth grant, issued to your own app.
The scopes (or, for a key, the roles) the credential holds: at least one, each once. Optional: omitted, Koil records what the platform reports; sent, Koil keeps these. An issuer that reports none needs them declared.
1 <= itemsYour own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to "" is removed.
properties <= 50From a key the brand gave you, verified with the platform before anything is stored. There is no App.
The issuer the key is for, such as app_store_connect for an App Store Connect API key. GET /v1/issuers lists the issuers that take a key, with the fields each declares.
1 <= lengthThe key the brand gave you, in the two halves its issuer declares (GET /v1/issuers: methods.key).
Your own identifier for the end user the Connection belongs to.
1 <= length <= 255The scopes (or, for a key, the roles) the credential holds: at least one, each once. Optional: omitted, Koil records what the platform reports; sent, Koil keeps these. An issuer that reports none needs them declared.
1 <= itemsYour own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to "" is removed.
properties <= 50Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/connections" \ -H "Koil-Version: 2026-12-01" \ -H "Idempotency-Key: string" \ -H "Content-Type: application/json" \ -d '{ "method": "oauth", "appId": "app_123", "clientUserId": "customer-user-123", "grant": { "accessToken": "EAAG...", "expiresAt": "2026-08-30T09:30:00.000Z" }, "metadata": { "accountId": "acct_42" } }'{ "kind": "connection", "mode": "live", "id": "conn_123", "issuerId": "facebook", "method": "oauth", "oauth": { "appId": "app_123" }, "clientUserId": "customer-user-123", "status": "active", "credential": { "scopes": [ "instagram_basic", "pages_show_list", "pages_read_engagement" ] }, "metadata": { "accountId": "acct_42" }, "createdAt": "2026-07-01T09:30:00.000Z", "updatedAt": "2026-07-01T09:30:00.000Z"}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}{ "error": { "code": "validation_error", "message": "string", "meta": { "violations": [ { "code": "string", "path": "string", "message": "string" } ], "budgets": [ "string" ], "profileIds": [ "string" ], "required": [ "string" ], "limit": 0, "resourceType": "string", "resourceId": "string", "reason": "string", "refusalReason": "messaging_window_closed", "property1": null, "property2": null }, "requestId": "string" }}List Koil Connections for the current Organization GET
Previous Page
Export an `oauth` Connection's current platform grant GET
Export an `oauth` Connection's current platform grant. Requires an API key with the `credentials:export` permission. Any other method is refused with `not_supported`: Koil exports only what a platform issued to an authorization it ran, never a key someone submitted.