Approve a pending CLI device code from the browser
curl -X POST 'https://dashboard.justcrawl.io/api/v1/cli-auth/approve' \ -H 'Authorization: Bearer $JUSTCRAWL_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{"user_code":"ABCD-EFGH"}'Browser-side leg of the device-authorization flow. Mints a new API key
bound to the calling user’s org (named jc CLI on <hostname>) and
attaches the plaintext key to the cli_auth_codes row so the CLI’s next
/cli-auth/poll receives it. Lateral-movement defense: this endpoint
refuses Bearer-token (sr_live_*) auth — only a browser JWT can
approve a CLI session. That blocks an attacker holding a leaked API
key from minting a second persistent key with a benign-looking name.
Race-safe: if a concurrent expiry/approval wins between the pre-check
and the UPDATE, the minted key is kept (caller can delete it from the
dashboard) and a 410 is returned so the UI can retry.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
Example generated
{ "user_code": "example"}Responses
Section titled “ Responses ”Approved. Body echoes hostname so the dashboard can render confirmation.
object
Example
{ "ok": true}Validation failed — request body or query is missing/invalid
object
Example
{ "error": "Missing or invalid \"url\" field"}Missing or invalid authentication token
object
Example
{ "error": "Missing or invalid authentication token"}Browser JWT required — API-key Bearer auth is refused here (lateral-movement defense).
Unknown user_code.
Code expired or already used (includes the post-race lost-update case).
Unexpected server error. Logs and PostHog $exception capture
object
Example
{ "error": "Something went wrong"}