Re-roll an API key
const url = 'https://api.overwatch.weareheavy.dev/v1/keys/example/reroll';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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.overwatch.weareheavy.dev/v1/keys/example/reroll \ --header 'Authorization: Bearer <token>'Rotate a key’s secret: mint a fresh key under the same name and site scope, then delete the old one. The new key keeps the old key’s remaining lifetime (rotation doesn’t extend expiry); a key with no expiry stays without one. Session-only, owner/admin. The plaintext is returned once.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The API key’s id (from GET /v1/keys).
Responses
Section titled “ Responses ”The replacement key. The old key no longer works.
A freshly minted key. key is the plaintext, shown only in this response.
object
The plaintext API key (wah_…). Store it now — it is never shown again.
The key’s site scope, or null for full organization access.
Examplegenerated
{ "id": "example", "name": "example", "key": "example", "siteIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ]}Missing or invalid credentials.
object
A human-readable error message.
Example
{ "error": "invalid api key"}A dashboard session is required (API-key callers are rejected), or the session’s role does not allow this action.
object
A human-readable error message.
Example
{ "error": "a dashboard session is required"}No key with that id exists in your organization.
object
A human-readable error message.
Example
{ "error": "key not found"}