API reference: auth
Sign in by emailed code or GitHub, sign out, and sign the CLI in from a browser.
API conventions explains auth, IDs, lists, errors and idempotency. The examples read the API key from ARVM_API_KEY.
Operations
| Operation | Request |
|---|---|
| Email a sign-in code | POST /v1/auth/email/start |
| Exchange an emailed code for a session | POST /v1/auth/email/verify |
| Start GitHub sign-in | GET /v1/auth/github/start |
| Finish GitHub sign-in | GET /v1/auth/github/callback |
| End the session | POST /v1/auth/logout |
| Start signing the CLI in | POST /v1/auth/device/start |
| Poll for the CLI’s API key | POST /v1/auth/device/token |
| Approve a CLI sign-in from the browser | POST /v1/auth/device/approve |
Email a sign-in code
POST /v1/auth/email/start
Sends a 6-digit code to the address. The response is the same whether or not the address has an account: a new address gets an account, and a personal org, when its code is verified.
- Operation ID:
startEmailLogin - Auth: none
Request body
application/json: EmailLoginStart
Responses
| Status | Description | Body |
|---|---|---|
| 202 | The code was sent, if the address can receive mail. | application/json: EmailLoginStarted |
Errors: 400, 429. Error responses says what each status means.
Example
$ curl -s -X POST "https://api.arvm.dev/v1/auth/email/start" \
-H "Content-Type: application/json" \
-d '{"email": "ada@example.com"}'
Response body, application/json:
{
"expires_in_seconds": 900
}
Exchange an emailed code for a session
POST /v1/auth/email/verify
- Operation ID:
verifyEmailLogin - Auth: none
Request body
application/json: EmailLoginVerify
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Signed in. The session cookie is set. | application/json: Session |
Errors: 400, 429. Error responses says what each status means.
Example
$ curl -s -X POST "https://api.arvm.dev/v1/auth/email/verify" \
-H "Content-Type: application/json" \
-d '{"email": "ada@example.com", "code": "402913"}'
Response body, application/json:
{
"user": {
"id": "usr_01jcz3k8x0e5v9w2r4t6y8a0bq",
"email": "ada@example.com",
"name": "Ada",
"created_at": "2026-11-10T20:15:00Z"
},
"org": {
"id": "org_01jcz3k8x0e5v9w2r4t6y8a0bq",
"name": "Ada",
"created_at": "2026-11-10T20:15:00Z"
}
}
Start GitHub sign-in
GET /v1/auth/github/start
Redirects the browser to GitHub. Open it as a page, not with fetch.
- Operation ID:
startGithubLogin - Auth: none
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
return_to |
query | string | no | A path in the web app to land on after sign-in. Default: /. |
Responses
| Status | Description | Body |
|---|---|---|
| 302 | Redirect to GitHub’s authorization page. |
Errors: 400, 429. Error responses says what each status means.
Finish GitHub sign-in
GET /v1/auth/github/callback
GitHub redirects the browser here. The account is matched by the GitHub user ID, then by GitHub’s verified primary email. A GitHub account with no verified email is refused.
- Operation ID:
completeGithubLogin - Auth: none
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
code |
query | string | yes | |
state |
query | string | yes |
Responses
| Status | Description | Body |
|---|---|---|
| 302 | Redirect to the web app. On success, lands on return_to with the session cookie set and the OAuth state cookie cleared. On a sign-in refusal (invalid_state, github_exchange, or no_verified_email), lands on /sign-in?error=... with the OAuth state cookie cleared. |
Errors: 400, 429. Error responses says what each status means.
End the session
POST /v1/auth/logout
- Operation ID:
logout - Auth: the web app’s session cookie only
Responses
| Status | Description | Body |
|---|---|---|
| 204 | Signed out. The session cookie is cleared. |
Errors: 401, 429. Error responses says what each status means.
Example
$ curl -s -X POST "https://api.arvm.dev/v1/auth/logout" \
-b "session=$ARVM_SESSION"
Start signing the CLI in
POST /v1/auth/device/start
The CLI calls this, shows user_code, opens verification_uri_complete in a browser, and
polls pollDeviceLogin with device_code every interval_seconds.
- Operation ID:
startDeviceLogin - Auth: none
Request body
application/json: DeviceLoginStart
Responses
| Status | Description | Body |
|---|---|---|
| 200 | The device login was started. | application/json: DeviceLogin |
Errors: 400, 429. Error responses says what each status means.
Example
$ curl -s -X POST "https://api.arvm.dev/v1/auth/device/start" \
-H "Content-Type: application/json" \
-d '{"client_name": "ada-laptop"}'
Response body, application/json:
{
"device_code": "dc_7Qm2vX9pL4kR8sT1wY6zB3nH5jF0aGdE",
"user_code": "BDFK-7Q2M",
"verification_uri": "https://arvm.dev/device",
"verification_uri_complete": "https://arvm.dev/device?code=BDFK-7Q2M",
"expires_in_seconds": 600,
"interval_seconds": 2
}
Poll for the CLI’s API key
POST /v1/auth/device/token
Returns 202 until a signed-in user approves the code. The first poll after approval returns
200 with a new API key; its secret is not stored and is never returned again. An unknown,
expired or already used device_code is 404.
- Operation ID:
pollDeviceLogin - Auth: none
Request body
application/json: DeviceLoginPoll
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Approved. The API key for the CLI. | application/json: APIKeyWithSecret |
| 202 | Not approved yet. Poll again after interval_seconds. |
application/json: DeviceLoginPending |
Errors: 400, 404, 429. Error responses says what each status means.
Example
$ curl -s -X POST "https://api.arvm.dev/v1/auth/device/token" \
-H "Content-Type: application/json" \
-d '{"device_code": "dc_7Qm2vX9pL4kR8sT1wY6zB3nH5jF0aGdE"}'
Response body, application/json:
{
"id": "key_01jcz3k8x0e5v9w2r4t6y8a0bq",
"name": "ci",
"scope": "full",
"display_prefix": "arvm_7Qm2",
"created_at": "2026-11-10T20:25:00Z",
"expires_at": "2027-02-08T20:25:00Z",
"secret": "arvm_7Qm2vX9pL4kR8sT1wY6zB3nH5jF0aGdE2cU7iO4yN"
}
Approve a CLI sign-in from the browser
POST /v1/auth/device/approve
The signed-in user confirms the code their CLI shows. The CLI’s key belongs to the session’s org.
- Operation ID:
approveDeviceLogin - Auth: the web app’s session cookie only
Request body
application/json: DeviceLoginApprove
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Approved. | application/json: DeviceLoginApproved |
Errors: 400, 401, 404, 429. Error responses says what each status means.
Example
$ curl -s -X POST "https://api.arvm.dev/v1/auth/device/approve" \
-b "session=$ARVM_SESSION" \
-H "Content-Type: application/json" \
-d '{"user_code": "BDFK-7Q2M"}'
Response body, application/json:
{
"client_name": "ada-laptop"
}