Rotate the calling node's token (node side, `opdns-node rotate-token`).
const url = 'https://api.opdns.io/v1/nodes/self/token';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"reason":"manual"}'};
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://api.opdns.io/v1/nodes/self/token \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "reason": "manual" }'Issues a new node token. Only the node’s current token can rotate: the previous
token of a committed rotation, still valid for its grace, gets 409
node_token_superseded. Until the node’s first request with the new token both
tokens work; that request commits the rotation, which is audited
(node.token_rotated, meta reason, committed_by), and the presented token
then keeps working for previous_valid_s seconds (600). A connected node
rotates over the link instead (RotateToken, same rules; automatic every
link.token_rotation, 90 days by default). The token is shown once; the
response is Cache-Control: no-store.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Recorded in the audit row; default manual.
Responses
Section titled “Responses”The new token.
object
The new node token (opdnsnode_...).
Seconds the presented token keeps working after the commit.
Examplegenerated
{ "node_token": "example", "previous_valid_s": 1}Malformed request.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "invalid JSON body", "request_id": "5f2c9a0e7b1d4c38"}Missing or unknown node token (unauthenticated) or revoked node (node_revoked).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
Example
{ "type": "https://opdns.io/problems/node_revoked", "title": "Unauthorized", "status": 401, "code": "node_revoked", "detail": "the node was revoked", "request_id": "5f2c9a0e7b1d4c38"}node_token_superseded: the presented token is no longer the node’s current token.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
Example
{ "type": "https://opdns.io/problems/node_token_superseded", "title": "Conflict", "status": 409, "code": "node_token_superseded", "detail": "the presented token is no longer the node's current token", "request_id": "5f2c9a0e7b1d4c38"}Field validation failed (validation_failed, unknown_list).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
Example
{ "type": "https://opdns.io/problems/validation_failed", "title": "Unprocessable Content", "status": 422, "code": "validation_failed", "detail": "the request has invalid fields", "errors": [ { "field": "settings.block_mode", "message": "one of nxdomain, refused, null, block-page" } ], "request_id": "5f2c9a0e7b1d4c38"}Rate limited (rate_limited).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
Example
{ "type": "https://opdns.io/problems/rate_limited", "title": "Too Many Requests", "status": 429, "code": "rate_limited", "detail": "too many requests", "request_id": "5f2c9a0e7b1d4c38", "retry_after": 6}