Logout
const url = 'https://example.com/auth/logout/';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"refresh_token":"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 https://example.com/auth/logout/ \ --header 'Content-Type: application/json' \ --data '{ "refresh_token": "example" }'Revoke all refresh tokens and bump token_version for the current user.
SEC-S15 (Phase 1062-01): revoke_all_tokens bumps User.token_version so the access JWT used for this logout call (and any other outstanding access JWTs) are rejected on the next authenticated request — closing the “logout doesn’t invalidate the access JWT” gap.
fix(#821): logout deliberately does NOT bump key_epoch — API keys exist to outlive browser sessions (CI, MCP servers, tile URLs), so session hygiene must not revoke them. Security events (password change, role change) do.
fix(#1446): the refresh COOKIE can authenticate this call when the access token has aged out. Requiring a live bearer token meant a user returning after their 15-minute access token expired got a 401 here while their multi-day refresh cookie stayed valid — the UI reported a clean logout and the session survived it. CSRF is enforced on that path exactly as it is for /auth/refresh, since the cookie is then the credential.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Request Body
Section titled “Request Body ”object
Example generated
{ "refresh_token": "example"}Responses
Section titled “ Responses ”Successful Response
Bad request — invalid query parameters or payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks access to this resource
Not found
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request