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"}'};
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" }'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).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1). A retry sent while the first request still runs is answered 409 idempotency-key-in-flight with Retry-After, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets 409 idempotency-key-replay-withheld, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered 503 idempotency-store-unavailable with Retry-After: nothing ran, so retry with the same key (from 0.3.0).
Request Bodyrequired
Section titled “Request Bodyrequired”object
The app’s entry id.
Which registration, when the workspace has more than one for the app.
When given, the registration must allow this project.
The entry’s permission keys to ask for.
me: the caller’s own account (signed in as a person). company: the company’s account; a tenant admin only.
The connection’s name, trimmed, with no control, format or invisible characters (such as bidi overrides, zero-width characters or line separators); another live connection of the same app, owner and env can’t have it, ignoring case, an emoji’s variation selector and how accented letters are encoded. Absent: the account’s label. A reconnect keeps the connection’s name, and doesn’t check this one against the others.
The connection to connect again: a live one of this connect’s own owner (the caller’s for for: 'me', the company’s for for: 'company'), on the same registration and environment. Any other id is 404 connection-not-found, the same answer as for one that doesn’t exist. The same account is required at the finish, and the connection keeps its name. Absent: a person’s connect, like the company’s, asks only for the permissions it lists; at the finish it lands on the owner’s connection of the account signed in to, when there is one (when it’s connected, reconnected is true; a grant short of what that connection holds leaves it as it was, and the connect is declined with missing unless the connection is working and already holds what was asked), else makes a new one.
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.
object
The app’s entry id.
Who owns a connection: one member (kind: member, with their userId), or the company (kind: company, the workspace’s own account).
object
The member. Present when kind is member.
The permissions asked for: the ones needed, and the ones already granted.
What each asks for, in plain words.
The connection it connects again; the same account is required.
The name asked for the connection it makes. A reconnect keeps the connection’s.
The run that waits for it.
The tool’s name for the connection, when a run waits.
Who started it last: <kind>:<id>. Only they may finish it.
Why it failed: account-mismatch, app-refused, store-write-failed.
The permissions the app granted less than asked.
A GitHub App’s, while it’s pending: the app’s installations the person’s GitHub account reaches, when the finish found several and none was picked. They pick one and start again with installationId, or install the app on another account with newInstallation.
A GitHub App installation the person can reach.
object
The account it’s on: its login, or the enterprise’s slug.
object
The account’s stable id at the app.
What people see: an email address, a login.
The connection it made.
Where the owner starts.
Example
{ "owner": { "kind": "member" }, "state": "pending"}Malformed body, unknown field, a reconnects that isn’t a UUID or 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) (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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}for: 'company' from a caller who is not a tenant admin (permission-denied).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
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).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store couldn’t be read before the request ran (idempotency-store-unavailable), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}See also
GET /v1/connections: List connections- Kindgi 0.5.0
- Error code
bad-input - Error code
connection-app-invalid - Error code
connection-app-not-found - Error code
connection-app-unknown-entry - Error code
connection-label-taken - Error code
connection-not-found - Error code
connection-removing - Error code
idempotency-store-unavailable - Error code
permission-denied - Error code
request-too-large - Every error code