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
curl -X POST https://api.platic.ai/v1/secrets/$SECRET_ID/rotate \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "value": "your-new-api-key" }' await platic.secrets.rotate("secret_123", "your-new-api-key"); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
secretId | string | Id of the secret | ✓ |
Request body
| Field | Type | Description | Required |
|---|---|---|---|
value | string | The 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
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | value is missing or empty. details.issues has the list of problems, without repeating the value |
403 | FORBIDDEN | The person behind the token cannot manage secrets |
404 | SECRET_NOT_FOUND | The secret does not exist in this workspace or was already deleted |
409 | SECRET_CHANGED | Another change arrived at the same time. Repeat the call |
409 | SECRET_USE_REVOKED | The secret is revoked or being deleted. Create a new one |
Notes
- The
idand 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.