Update the Account's policy for its administrators' second factor
/portal/v1/accounts/{accountSlug}/admin-mfa-policyChanges the Account's policy for its administrators' second factor; only the fields sent change. required makes every member enroll a factor: the next time a member without one enters the Account they get grace_period_days of sign-ins with mfa_enrollment_pending, then no session until they enroll (requires_mfa_enrollment); 0 days means enroll before the first session. after_sso decides whether a member arriving through the Account's SSO connection still owes a Canopy factor. trusted_device_days bounds how long "remember this device" lasts for members; 0 withdraws the offer. Turning required on refuses with 400 (admin_mfa.actor_without_factor) unless the caller already holds a factor, so no one locks themselves out. Requires account.manage; audited as an Account settings update.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
account.manageAccountEdit account profile and general settings, including how administrators sign in. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.
Path Parameters
accountSlugstring Required The Account's slug. An unknown one answers 404.
Request body
application/json
requiredboolean Optional Every member of this Account must hold a second factor. Turning it on requires the caller to hold one already. Default false.
grace_period_daysnumber Optional Days a member without a factor may keep signing in once the requirement first applies to them. 0 means enroll before the first session. Default 7.
after_ssoenum Optional Whether a member who arrived through the Account's SSO connection still owes a Canopy factor. `exempt` trusts the identity provider's own second factor. Default `exempt`.
trusted_device_daysnumber Optional How long "remember this device" lasts for members of this Account, in days. The shortest value across a member's Accounts applies; 0 withdraws the offer. Default 30.
Responses
application/json
data *AdminMfaPolicyResponseDto
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.
account.capability_requiredForbiddenThe signed-in user's administrator roles do not grant the capability this endpoint requires.
Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.
Returned object
curl -X PATCH "https://auth.canopy-io.com/portal/v1/accounts/value/admin-mfa-policy" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "required": false, "grace_period_days": 0, "after_sso": "exempt", "trusted_device_days": 0 }'
{ "data": { "required": false, "grace_period_days": 0, "after_sso": "exempt", "trusted_device_days": 0 } }
Tell us how we can improve this guide.