Skip to content

Poll for the result of a CLI device-authorization flow

POST
/api/v1/cli-auth/poll
curl -X POST 'https://dashboard.justcrawl.io/api/v1/cli-auth/poll' \
-H 'Content-Type: application/json' \
-d '{"device_code":"<your-device-code>"}'

Final leg of the device-authorization flow. The CLI polls this endpoint at the interval returned by /cli-auth/start (currently every 2s); once the user approves in the browser, this endpoint returns the API key plaintext exactly ONCE. A second poll after success returns 410 auth_code_consumed — the CLI must persist the key on the first success response. Body branches: { status: "pending" } while the user hasn’t approved yet; { status: "approved", api_key, org_id, org_name, user_email } on the single success read. Subject to cliAuthLimiter. This is the endpoint jc auth login --browser (master plan Phase 0.5) loops on after opening the verification URL.

Media type application/json
object
device_code
required
string
Example generated
{
"device_code": "example"
}

Poll result. Either still-pending or approved-with-key.

Media type application/json
One of:
object
status
string
Allowed values: pending
Example
{
"status": "pending"
}

Validation failed — request body or query is missing/invalid

Media type application/json
object
error
string
Example
{
"error": "Missing or invalid \"url\" field"
}

Unknown device_code.

Code expired or already consumed (post-approval second poll).

Unexpected server error. Logs and PostHog $exception capture

Media type application/json
object
error
string
Example
{
"error": "Something went wrong"
}