Skip to content
Dashboard
Theme
Theme

Rotate a client's secret

POST /v1/m2m_clients/{client}/rotate_secret: Rotate a client's secret.

View Markdown

POST /v1/m2m_clients/{client}/rotate_secret

Scope
machine_clients:write
Auth
Secret key (sk_…)
Since
1.0
  • client string Required

  • OhAuthCat-Version string

    Minor version; defaults to the environment’s pin.

  • keep_previous boolean

    Keep the old secret working for 24 hours.

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/m2m_clients/mcli_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/rotate_secret" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"keep_previous": true
}'
Response 200
{
"client": {
"id": "mcli_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"object": "m2m_client",
"organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"name": "Acme Corp",
"auth_method": "client_secret",
"secret_hint": "example_secret_hint",
"previous_secret_expires_at": "2026-01-15T09:30:00Z",
"jwks": {},
"scopes": [
"organizations:read"
],
"audiences": [
"https://api.acme.com"
],
"access_token_seconds": 60,
"revoked_at": "2026-01-15T09:30:00Z",
"last_used_at": "2026-01-15T09:30:00Z",
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z"
},
"client_secret": "sk_test_example"
}