Documentation / API reference
POST /v1/auth/device/token
Poll with the private device_code from startAgentLogin. After owner approval, one exchange returns a 30-day scoped API key as access_token. Save it securely; it cannot be fetched again. No refresh token. Ordinary REST and MCP Bearer authentication then applies. Owner approval is required again after expiry; revoke keys in the dashboard. JSON device-login protocol, not automatic MCP OAuth discovery.
- Auth
- none required
Request body
| Field | Type | Default | Notes |
|---|---|---|---|
device_code * | string |
curl -s https://stockfishapi.com/v1/auth/device/token \
-H "Content-Type: application/json" \
-d '{"device_code":"REPLACE_WITH_PRIVATE_DEVICE_CODE"}' const res = await fetch("https://stockfishapi.com/v1/auth/device/token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"device_code": "REPLACE_WITH_PRIVATE_DEVICE_CODE"
}),
});
const data = await res.json(); import requests
r = requests.post(
"https://stockfishapi.com/v1/auth/device/token",
json={
"device_code": "REPLACE_WITH_PRIVATE_DEVICE_CODE"
},
)
data = r.json() Responses
| Status | Meaning |
|---|---|
200 | Key returned once |
400 | authorization_pending: continue polling; access_denied, expired_token or invalid_grant: stop. Malformed input can return problem+json. |
409 | Account has ten keys; ask the owner to revoke an unused key, then retry if the code has not expired |
429 | slow_down or rate-limit problem; honor Retry-After |
Errors follow problem+json with next_action.