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
idstring Required Headers
if-matchrequiredIf-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.
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.
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/{accountSlug}/applications/{appSlug}/environments/{envSlug}/organizations/value/policy" \ -H "if-match: value" \ -H "If-Match: value" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "require_sso": false }'
{ "data": { "organization_id": "string", "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "require_sso": false, "environment": { "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "require_sso": false }, "effective": { "mfa_required": false, "mfa_factor_allowlist": [ "totp" ], "mfa_after_sso": "exempt", "require_sso": false }, "version": 0 } }
Tell us how we can improve this guide.