Rotate a personal access token's secret
POST/api/user/tokens/{token_id}/rotate
rotatePersonalAccessToken
Replaces the token's secret in place, keeping its id, label, and grant. The old secret is invalidated immediately; the new raw value is returned once. Expiry is re-stamped to 90 days. Requires sudo-mode unless the account has no step-up credential and therefore cannot acquire sudo.
Requires authentication using a session cookie — see tokens and scopes.
curl
curl -X POST 'https://neosource.dev/api/user/tokens/TOKEN_ID/rotate' \
-b 'ns_session=$NEOSOURCE_SESSION'fetch
fetch("https://neosource.dev/api/user/tokens/TOKEN_ID/rotate", {
method: "POST",
credentials: "include",
});neo
neo token rotate TOKEN_IDPath parameters
token_idrequiredToken ID to revoke.
Responses
200Rotated
application/json
403Forbidden — one of: forbidden, sudo_required
application/json
one of
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 401Authentication required
- 429Rate limited — retry after the `Retry-After` header
- 500Internal server error
- 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
- 504Gateway timeout — the request exceeded the server's handling budget