Exchange a sign-in code for a token
The last step of browser sign-in. The program calls this once it has received the authorization code on its loopback redirect, together with the PKCE verifier it generated when the sign-in started. On success it returns a person token the program keeps on this machine.
Last updated:
The last step of browser sign-in. The program calls this once it has received the authorization code on its loopback redirect, together with the PKCE verifier it generated when the sign-in started. On success it returns a person token the program keeps on this machine.
POST /api/v1/oauth/token
Authorization
No sign-in is needed.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
grant_type | one of authorization_code | yes | |
code | string | yes | |
code_verifier | string | yes | |
redirect_uri | string | yes | |
client_id | string | yes |
Example request:
{
"grant_type": "authorization_code",
"code": "a1b2c3d4e5f6",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"redirect_uri": "http://127.0.0.1:51824/callback",
"client_id": "dmmi"
}Responses
200
The token.
| Field | Type | Required | Description |
|---|---|---|---|
access_token | string | yes | |
token_type | one of Bearer | yes | |
scopes | list of string | yes | |
issued_at | string (date-time) | yes | |
idle_expires_at | string (date-time) | yes | |
hard_expires_at | string (date-time) | yes | |
person | object | yes | |
person.name | string | yes | |
person.email | string | yes |
Example response:
{
"access_token": "dmm_pt_7xK2mQ9pL4nR8sV1tY3wZ6bC0dF5gH2jK9mN4pQ7rS",
"token_type": "Bearer",
"scopes": [
"workspaces:read",
"environments:read",
"pipelines:read",
"pipelines:write",
"runs:launch",
"runs:read",
"runs:cancel"
],
"issued_at": "2026-10-12T10:00:00Z",
"idle_expires_at": "2026-11-11T10:00:00Z",
"hard_expires_at": "2027-04-10T10:00:00Z",
"person": {
"name": "Alex Morgan",
"email": "alex.morgan@example.com"
}
}400
The sign-in request is no longer valid.
| Field | Type | Required | Description |
|---|---|---|---|
message | string | yes | |
status | integer | yes | |
errorCode | string | yes | |
timestamp | string (date-time) | no | |
path | string | no | |
details | object | no |
Example response:
{
"message": "This sign-in request is no longer valid. Start the sign-in again.",
"status": 400,
"errorCode": "INVALID_GRANT"
}