Start a connect
const url = 'https://example.com/v1/connections';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"app":"example","appId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","projectId":"example","permissions":["example"],"for":"me","label":"example","reconnects":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","number":"example","replaceInbound":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/connections \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "app": "example", "appId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "projectId": "example", "permissions": [ "example" ], "for": "me", "label": "example", "reconnects": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "number": "example", "replaceInbound": true }'Makes a connect request for the caller’s own account (for: 'me', the default; signed in as a person) or the company’s (for: 'company'; a tenant admin only). Send the person to the request’s connectUrl, or call POST /v1/connections/requests/{requestId}/start for the app’s consent page. The company and each person keep one connection per account, registration and environment: a connect lands on its owner’s connection of the account signed in to, which is known only at the finish, or makes a new one. To connect a given connection again, name it in reconnects; the same account is required at the finish. A run that needs a connection it lacks makes its own request and waits for it (waitingFor.connections on the run). An app connected without a browser (texts) has no consent page: the connect names the account (number), the server looks it up with the registration’s credential, and the request comes back connected, with connectionId; its connectUrl page only shows it connected, and expiresAt ends only a pending request. Connecting a number moves its inbound texts onto Kindgi’s messaging profile, whose outbound settings then apply; a reconnect names the connection’s own number and looks it up again with the registration’s current credential, which is how a credential-refused connection works again. A key or session limited to a project is refused, 403 permission-denied: a connection reaches every project.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”Connect request made.
A connect: the owner goes to connectUrl, consents at the app, and comes back. A run that needs a connection it lacks waits on one. An app connected without a browser (texts) has no such step: its request is connected from the start.
object
Example
{ "owner": { "kind": "member" }, "state": "pending"}Malformed body, unknown field, a reconnects that isn’t a UUID, a label that isn’t 1 to 100 characters with no control, format or invisible characters (such as bidi overrides, zero-width characters or line separators), a number that isn’t E.164 or a replaceInbound that isn’t true (bad-input, details.field); number missing on a texts connect, or number or replaceInbound on any other app’s (bad-input, details.field); for: 'me' from a credential that is not a person (bad-input); or no registration that fits (connection-app-invalid, connection-app-unknown-entry).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}for: 'company' from a caller who is not a tenant admin (permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No registration with that appId (connection-app-not-found); or reconnects names no live connection of the connect’s own owner on that registration and environment, whether another owner’s, another registration’s or environment’s, removed or unknown (connection-not-found, details.field reconnects).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body; another live connection of the same app, owner and env has that label, ignoring case, an emoji’s variation selector and how accented letters are encoded, and the connect isn’t a reconnect (connection-label-taken, details.field label); or the connection is still being disconnected: disconnect it again to finish, then connect (connection-removing). For a number (texts): its inbound texts go somewhere else today, details.host the webhook’s host or else details.profile the messaging profile it is on; connect again with replaceInbound: true to move it onto Kindgi’s (inbound-in-use); it is connected through another registration or env of the tenant, details.appId and details.envName (number-in-use); or a reconnect names another number than the connection’s, which the message names (connection-account-mismatch). Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The provider refused the registration’s credential or the lookup of the number (connection-app-refused, with the provider’s code in the message). Update the registration’s secret, or check the number at the provider, and connect again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/connections: List connections- Kindgi 0.5.0
- Error code
authz-backend-unavailable - Error code
bad-input - Error code
connection-account-mismatch - Error code
connection-app-invalid - Error code
connection-app-not-found - Error code
connection-app-refused - Error code
connection-app-unknown-entry - Error code
connection-label-taken - Error code
connection-not-found - Error code
connection-removing - Error code
database-busy - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
inbound-in-use - Error code
number-in-use - Error code
permission-denied - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code