Refuses a pending stx login request. Use it when a code you didn't start shows up on the consent screen. A denied request can't be approved later and never yields a token.
Note
Requires a session JWT. API keys are rejected with 401. Any plan.
Request Body
NameDescription
userCode:stringbodyRequired
The code shown by stx login (1–32 characters). Case and the dash are optional.
Response — 200 OK
Denying a code that is already denied returns the same response.
What the CLI sees
The request is kept until its 10 minutes are up, so a client polling POST /v1/auth/device-token keeps getting the same answer:
json
{
"error": {
"code": "access_denied",
"message": "The sign-in request was denied"
}
}
with status 403. The poll checks for a denial before 428 authorization_pending, and once the code expires it returns 410 expired as before. Trying to approve a denied code with POST /v1/auth/device-approve returns 409 device_denied ("This sign-in request was denied. Run stx login again.").
Note
stx releases before 0.7.0 don't act on access_denied: they keep polling until their own 10-minute timeout, then report that authentication timed out. No token is issued either way. stx 0.7.0 and later stop straight away on a denial, with exit code 1 — see stx login.
Error Responses
400 Bad Request
A missing or empty userCode returns 400 validation_error, with the problem in details.issues.
401 Unauthorized
unauthorized for a missing, invalid or expired token (or an API key); session_revoked when the session has been signed out.
404 Not Found
not_found ("Invalid code") — no request has this code. This includes a code whose token the CLI has already picked up.
409 Conflict
already_approved — the code has already been approved. To undo an approved stx login, revoke its session instead:
json
{
"error": {
"code": "already_approved",
"message": "This code was already used to sign in. Revoke the session from Profile instead.",