Poll for a device grant
const url = 'http://localhost:8080/api/auth/device/token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"device_code":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Request Bodyrequired
Section titled “Request Bodyrequired”POST /api/auth/device/token body. Debug prints device_code as <redacted>.
object
The device_code of POST /api/auth/device/code.
Example generated
{ "device_code": "example"}Responses
Section titled “Responses”The grant: the server origin, the token and, for init, the project and the ingest key.
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
A secret key with the ingest scope only, sk-cetra-…. Present for init.
The project of an init grant. Absent for login.
object
Project id.
Project name.
Slug of the project’s org.
Project slug.
The server’s public URL origin: what the CLI and the SDKs talk to.
A personal access token, pat-cetra-…, valid for 90 days.
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.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}