Preview

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.

Path Parameters
  • id
    Type: string
    max length:  
    100
    required

    API key identifier.

Body·
application/json

Optional fields for rotating an API key.

  • grace_period_seconds
    Type: integer Format: int32
    min:  
    0
    max:  
    86400

    Number of seconds the previous key remains valid after the replacement is created. Use 0 for immediate rotation.

Responses
  • application/json
  • application/json
  • application/json
  • application/json
  • application/json
Request Example for post/v2/credentials/api-keys/{id}/rotate
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"
}