---
title: OAuth API reference
description: Platform API v1, OAuth: every operation's path, parameters, request and response fields, scopes, idempotency and errors, from the contract.
url: https://agentlab.cresclab.com/docs/en/api/oauth
language: en
updated: 2026-12-05
---

# OAuth API reference

Platform API v1, OAuth: every operation's path, parameters, request and response fields, scopes, idempotency and errors, from the contract.

> [!NOTE]
> Generated from the API contract (Agent Lab Platform API 1.0.0-alpha.1). Descriptions are the contract's own words.

Sign-in and tokens for applications (RFC 6749, 7009, 7662; OpenID Connect).

## Start authorization (authorization code with PKCE)

`GET /v1/oauth/authorize`

A browser navigation, not an API call. `scope=install` asks a workspace administrator to
install the application (never combined with another scope). A valid request is redirected
to the consent screen
(or, for an operators' own application with a signed-in person, straight back to the
client). An invalid one is answered here and never redirected to an unverified URI.

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | none | — |

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | query | `string` | yes | — |
| `redirect_uri` | query | `string` | yes | — |
| `code_challenge` | query | `string` | yes | — |
| `code_challenge_method` | query | `string` | yes | One of: `S256`. |
| `response_type` | query | `string` | no | — |
| `state` | query | `string` | no | — |
| `resource` | query | `string` | no | — |
| `scope` | query | `string` | no | — |
| `nonce` | query | `string` | no | — |
| `organization_id` | query | `string (uuid)` | no | The workspace to preselect on the consent screen, by id. A hint only. |
| `organization` | query | `string` | no | The same hint by the workspace's short name. |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `302` | — | To the consent screen, or back to the client. |
| `400` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | The request is invalid. |
| `500` | `application/json`: [LegacyErrorString](https://agentlab.cresclab.com/docs/en/api/schemas.md#LegacyErrorString) | The consent screen's address is misconfigured. |

## Exchange a code, refresh a token, or get an installation token

`POST /v1/oauth/token`

Three grants:

- `authorization_code` (with PKCE): a person's sign-in. When the code came from an install
  request (`scope=install` at `/v1/oauth/authorize`), the answer names the installation and
  carries no token (`InstallResult`).
- `refresh_token`: a new access token for the same sign-in.
- `client_credentials`: an installed application's server asks for a one-hour installation
  token, naming the installation by `installation_id` or `workspace_id`. No refresh token:
  the application asks again. Refused alike unless the client authenticated with its secret,
  the installation is live for that client, and its workspace still allows it.

A workspace application authenticates with its secret, by HTTP Basic (`client_secret_basic`,
each half form-encoded first) or in the body (`client_secret_post`); both at once must name
the same client and the secret may be sent only once. Any other client is public and sends
only `client_id`. Requests that carry a secret are rate limited per address.

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | `clientSecretBasic` | — |

### Request body

`application/x-www-form-urlencoded`: [TokenRequest](https://agentlab.cresclab.com/docs/en/api/schemas.md#TokenRequest)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `grant_type` | `string` | yes | One of: `authorization_code`, `refresh_token`, `client_credentials`. |
| `code` | `string` | no | — |
| `code_verifier` | `string` | no | — |
| `client_id` | `string` | no | — |
| `client_secret` | `string` | no | `client_secret_post`; a workspace application's secret. |
| `redirect_uri` | `string` | no | — |
| `resource` | `string` | no | — |
| `refresh_token` | `string` | no | — |
| `installation_id` | `string` | no | `client_credentials`: the installation, by id. |
| `workspace_id` | `string` | no | `client_credentials`: the installation, by the workspace it is in. |
| `scope` | `string` | no | `client_credentials`: `install` or absent. |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `200` | `application/json`: [TokenResponse](https://agentlab.cresclab.com/docs/en/api/schemas.md#TokenResponse) or [InstallationTokenResponse](https://agentlab.cresclab.com/docs/en/api/schemas.md#InstallationTokenResponse) or [InstallResult](https://agentlab.cresclab.com/docs/en/api/schemas.md#InstallResult) | The tokens, or where an application was installed. Never cached. |
| `400` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | `invalid_grant`, `invalid_request` or `unsupported_grant_type`. |
| `401` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | `invalid_client`: the client authentication is missing, wrong or malformed. |
| `429` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Too many requests carrying a secret from this address, or tokens for this client. |
| `503` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Try again. |

## Revoke a token (RFC 7009)

`POST /v1/oauth/revoke`

Answers 200 whether or not the token named anything.

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | none | — |

### Request body

`application/x-www-form-urlencoded`: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | `string` | no | — |
| `client_id` | `string` | no | — |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `200` | — | Revoked, or nothing to revoke. |
| `503` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Storage is unavailable; try again. |

## Introspect a token (RFC 7662)

`POST /v1/oauth/introspect`

The application's server asks whether a bearer token is one the platform honors, and as
whom: an operators' application about its sign-in tokens, a workspace application about its
sign-in and installation tokens. Server to server only (no CORS). A token that is unknown,
expired, revoked, for another audience or issued to any other client answers
`{"active": false}`.

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | `clientSecretBasic` | — |

### Request body

`application/x-www-form-urlencoded`: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | `string` | yes | — |
| `token_type_hint` | `string` | no | — |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `200` | `application/json`: [Introspection](https://agentlab.cresclab.com/docs/en/api/schemas.md#Introspection) | The token's state. Never cached. |
| `400` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | `token` is missing. |
| `401` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | The client credential is missing or wrong. |
| `429` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Too many requests from this address or client. |
| `503` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Try again. |

## The signed-in person (OpenID Connect userinfo)

`GET /v1/oauth/userinfo`

For a sign-in's token of any client. Only an operators' application's page may call it from
a browser; any other client calls it from its server.

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | `personToken` | — |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `200` | `application/json`: [UserInfo](https://agentlab.cresclab.com/docs/en/api/schemas.md#UserInfo) | The claims the token's scope allows, and the workspace it is bound to. |
| `401` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | No token, or one this endpoint does not honor. |
| `403` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Sent from a page that is not the application's registered origin. |
| `503` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Try again. |

## The signed-in person (OpenID Connect userinfo, POST form)

`POST /v1/oauth/userinfo`

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | `personToken` | — |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `200` | `application/json`: [UserInfo](https://agentlab.cresclab.com/docs/en/api/schemas.md#UserInfo) | The claims the token's scope allows, and the workspace it is bound to. |
| `401` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | No token, or one this endpoint does not honor. |
| `403` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Sent from a page that is not the application's registered origin. |
| `503` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | Try again. |

## The keys that sign ID tokens

`GET /v1/oauth/jwks.json`

| Scopes | Acts as | Authentication | Idempotency-Key |
| --- | --- | --- | --- |
| none | — | none | — |

### Responses

| Status | Body | Description |
| --- | --- | --- |
| `200` | `application/json`: `object` | A JSON Web Key Set (public keys only). |
| `404` | `application/json`: [OAuthError](https://agentlab.cresclab.com/docs/en/api/schemas.md#OAuthError) | ID tokens are not configured on this server. |

#### `200` `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `keys` | `object`[] | yes | — |
