Skip to main content

Client Secret Rotation API

Legacy compatibility endpoint for switching the legacy-compatible primary secret.

warning

Prefer the Client API Keys API for normal operations. It supports overlapping keys and phased cutovers. This route exists for backward compatibility only.


POST /api/clients/[clientId]/rotate-secret

Generate a new primary client secret without revoking existing active keys.

Authentication

GOFA Super Admin only.

Path Parameters

ParameterTypeRequiredDescription
clientIdstringYesThe client ID to rotate secret for

Request

No request body required.

Example Request
POST /api/clients/bupa/rotate-secret
Authorization: Bearer <gofa_admin_token>

Response

200 OK — Primary secret replaced successfully

Success Response
{
"success": true,
"clientSecret": "<new-secret>"
}
FieldTypeDescription
successbooleanAlways true on success
clientSecretstringThe newly generated secret

Error Responses

StatusDescription
401Unauthorized — missing or invalid authentication
403Forbidden — caller is not a GOFA super admin
404Client not found
500Internal server error

Behavior

  1. Generates a new cryptographically random secret
  2. Marks the new secret as the legacy-compatible primary key
  3. Keeps previously active keys valid until they are explicitly revoked elsewhere
  4. Returns the new secret in the response

Retrieving the Current Secret

Use the existing client detail endpoint with ?includeSecret=true:

GET /api/clients/bupa?includeSecret=true
Authorization: Bearer <gofa_admin_token>

The clientSecret field is only included when requested by a super admin.


Security Considerations

  • Only GOFA super admins can call this legacy route
  • Use the Client API Keys API for safer staged migrations
  • Revoke old keys explicitly after downstream systems have switched