Rotate an API key
Creates a replacement API key and, when a grace period is provided, keeps the previous key valid until the grace period expires. Use a zero grace period for immediate rotation. The replacement secret is returned only in this response.
Access is not enabled by default. Customers must request API key management permissions from Paypercut before using this endpoint. The acting principal must have permission to rotate API keys for the account.
Rotate keys during planned credential changes, suspected exposure, or scheduled key hygiene work. Update your application to use the replacement secret before the previous key expires.
- Type: stringidmax length:100required
API key identifier.
Optional fields for rotating an API key.
- Type: integer Format: int32grace
_period _seconds min:0max:86400Number of seconds the previous key remains valid after the replacement is created. Use
0for immediate rotation.
- application/json
- application/json
- application/json
- application/json
- application/json
curl 'https://api.paypercut.io/v2/credentials/api-keys/{id}/rotate' \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"grace_period_seconds": 1800
}'
{
"id": "ak_123",
"secret": "sk_test_1234567890abcdef"
}
