Rotate an API key's secret
Replace the key's secret in place, keeping its id, name and scopes. The PREVIOUS secret stops authenticating immediately — there is no overlap window — so anything still using it starts failing on its next request. As with creation, the response depends on the caller: a signed-in dashboard session receives the new secret in plaintextToken, once; any other caller receives lastFour and a one-time revealUrl and never the secret. A revoked key cannot be rotated (400 KEY_REVOKED).
Requires the api-keys:write scope — Create, rotate, and revoke API keys — these keep working even after you disconnect this app.
better-auth.session_token<token>BetterAuth session cookie. Used by the dashboard / browser clients. When present, the active project is taken from the x-project-id header.
id*stringProject id.
keyId*stringAPI key id.
API key rotated. The new secret is in plaintextToken for a dashboard session, behind revealUrl for everyone else.
application/json- response
success*truetruedata*curl -X POST 'https://api.sendly.now/api/projects/string/api-keys/string/rotate'{ "success": true, "data": { "lastFour": "string", "plaintextToken": "string", "revealUrl": "http://example.com", "revealExpiresAt": "2019-08-24T14:15:22Z" }}