Update an organization's authentication policy
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/organizations/{id}/policySets the organization's own authentication policy. A field set to null inherits the Environment again. The policy can only tighten the Environment's settings: mfa_required can be true where the Environment leaves MFA optional, mfa_factor_allowlist must be a subset of the Environment's, mfa_after_sso can be require where the Environment exempts, and require_sso refuses password and code logins for members. Returns 400 (organization.policy_loosens) when a value would loosen the Environment, 409 when If-Match does not match the policy version. Requires the hierarchy.manage permission at the organization and emits organization.policy.updated.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
env_organizations.manageDeveloper ConsoleSwitch the organizations container on and off and create, rename, and delete organizations. 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.
appSlugstring Required The Application's slug within the Account.
envSlugstring Required The Environment's slug within the Application.
idstring Required Headers
If-MatchOptimistic-lock version of the resource. Send the `version` field returned on read; the server rejects with 409 if the row has changed since.
Request body
application/json
mfa_requiredboolean Optional Require MFA for this organization's members. `true` tightens an Environment that leaves MFA optional; `false` is only accepted where the Environment does not require MFA; `null` inherits.
mfa_factor_allowlistenum[] Optional Factors this organization's members may enroll and use. Must be a non-empty subset of the Environment's allowlist; `null` inherits.
mfa_after_ssoenum Optional Whether an SSO login still owes an MFA challenge. `require` tightens an Environment that exempts SSO; `exempt` is only accepted where the Environment exempts; `null` inherits.
allowed_sign_in_methodsenum[] Optional The sign-in methods this organization's members may use. A non-empty subset of the methods the Environment offers (`password` unless the Environment turned it off, `email_otp` where the Environment turned it on, and `sso`); a method the Environment does not offer is refused with `organization.policy_loosens`. `null` inherits the Environment's. While `require_sso` is on, SSO is the only method whatever this says.
require_ssoboolean Optional Members must sign in through SSO. Password and email-code logins are refused for the organization's members and for any email whose domain routes to a connection bound to this organization.
Responses
application/json
data *OrganizationPolicyResponseDto
application/json
error *ApiErrorBodyDto
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/applications/value/environments/value/organizations/value/policy" \ -H "If-Match: "3"" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "allowed_sign_in_methods": [ "password" ], "require_sso": false }'
{ "data": { "organization_id": "string", "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "allowed_sign_in_methods": [ "password" ], "require_sso": false, "environment": { "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "allowed_sign_in_methods": [ "password" ], "require_sso": false }, "effective": { "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "allowed_sign_in_methods": [ "password" ], "require_sso": false }, "version": 0, "sso_recovery_codes_generation": 0, "sso_recovery_codes_remaining": 0, "sso_recovery_codes": [ "string" ] } }
Tell us how we can improve this guide.