Skip to content

CI OIDC API ​

6 endpoints. Request and response schemas are described on the schemas page; the other tags are listed in the API index.

Endpoints ​

POST /api/v1/auth/oidc/exchange ​

Exchange a CI ID token for an access token

Trade the OpenID Connect ID token of a CI job (GitHub Actions, GitLab CI, ...) for a short-lived deploy token of the service account a trust policy maps it to. No credentials are needed: the ID token is the credential. Its signature is verified against the issuer's published keys, and its issuer, audience, expiry and claims are checked against the enabled trust policies. Every refusal of the token is the same 401, whatever the cause. Rate-limited per client address.

Authentication: none (public endpoint).

Request body (required)

application/json: object

FieldTypeRequiredDescription
policystringnoName of the trust policy to use; by default the oldest policy that accepts the token.
tokenstringyesThe CI job's ID token (a JWT).

Responses

StatusDescriptionBody
200Token issuedapplication/json: OIDCExchangeResponse
400Malformed requestapplication/json: Error
401Token not acceptedapplication/json: Error
429Too many requestsapplication/json: Error

GET /api/v1/oidc-trust-policies ​

List CI OIDC trust policies

List the trust policies of the CI OIDC token exchange, by name (admin only).

Responses

StatusDescriptionBody
200Trust policiesapplication/json: object
400Invalid requestapplication/json: Error
403Admin access required-

Fields of the 200 response (application/json):

FieldTypeRequiredDescription
dataarray of OIDCTrustPolicyno-

POST /api/v1/oidc-trust-policies ​

Create CI OIDC trust policy

Trust the ID tokens of a CI system that match the conditions and map them to a service account (admin only). See POST /api/v1/auth/oidc/exchange.

Request body (required)

application/json: object

FieldTypeRequiredDescription
audiencestringyesThe aud value the CI job requests; matched exactly.
conditionsarray of OIDCConditionyesAll conditions must hold. Policies of a shared issuer (GitHub Actions, gitlab.com) need one on an identity claim such as repository, sub or project_path, whose patterns do not start with a wildcard.
enabledbooleannoDefault: true.
issuerstring (uri)yesIssuer URL exactly as in the iss claim of the tokens, for example https://token.actions.githubusercontent.com or https://gitlab.com. Must be https and pass the outbound-request (SSRF) check.
namestringyesUnique name: 1-64 letters, digits, dot, dash or underscore.
service_account_idstring (uuid)yes-
token_ttl_secondsintegernoLifetime of exchanged tokens. Default: 900. Minimum: 60. Maximum: 3600.

Responses

StatusDescriptionBody
201Trust policy createdapplication/json: OIDCTrustPolicy
400Invalid request, including an issuer that fails the outbound-request check or a missing identity condition for a shared issuerapplication/json: Error
403Admin access required-
409A trust policy with this name existsapplication/json: Error

GET /api/v1/oidc-trust-policies/{id} ​

Get CI OIDC trust policy

Get one trust policy (admin only).

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes-

Responses

StatusDescriptionBody
200Trust policyapplication/json: OIDCTrustPolicy
403Admin access required-
404Trust policy not found-

PATCH /api/v1/oidc-trust-policies/{id} ​

Update CI OIDC trust policy

Change any field of a trust policy; omitted fields keep their value (admin only). Tokens already exchanged stay valid until they expire (at most one hour).

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes-

Request body (required)

application/json: object

FieldTypeRequiredDescription
audiencestringnoThe aud value the CI job requests; matched exactly.
conditionsarray of OIDCConditionnoAll conditions must hold. Policies of a shared issuer (GitHub Actions, gitlab.com) need one on an identity claim such as repository, sub or project_path, whose patterns do not start with a wildcard.
enabledbooleannoDefault: true.
issuerstring (uri)noIssuer URL exactly as in the iss claim of the tokens, for example https://token.actions.githubusercontent.com or https://gitlab.com. Must be https and pass the outbound-request (SSRF) check.
namestringnoUnique name: 1-64 letters, digits, dot, dash or underscore.
service_account_idstring (uuid)no-
token_ttl_secondsintegernoLifetime of exchanged tokens. Default: 900. Minimum: 60. Maximum: 3600.

Responses

StatusDescriptionBody
200Trust policy updatedapplication/json: OIDCTrustPolicy
400Invalid requestapplication/json: Error
403Admin access required-
404Trust policy not found-
409A trust policy with this name existsapplication/json: Error

DELETE /api/v1/oidc-trust-policies/{id} ​

Delete CI OIDC trust policy

Delete a trust policy (admin only). Tokens already exchanged stay valid until they expire (at most one hour); disable the service account to cut them off at once.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes-

Responses

StatusDescriptionBody
204Trust policy deleted-
403Admin access required-
404Trust policy not found-

Free software under the AGPL-3.0-or-later.