errors.connections.connect-ci

Connect a repository’s CI environment: its jobs exchange their OIDC token for an upload token

POST /errors/api/projects/{id}/ci-bindingsIAM ci:PutEnvironmentChanges state

A job with `environment: <name>` and `permissions: id-token: write` requests an OIDC token with the audience errors.<root> and posts it to /errors/api/upload-token/exchange. Pull-request runs are refused; the token is revoked when the run ends.

Depending on the resource, the call checks errors:UpdateProject instead; hold all of them to be sure it is allowed.

Request syntax

POST /errors/api/projects/{id}/ci-bindings
{
  "repositoryId": "string",
  "environment": "string",
  "sentryEnvironment": "string"
}

Path parameters

  • idRequired

    string

    Constraints: uuid

Request body

  • repositoryIdRequired

    string

    Git repository id

    Constraints: uuid

  • environmentRequired

    string

    CI environment name, as a job’s `environment:` names it; created when missing

    Constraints: 1-255 chars

  • sentryEnvironmentOptional

    string

    SENTRY_ENVIRONMENT for the jobs; omitted: the CI environment’s own name

    Constraints: 1-64 chars, /^[^\s/]+$/

    May be null.

Response

201 with { id, repositoryId, repositoryName, environment, sentryEnvironment, audience }: `audience` the audience the job’s OIDC token must name. A repository’s environment connects to one project: connecting it again, to this or another project, replaces its binding. Needs ci:PutEnvironment on the repository and errors:UpdateProject on the project. 400 for an environment name CI does not accept; 404 when the project or the repository does not exist; 409 when the managed key cannot be set up.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow ci:PutEnvironment on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud errors connections connect-ci id --repository-id 00000000-0000-0000-0000-000000000000 --environment example

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_errors_connections_connect-ci.