Change the instance's auth settings
const url = 'https://example.com/api/v1/instance/auth-settings';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"session_idle_timeout_seconds":1,"session_absolute_timeout_seconds":1,"token_max_lifetime_seconds":1,"token_expiry_required":true,"password_min_length":1,"self_service_password_reset":true,"local_login_enabled":true,"sso_enforced_domains":[{"domain":"example","provider":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/api/v1/instance/auth-settings \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "session_idle_timeout_seconds": 1, "session_absolute_timeout_seconds": 1, "token_max_lifetime_seconds": 1, "token_expiry_required": true, "password_min_length": 1, "self_service_password_reset": true, "local_login_enabled": true, "sso_enforced_domains": [ { "domain": "example", "provider": "example" } ] }'Replaces every setting. Every replica applies a change within a
second, and live sessions are judged by lowered timeouts at once: a
session past a lowered idle or absolute timeout ends. A raised
absolute timeout never lengthens a session that opened under a lower
one. Refused invalid_auth_settings naming each field that breaks a
rule: every duration a whole number of seconds from 60 to 315360000
(ten years), the idle timeout at most the absolute one, the password
minimum length from 12 to 128, and each enforced domain named once,
to an enabled auth provider that lists it among its domains.
sso_enforced_domains is the whole list: a domain left out is
lifted. Disabling local login, or changing the enforced domains while
it is disabled, is refused identity_required unless the caller
holds an identity that signs them in under the new settings: at an
enabled auth provider and, when their own email domain is enforced,
at the provider it is enforced to. Whoever closes the door keeps a
way through it; flagnetic admin unlock
enables it again from the server’s side. Audited
auth_settings.updated.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The instance’s rules for sessions, API tokens and passwords.
object
A session ends this long after its last request. 86400 (a day) on a fresh instance.
A session ends this long after it opened, however much it is used. 2592000 (30 days) on a fresh instance.
The furthest ahead an API token may expire. 31536000 (365 days) on a fresh instance.
Whether an API token must be created with an expiry. False on a fresh instance.
The fewest characters a password chosen from now on has, never below 12. 12 on a fresh instance.
Whether a member can ask for a password reset by mail (POST /auth/password-reset). It also takes an SMTP server. True on a fresh instance. An instance admin can still issue a password reset whatever this says.
Whether members may sign in with a password at all. Off, every sign-in, invitation acceptance and password reset by password is refused local_login_disabled, and members sign in through auth providers. True on a fresh instance.
The email domains whose people sign in only through one auth provider, in the order given. A password is no way in for them (sso_required, naming the provider), nor is any other provider. Empty on a fresh instance.
An email domain sent to one auth provider.
object
The domain, such as example.com, stored lowercase; its subdomains are not included. It must be one of the provider’s domains.
The slug of the enabled auth provider its people sign in through.
Example generated
{ "session_idle_timeout_seconds": 1, "session_absolute_timeout_seconds": 1, "token_max_lifetime_seconds": 1, "token_expiry_required": true, "password_min_length": 1, "self_service_password_reset": true, "local_login_enabled": true, "sso_enforced_domains": [ { "domain": "example", "provider": "example" } ]}Responses
Section titled “Responses”The settings as changed.
The instance’s rules for sessions, API tokens and passwords.
object
A session ends this long after its last request. 86400 (a day) on a fresh instance.
A session ends this long after it opened, however much it is used. 2592000 (30 days) on a fresh instance.
The furthest ahead an API token may expire. 31536000 (365 days) on a fresh instance.
Whether an API token must be created with an expiry. False on a fresh instance.
The fewest characters a password chosen from now on has, never below 12. 12 on a fresh instance.
Whether a member can ask for a password reset by mail (POST /auth/password-reset). It also takes an SMTP server. True on a fresh instance. An instance admin can still issue a password reset whatever this says.
Whether members may sign in with a password at all. Off, every sign-in, invitation acceptance and password reset by password is refused local_login_disabled, and members sign in through auth providers. True on a fresh instance.
The email domains whose people sign in only through one auth provider, in the order given. A password is no way in for them (sso_required, naming the provider), nor is any other provider. Empty on a fresh instance.
An email domain sent to one auth provider.
object
The domain, such as example.com, stored lowercase; its subdomains are not included. It must be one of the provider’s domains.
The slug of the enabled auth provider its people sign in through.
Example generated
{ "session_idle_timeout_seconds": 1, "session_absolute_timeout_seconds": 1, "token_max_lifetime_seconds": 1, "token_expiry_required": true, "password_min_length": 1, "self_service_password_reset": true, "local_login_enabled": true, "sso_enforced_domains": [ { "domain": "example", "provider": "example" } ]}No credential, or one that is not accepted: unauthenticated without
a credential (a session cookie the server did not issue counts as
none); invalid_token, token_revoked or token_expired for an API
token, with a WWW-Authenticate header naming the code;
session_expired for a session that has ended, whose cookie is
cleared; invalid_credentials for a sign-in.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}Headers
Section titled “Headers”The caller may not perform the operation: forbidden (with the
missing permission), session_required, insufficient_scope,
cross_origin for a request signed in by the session cookie, a read
included, that the browser says comes from another origin, or, for a
write, change_request_required when it would change what a
protected environment’s SDKs receive; detail names those
environments.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}The request is well formed but breaks a rule; errors names each field to fix.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).
Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "permission": "example", "current_version": 1, "references": [ { "kind": "example", "key": "example", "environment": "example" } ], "provider": "example", "used_by": [ "example" ], "failure": "example", "failure_status": 1, "failure_code": "example", "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}