Rotate an integration's secret
/api/v1/organizations/{id}/oauth-clients/{clientId}/rotate-secretMints a new client_secret, returned in this response only. The replaced secret keeps working for 24 hours (previous_secret_expires_at); expire_previous: "now" stops it at once, for a secret that has leaked.
Authentication
Authorization Option A JWT access token. Never send alongside X-API-Key: a request carrying both is refused.
X-API-Key Option B API key for management-tier access. Never send alongside an Authorization header: a request carrying both is refused.
Path Parameters
idstring Required clientIdstring Required Request body
application/json
expire_previousenum Optional `window` (the default) keeps the replaced secret working for 24 hours so the systems using it can move to the new one. `now` stops it the moment the rotation lands, for a secret that has leaked.
Responses
application/json
data *OAuthClientSecretRotatedResponseDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
Errors
When the request can't be completed, the response body includes a stable error code you can branch on, and a correlation_id (also sent as the X-Correlation-Id header). Quote the correlation id when you contact support: it identifies the exact request in Canopy's logs.
organization.integrations_disabledForbiddenThe Environment does not let organizations create integrations: <code>organization_integrations_enabled</code> is off, which it is by default. Every route under <code>/api/v1/organizations/{org_id}/oauth-clients</code> answers this until the developer turns it on.
Turn on <strong>Let organizations create integrations</strong> on <strong>Tenant → Authentication → Tokens</strong> and choose <strong>Roles integrations may hold</strong>, or send <code>organization_integrations_enabled: true</code> with <code>organization_integration_role_ids</code> to the Environment's auth settings.
organization.integration_not_foundNot foundNo integration with that <code>client_id</code> belongs to the organization. A machine client the developer pinned to the organization is not one of its integrations and reads as not found here.
List the organization's integrations (<code>GET /api/v1/organizations/{org_id}/oauth-clients</code>) and use a <code>client_id</code> from there. Manage a developer's client on <code>/api/v1/oauth-clients</code>.
Returned object
curl -X POST "https://auth.canopy-io.com/api/v1/organizations/value/oauth-clients/value/rotate-secret" \ -H "X-API-Key: $CANOPY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "expire_previous": "now" }'
{ "data": { "client_id": "string", "client_secret": "string", "previous_secret_expires_at": "2026-04-20T12:00:00.000Z" } }
Tell us how we can improve this guide.