Rotate a secret

SDK platic.secrets.rotate()

Update a credential when the provider gives you a new value or the previous one is exposed. Send the new value in value. Bound APIs, MCP servers and webhooks use it from their next call, without binding the secret again.

Example

await platic.secrets.rotate("secret_123", "your-new-api-key");

Path parameters

ParameterTypeDescriptionRequired
secretIdstringId of the secret✓

Request body

FieldTypeDescriptionRequired
valuestringThe new value. 1 to 16,384 characters✓
{
  "value": "sk_test_example_new"
}

Response

The response has the secret's details, never the value.

{
  "status": "success",
  "message": "Secret rotated successfully",
  "data": {
    "id": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c",
    "name": "Acme Store · Orders API",
    "kind": "bearer",
    "status": "active",
    "revision": 3,
    "createdAt": "2026-10-28T12:05:00.000Z",
    "updatedAt": "2026-11-05T10:15:30.000Z"
  }
}

Response fields

data has the secret after the change, with the fields in list secrets. The id does not change; revision goes up by one.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTvalue is missing or empty. details.issues has the list of problems, without repeating the value
403FORBIDDENThe person behind the token cannot manage secrets
404SECRET_NOT_FOUNDThe secret does not exist in this workspace or was already deleted
409SECRET_CHANGEDAnother change arrived at the same time. Repeat the call
409SECRET_USE_REVOKEDThe secret is revoked or being deleted. Create a new one

Notes

  • The id and the bound slots are kept: there is nothing to bind again.
  • What is already published keeps working with the new value. An API you have not published yet needs a new test before you publish it, and an MCP server needs to be tested before you choose tools again.
  • If you rotate a webhook's signing secret, update the same value on your server: the following deliveries are signed with the new one.
  • A revoked secret cannot be rotated.