Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

Poll for a device grant

POST
/api/auth/device/token
curl --request POST \
--url http://localhost:8080/api/auth/device/token \
--header 'Content-Type: application/json' \
--data '{ "device_code": "example" }'

Answers the grant once the user approved the code, and only once; a second poll answers expired_token. Until then it answers 400 with an RFC 8628 code in code: authorization_pending (poll again after interval), slow_down (poll less often; the interval grew by 5 seconds), access_denied (the user denied the code) or expired_token (the code expired, was already collected, or is unknown). The answer carries Cache-Control: no-store.

Media typeapplication/json

POST /api/auth/device/token body. Debug prints device_code as <redacted>.

object
device_code
required

The device_code of POST /api/auth/device/code.

string

Example generated

{
"device_code": "example"
}

The grant: the server origin, the token and, for init, the project and the ingest key.

Media typeapplication/json

POST /api/auth/device/token answer once the user approved. The answer is the only place the secrets appear. Debug prints token and ingest_key as <redacted>.

object
ingest_key

A secret key with the ingest scope only, sk-cetra-…. Present for init.

string
project

The project of an init grant. Absent for login.

object
id
required

Project id.

string format: uuid
name
required

Project name.

string
org_slug
required

Slug of the project’s org.

string
slug
required

Project slug.

string
server
required

The server’s public URL origin: what the CLI and the SDKs talk to.

string
token
required

A personal access token, pat-cetra-…, valid for 90 days.

string

Example generated

{
"ingest_key": "example",
"project": {
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"name": "example",
"org_slug": "example",
"slug": "example"
},
"server": "example",
"token": "example"
}

The request is malformed or a filter is invalid.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}