Deployments.ai Docs
Providers

Grant a connection to an agent

POST /v1/connection-grants · SDK createConnectionGrant · CLI deployments grant create

POST
/v1/connection-grants

Authorization

platformBearer
headerAuthorizationBearer <token>

Platform bearer credential accepted as an opaque API key or JWT.

Header Parameters

x-deployments-environment*string
Match^[0-7][0-9A-HJKMNP-TV-Z]{25}$
idempotency-key*string
Length1 <= length <= 512

Request Body

application/json
  1. body
connectionId*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
externalResourceConstraints?
purpose*string
Match^\S[\s\S]*\S$|^\S$|^$
Length1 <= length <= 2048
scopes*array<>
workspaceId*|

Workspace whose runs may use the connection. null grants every workspace in the environment and is accepted only for a connection that uses no credential; any other connection fails with 422 environment_grant_requires_credentialless_connection.

Response Body

ConnectionGrantResponse

application/json
  1. response
authorizationVersion*integer
Range0 <= value
connectionId*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
createdAt*string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
externalAccountId*string
externalResourceConstraints*
id*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
providerKey*string
Match^[a-z0-9](?:[a-z0-9._-]{0,126}[a-z0-9])?$
purpose*string
scopes*array<string>
status*string
Value in"active""revoked"
updatedAt*string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
version*integer
Range0 <= value
workspaceId*|

Granted workspace, or null when the grant covers every workspace in the environment.

curl -X POST "https://example.com/v1/connection-grants" \  -H "x-deployments-environment: string" \  -H "idempotency-key: string" \  -H "Content-Type: application/json" \  -d '{    "connectionId": "string",    "purpose": "string",    "scopes": [      "string"    ],    "workspaceId": "string"  }'
{  "authorizationVersion": 0,  "connectionId": "string",  "createdAt": "2019-08-24T14:15:22Z",  "externalAccountId": "string",  "externalResourceConstraints": {    "property1": null,    "property2": null  },  "id": "string",  "providerKey": "string",  "purpose": "string",  "scopes": [    "string"  ],  "status": "active",  "updatedAt": "2019-08-24T14:15:22Z",  "version": 0,  "workspaceId": "string"}