Choose a connection
const url = 'https://example.com/v1/connection-choices';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","agentId":"example","flowId":"example","toolId":"example","need":"example","connectionId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","connectionIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"person":{"userId":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/v1/connection-choices \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "agentId": "example", "flowId": "example", "toolId": "example", "need": "example", "connectionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "connectionIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "person": { "userId": "example" } }'Chooses which connection an agent or a flow uses, in the project and this server’s environment, for the connection’s app; with toolId, which one that tool uses, ahead of the agent’s or flow’s. A tool’s choice may be a set (connectionIds): a call of a tool that changes nothing names one of them, by name, else uses connectionId. A company choice is the project’s admins’ (admin on the project). A person’s (person) is that person’s alone, for their own runs, and needs only what running the agent or flow does. The connection must be a candidate (GET /v1/connection-choices/candidates, with owner=me for your own). Choosing the connection already chosen answers that choice as it is. Choosing another removes that choice and makes a new one at the next version, in one step.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Name what the choice is for: agentId or flowId, one of them, and toolId for a tool’s own. A company choice is a project admin’s; a person’s (person) is theirs alone.
object
Examplegenerated
{ "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "agentId": "example", "flowId": "example", "toolId": "example", "need": "example", "connectionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "connectionIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "person": { "userId": "example" }}Responses
Section titled “Responses”The choice.
Which connection an agent or a flow uses for an app in a project, in one env: agentId or flowId, one of them. The company’s, or a person’s own (person), for their runs. With toolId, it’s that tool’s, which comes before the agent’s or flow’s. A choice is never changed: changing it removes it and makes a new one at the next version.
object
Examplegenerated
{ "choiceId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "envName": "example", "agentId": "example", "flowId": "example", "app": "example", "toolId": "example", "need": "example", "connectionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "connectionIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "person": { "userId": "example" }, "version": 1, "createdAt": "2026-04-15T12:00:00Z", "createdBy": "example", "removedAt": "2026-04-15T12:00:00Z", "removedBy": "example"}A malformed body or unknown field; a projectId or connectionId that is not a UUID; both agentId and flowId, or neither; a person’s own connection in a company choice; a person who isn’t the caller; a toolId the agent or flow has no tool of the app by; a need that’s missing for a tool that uses the app twice, or one the tool doesn’t have; or a set that isn’t for one tool, isn’t 2 to 10 different connections with the default among them, is for a tool that changes things, may send what it reads elsewhere (sensitive-data-egress) or has its own accounts input, or has a member with no name (bad-input, details.field).
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" }}A company choice by a caller who isn’t an admin of the project, or a person’s by one who may not run its agent or flow (permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No such project (project-not-found); the agent or flow isn’t one of the project’s (agent-not-found, flow-not-found); or a connection isn’t a candidate, the same answer as for one that doesn’t exist (connection-not-found, details.field connectionId or connectionIds).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body, or resource-state conflict. 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 choice couldn’t be stored just now (connection-store-failed), or the Idempotency-Key store couldn’t be read before the request ran (idempotency-store-unavailable, with Retry-After). Or the authorization store couldn’t be reached (authz-backend-unavailable, with Retry-After), or the database was too busy for the authorization check (database-busy, with Retry-After), so the request wasn’t run. 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/connection-choices: List connection choices- Choose a connection
- Kindgi 0.5.0
- Error code
agent-not-found - Error code
authz-backend-unavailable - Error code
bad-input - Error code
connection-not-found - Error code
connection-store-failed - Error code
database-busy - Error code
flow-not-found - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
permission-denied - Error code
project-not-found - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code