1. Docs
  2. API Reference
  3. Update the Account's policy for its administrators' second factor

Update the Account's policy for its administrators' second factor

PATCH/portal/v1/accounts/{accountSlug}/admin-mfa-policy

Changes 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

Bearer TokenAuthorization

JWT access token. Never send alongside X-API-Key: a request carrying both is refused.

Requires capability account.manageAccount

Edit 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.

range 0–30

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`.

one of "exempt" · "require"

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.

range 0–90

Responses

application/json

  • dataAdminMfaPolicyResponseDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

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.

403account.capability_requiredForbidden
When it happens

The signed-in user's administrator roles do not grant the capability this endpoint requires.

Remediation

Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.

Returned object

Request
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
  }'
Response
{
  "data": {
    "required": false,
    "grace_period_days": 0,
    "after_sso": "exempt",
    "trusted_device_days": 0
  }
}
Related endpoints
GETGet the current Account
PATCHUpdate the Account name or settings
DELETEDelete the Account (owner only)
GETGet the Account's hosted-page settings
PATCHUpdate the Account's hosted-page settings
GETGet the Account's policy for its administrators' second factor
Was this page helpful?

Tell us how we can improve this guide.