@faable/auth-sdk 2.7.75 → 2.7.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/spec/openapi.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "@faablecloud/auth",
5
5
  "description": "Auth Platform made by Faable. Manage Users and Roles",
6
- "version": "2.60.0",
6
+ "version": "2.62.0",
7
7
  "license": {
8
8
  "name": "private",
9
9
  "url": "https://faable.com/docs/platform/privacy-policy"
@@ -7519,7 +7519,7 @@
7519
7519
  },
7520
7520
  "ErrorCode": {
7521
7521
  "type": "string",
7522
- "description": "Machine-readable error code. One HTTP status per code.\n\n- `bad_request` (400): The request is malformed. `message` says what is wrong.\n- `validation_error` (400): The body, query or path failed schema validation. `details.issues` lists each failing field.\n- `unauthorized` (401): The request carries no valid credentials.\n- `payment_required` (402): The feature is not included in the current plan.\n- `forbidden` (403): The credentials are valid but do not allow this operation.\n- `not_found` (404): The resource does not exist in this account.\n- `method_not_allowed` (405): The HTTP method is not supported on this path.\n- `conflict` (409): The request conflicts with the current state of the resource.\n- `payload_too_large` (413): The request body exceeds the size limit.\n- `unsupported_media_type` (415): The `Content-Type` is not accepted by this endpoint.\n- `unprocessable_entity` (422): The request is well-formed but cannot be processed.\n- `too_many_requests` (429): Rate limit exceeded. Honour the `Retry-After` header.\n- `internal_error` (500): Unexpected server error. Retry later; the request id is logged.\n- `already_exists` (400): A resource with the same unique field already exists (for a user, usually `email`). `details.fields` names the field.\n- `invalid_id` (400): The id in the path is not a valid id for this resource.\n- `account_not_found` (404): No Auth Account matches the request (domain, header or token).\n- `invalid_query` (400): The `?query=` FaableQL expression could not be parsed.\n- `search_not_supported` (400): This resource does not support `?search=`.\n- `invalid_expand` (400): An `?expand=` path is not allowed on this resource.\n- `access_denied` (401): The caller may not access this row (ownership or machine-to-machine restriction).\n- `insufficient_scope` (403): The token lacks a scope this operation requires. `message` names it.\n- `team_required` (400): An Auth Account must belong to a project (team).\n- `account_limit_reached` (409): The project already has the maximum number of Auth Accounts.\n- `invalid_project_id` (400): The project id is not of the form `project_<hex>` or `team_<hex>`.\n- `account_transfer_refused` (409): The Auth Account cannot be moved to that project. `details.blockers` lists why.\n- `email_sender_domain_not_allowed` (400): The sender address is not in a domain this platform signs email for (AUTH_EMAIL_SENDER_DOMAINS).\n- `plan_required` (402): The setting requires a higher plan. `message` says which.\n- `invalid_canonical_host` (400): `canonical_host` must be this account's own platform host or one of its verified custom domains.\n- `canonical_host_breaks_passkeys` (400): `canonical_host` is outside the account's current WebAuthn RP ID — every passkey already enrolled would stop working. Set `webauthn_rp_id` in the same request to a suffix that covers both.\n- `not_logged_in` (401): There is no signed-in session for this request.\n- `session_already_revoked` (409): The session was already revoked.\n- `invalid_token` (401): The bearer token is missing, malformed, expired or has no subject.\n- `not_owner` (403): The caller may only perform this operation on their own user.\n- `user_suspended` (403): The user is suspended and cannot sign in or be modified.\n- `invalid_credentials` (400): The email/username or password is incorrect.\n- `login_denied` (401): A post-login Action denied the sign-in. `message` carries the reason it gave. On token grants it is a 403 with `error: invalid_grant`.\n- `signup_denied` (403): A pre-signup Action or an active block denied the sign-up. `message` carries the reason.\n- `client_credentials_denied` (401): An Action denied the client_credentials grant. `message` carries the reason.\n- `m2m_quota_exceeded` (402): The project used the machine-to-machine tokens its plan includes this month. Free is capped; Hobby and Pro are billed per token instead.\n- `signup_disabled` (403): Self-service sign-up is disabled on this connection.\n- `email_taken` (409): Another user in this account already uses that email.\n- `invalid_email` (400): The email address is not valid.\n- `invalid_name` (400): The name contains a link. `message` says which field.\n- `same_email` (400): The new email is the same as the current one.\n- `user_has_no_email` (400): The operation needs an email but the user has none.\n- `password_too_weak` (400): The password does not meet the connection policy. `message` lists each unmet rule.\n- `invalid_password_hash` (400): The imported password hash cannot be read, or its cost is above what a login can afford. `message` names the field.\n- `weak_password_hash` (400): The imported password hash uses a fast digest (MD5, SHA-1, SHA-2) or a cost below the minimum. `message` says which.\n- `invalid_code` (400): The verification code is wrong, expired or already used.\n- `invalid_phone` (400): The phone number is not E.164 and could not be resolved with the account default country. Include the country code.\n- `phone_changed` (400): The phone on the user changed after the code was sent. Start again.\n- `phone_already_verified` (409): The user already has a verified phone; the number cannot be swapped from the screen.\n- `sms_unavailable` (409): This account cannot send SMS right now. The suffix says why: `sms_unavailable:plan`, `:quota`, `:provider`.\n- `sms_failed` (409): The SMS provider rejected the message.\n- `invalid_state` (400): The `state` is missing, expired, or does not describe a resumable step.\n- `state_mismatch` (401): The `state` belongs to another account, session, client or ceremony.\n- `invalid_ticket` (400): The ticket does not exist or is not the kind this endpoint accepts.\n- `ticket_used` (400): The ticket was already consumed.\n- `ticket_expired` (400): The ticket is past its expiry.\n- `ticket_not_found` (404): No ticket with that id belongs to this user.\n- `credential_not_found` (404): The user has no password credential on this connection.\n- `invalid_link` (400): The magic link is malformed.\n- `expired_link` (400): The magic link token was not found or has expired.\n- `invalid_otp` (401): The one-time password is wrong or expired.\n- `invalid_client` (400): The `client_id` in the request does not name a client of this account.\n- `client_not_found` (404): No client with that `client_id`.\n- `client_mismatch` (401): The client belongs to a different account.\n- `invalid_client_metadata` (400): Dynamic client registration rejected a field (RFC 7591). `message` names it.\n- `invalid_connection` (400): The connection does not exist, is disabled, or is not of the type this flow needs.\n- `no_database_connection` (400): The tenant has no database connection, so there is nowhere to store a password. Create one and retry.\n- `connection_required` (400): No connection was given and the client has no `default_connection`.\n- `connection_misconfigured` (400): The connection is missing settings needed to talk to its provider.\n- `passwordless_unavailable` (400): No passwordless connection is configured or enabled for this client.\n- `ambiguous_connection` (400): Several connections match; pass `connection_id`.\n- `invalid_redirect_uri` (400): The redirect URI is not registered for the client.\n- `origin_not_allowed` (403): The request `Origin` is not in the client's Allowed Web Origins.\n- `audience_not_found` (403): The `audience` does not name an API registered in this account.\n- `system_resource` (403): The resource is managed by Faable and cannot be modified or deleted.\n- `invalid_request` (400): A required OAuth parameter is missing or two of them are incompatible. `message` says which.\n- `invalid_device_code` (400): The device or user code is invalid or expired.\n- `provider_error` (400): The upstream identity provider returned an error. The suffix is the provider’s own code, when it sent one: `provider_error:bad_refresh_token` (the user must re-authorize), `provider_error:incorrect_client_credentials` (our configuration, the user can do nothing). `details.provider_error_description` carries the provider’s sentence.\n- `identity_already_linked` (409): That external identity is already linked to another user.\n- `identity_link_denied` (409): That external identity cannot be linked to this user.\n- `identity_conflict` (409): The user already has a linked identity for this connection.\n- `identity_orphaned` (400): The identity pointed at a user that no longer exists; it was removed. Sign in again.\n- `no_provider_token` (400): The identity holds no provider access token.\n- `no_refresh_token` (400): The identity holds no provider refresh token, so it cannot be refreshed.\n- `action_unavailable` (401): The Action that paused this login is disabled or belongs elsewhere.\n- `login_flow_misconfigured` (500): The login flow of this account cannot run. `message` carries the node error.\n- `mfa_required` (403): The login needs a second factor that this flow cannot collect, or one is still pending on the session.\n- `step_up_required` (403): Confirm an existing factor before changing your factors.\n- `interaction_required` (403): An Action asked for a redirect on a non-interactive flow.\n- `passkey_login_disabled` (400): Sign in with a passkey is not enabled for this client.\n- `mfa_pending` (401): A second-factor challenge is pending; answer it before continuing.\n- `mfa_invalid_code` (401): The authenticator code did not verify.\n- `mfa_invalid_recovery_code` (401): The recovery code did not verify.\n- `too_many_attempts` (429): Too many wrong codes. Wait a few minutes and try again.\n- `too_many_login_attempts` (429): Too many failed sign-in attempts for this email or username from this network. Wait a few minutes and try again.\n- `totp_not_allowed` (401): This account does not accept authenticator apps.\n- `no_usable_factor` (400): The user has no confirmed second factor to challenge.\n- `factor_not_found` (400): No factor with that id belongs to this user.\n- `factor_already_confirmed` (400): The factor was already confirmed.\n- `invalid_factor` (400): The factor cannot be verified (no secret material).\n- `session_missing` (401): The session that started this login no longer exists.\n- `passkey_verification_failed` (400): The WebAuthn response could not be verified.\n- `no_passkey_enrolled` (400): The user has no passkey to sign in with.\n- `malformed_credential` (400): The WebAuthn credential is malformed.\n- `unknown_passkey` (401): The passkey is not enrolled for this user.\n- `invalid_passkey` (401): The passkey assertion did not verify.\n- `invalid_invite_url` (400): An invite's `accept_url` or `redirect_uri` is not an http(s) URL at an origin of this tenant's client callbacks or `callback_hostnames`, or it carries a fragment.\n- `invite_email_mismatch` (403): The invite is for another email address than the accepting user's. `details.invited_email` shows it masked.\n- `invite_email_unverified` (403): The accepting user's email matches the invite but is not verified yet.\n- `invite_not_found` (404): No invite with that id in this account.\n- `invite_used` (400): The invite was already accepted.\n- `already_member` (400): The user is already a member of the team.\n- `not_a_member` (404): The user is not a member of the team.\n- `team_id_unavailable` (409): The team id cannot be used in this tenant. Pick another id or let the API generate one.\n- `use_team_member_route` (400): This generic route cannot create memberships. Use `POST /team/{team_id}/member` for team members or `POST /role/{role_id}/users` for role grants.\n- `role_not_found` (404): No role with that id in this account.\n- `invalid_role` (400): The role belongs to another account.\n- `flow_not_found` (400): The login flow does not exist in this account.\n- `revision_not_found` (404): The revision is not in the flow history.\n- `invalid_webhook_event` (400): An event is not in the webhook event catalog. `message` and `details.valid_events` list the valid ones.\n- `invalid_webhook_url` (400): The webhook URL must be an absolute `https` URL.\n- `not_a_webhook` (400): The operation only applies to `webhook` subscriptions.\n- `delivery_not_found` (404): No webhook delivery with that id for this subscription.\n- `delivery_in_progress` (409): The delivery is being attempted right now; retry the redeliver in a minute.",
7522
+ "description": "Machine-readable error code. One HTTP status per code.\n\n- `bad_request` (400): The request is malformed. `message` says what is wrong.\n- `validation_error` (400): The body, query or path failed schema validation. `details.issues` lists each failing field.\n- `unauthorized` (401): The request carries no valid credentials.\n- `payment_required` (402): The feature is not included in the current plan.\n- `forbidden` (403): The credentials are valid but do not allow this operation.\n- `not_found` (404): The resource does not exist in this account.\n- `method_not_allowed` (405): The HTTP method is not supported on this path.\n- `conflict` (409): The request conflicts with the current state of the resource.\n- `payload_too_large` (413): The request body exceeds the size limit.\n- `unsupported_media_type` (415): The `Content-Type` is not accepted by this endpoint.\n- `unprocessable_entity` (422): The request is well-formed but cannot be processed.\n- `too_many_requests` (429): Rate limit exceeded. Honour the `Retry-After` header.\n- `internal_error` (500): Unexpected server error. Retry later; the request id is logged.\n- `already_exists` (400): A resource with the same unique field already exists (for a user, usually `email`). `details.fields` names the field.\n- `invalid_id` (400): The id in the path is not a valid id for this resource.\n- `account_not_found` (404): No Auth Account matches the request (domain, header or token).\n- `invalid_query` (400): The `?query=` FaableQL expression could not be parsed.\n- `search_not_supported` (400): This resource does not support `?search=`.\n- `invalid_expand` (400): An `?expand=` path is not allowed on this resource.\n- `access_denied` (401): The caller may not access this row (ownership or machine-to-machine restriction).\n- `insufficient_scope` (403): The token lacks a scope this operation requires. `message` names it.\n- `team_required` (400): An Auth Account must belong to a project (team).\n- `account_limit_reached` (409): The project already has the maximum number of Auth Accounts.\n- `invalid_project_id` (400): The project id is not of the form `project_<hex>` or `team_<hex>`.\n- `account_transfer_refused` (409): The Auth Account cannot be moved to that project. `details.blockers` lists why.\n- `email_sender_domain_not_allowed` (400): The sender address is not in a domain this platform signs email for (AUTH_EMAIL_SENDER_DOMAINS).\n- `plan_required` (402): The setting requires a higher plan. `message` says which.\n- `invalid_canonical_host` (400): `canonical_host` must be this account's own platform host or one of its verified custom domains.\n- `canonical_host_breaks_passkeys` (400): `canonical_host` is outside the account's current WebAuthn RP ID — every passkey already enrolled would stop working. Set `webauthn_rp_id` in the same request to a suffix that covers both.\n- `not_logged_in` (401): There is no signed-in session for this request.\n- `session_already_revoked` (409): The session was already revoked.\n- `invalid_token` (401): The bearer token is missing, malformed, expired or has no subject.\n- `not_owner` (403): The caller may only perform this operation on their own user.\n- `user_suspended` (403): The user is suspended and cannot sign in or be modified.\n- `invalid_credentials` (400): The email/username or password is incorrect.\n- `login_denied` (401): A post-login Action denied the sign-in. `message` carries the reason it gave. On token grants it is a 403 with `error: invalid_grant`.\n- `signup_denied` (403): A pre-signup Action or an active block denied the sign-up. `message` carries the reason.\n- `client_credentials_denied` (401): An Action denied the client_credentials grant. `message` carries the reason.\n- `m2m_quota_exceeded` (402): The project used the machine-to-machine tokens its plan includes this month. Free is capped; Hobby and Pro are billed per token instead.\n- `signup_disabled` (403): Self-service sign-up is disabled on this connection.\n- `email_taken` (409): Another user in this account already uses that email.\n- `username_taken` (409): Another user of this database connection already uses that username.\n- `invalid_username` (400): The username is empty, or contains an `@` or whitespace. `message` says which.\n- `invalid_email` (400): The email address is not valid.\n- `invalid_name` (400): The name contains a link. `message` says which field.\n- `same_email` (400): The new email is the same as the current one.\n- `user_has_no_email` (400): The operation needs an email but the user has none.\n- `password_too_weak` (400): The password does not meet the connection policy. `message` lists each unmet rule.\n- `invalid_password_hash` (400): The imported password hash cannot be read, or its cost is above what a login can afford. `message` names the field.\n- `weak_password_hash` (400): The imported password hash uses a fast digest (MD5, SHA-1, SHA-2) or a cost below the minimum. `message` says which.\n- `invalid_code` (400): The verification code is wrong, expired or already used.\n- `invalid_phone` (400): The phone number is not E.164 and could not be resolved with the account default country. Include the country code.\n- `phone_changed` (400): The phone on the user changed after the code was sent. Start again.\n- `phone_already_verified` (409): The user already has a verified phone; the number cannot be swapped from the screen.\n- `sms_unavailable` (409): This account cannot send SMS right now. The suffix says why: `sms_unavailable:plan`, `:quota`, `:provider`.\n- `sms_failed` (409): The SMS provider rejected the message.\n- `invalid_state` (400): The `state` is missing, expired, or does not describe a resumable step.\n- `state_mismatch` (401): The `state` belongs to another account, session, client or ceremony.\n- `invalid_ticket` (400): The ticket does not exist or is not the kind this endpoint accepts.\n- `ticket_used` (400): The ticket was already consumed.\n- `ticket_expired` (400): The ticket is past its expiry.\n- `ticket_not_found` (404): No ticket with that id belongs to this user.\n- `credential_not_found` (404): The user has no password credential on this connection.\n- `invalid_link` (400): The magic link is malformed.\n- `expired_link` (400): The magic link token was not found or has expired.\n- `invalid_otp` (401): The one-time password is wrong or expired.\n- `invalid_client` (400): The `client_id` in the request does not name a client of this account.\n- `client_not_found` (404): No client with that `client_id`.\n- `client_mismatch` (401): The client belongs to a different account.\n- `invalid_client_metadata` (400): Dynamic client registration rejected a field (RFC 7591). `message` names it.\n- `invalid_connection` (400): The connection does not exist, is disabled, or is not of the type this flow needs.\n- `no_database_connection` (400): The tenant has no database connection, so there is nowhere to store a password. Create one and retry.\n- `connection_required` (400): No connection was given and the client has no `default_connection`.\n- `connection_misconfigured` (400): The connection is missing settings needed to talk to its provider.\n- `passwordless_unavailable` (400): No passwordless connection is configured or enabled for this client.\n- `ambiguous_connection` (400): Several connections match; pass `connection_id`.\n- `invalid_redirect_uri` (400): The redirect URI is not registered for the client.\n- `origin_not_allowed` (403): The request `Origin` is not in the client's Allowed Web Origins.\n- `audience_not_found` (403): The `audience` does not name an API registered in this account.\n- `system_resource` (403): The resource is managed by Faable and cannot be modified or deleted.\n- `invalid_request` (400): A required OAuth parameter is missing or two of them are incompatible. `message` says which.\n- `invalid_device_code` (400): The device or user code is invalid or expired.\n- `provider_error` (400): The upstream identity provider returned an error. The suffix is the provider’s own code, when it sent one: `provider_error:bad_refresh_token` (the user must re-authorize), `provider_error:incorrect_client_credentials` (our configuration, the user can do nothing). `details.provider_error_description` carries the provider’s sentence.\n- `identity_already_linked` (409): That external identity is already linked to another user.\n- `identity_link_denied` (409): That external identity cannot be linked to this user.\n- `identity_conflict` (409): The user already has a linked identity for this connection.\n- `identity_orphaned` (400): The identity pointed at a user that no longer exists; it was removed. Sign in again.\n- `no_provider_token` (400): The identity holds no provider access token.\n- `no_refresh_token` (400): The identity holds no provider refresh token, so it cannot be refreshed.\n- `action_unavailable` (401): The Action that paused this login is disabled or belongs elsewhere.\n- `login_flow_misconfigured` (500): The login flow of this account cannot run. `message` carries the node error.\n- `mfa_required` (403): The login needs a second factor that this flow cannot collect, or one is still pending on the session.\n- `step_up_required` (403): Confirm an existing factor before changing your factors.\n- `interaction_required` (403): An Action asked for a redirect on a non-interactive flow.\n- `passkey_login_disabled` (400): Sign in with a passkey is not enabled for this client.\n- `mfa_pending` (401): A second-factor challenge is pending; answer it before continuing.\n- `mfa_invalid_code` (401): The authenticator code did not verify.\n- `mfa_invalid_recovery_code` (401): The recovery code did not verify.\n- `too_many_attempts` (429): Too many wrong codes. Wait a few minutes and try again.\n- `too_many_login_attempts` (429): Too many failed sign-in attempts for this email or username from this network. Wait a few minutes and try again.\n- `totp_not_allowed` (401): This account does not accept authenticator apps.\n- `no_usable_factor` (400): The user has no confirmed second factor to challenge.\n- `factor_not_found` (400): No factor with that id belongs to this user.\n- `factor_already_confirmed` (400): The factor was already confirmed.\n- `invalid_factor` (400): The factor cannot be verified (no secret material).\n- `session_missing` (401): The session that started this login no longer exists.\n- `passkey_verification_failed` (400): The WebAuthn response could not be verified.\n- `no_passkey_enrolled` (400): The user has no passkey to sign in with.\n- `malformed_credential` (400): The WebAuthn credential is malformed.\n- `unknown_passkey` (401): The passkey is not enrolled for this user.\n- `invalid_passkey` (401): The passkey assertion did not verify.\n- `invalid_invite_url` (400): An invite's `accept_url` or `redirect_uri` is not an http(s) URL at an origin of this tenant's client callbacks or `callback_hostnames`, or it carries a fragment.\n- `invite_email_mismatch` (403): The invite is for another email address than the accepting user's. `details.invited_email` shows it masked.\n- `invite_email_unverified` (403): The accepting user's email matches the invite but is not verified yet.\n- `invite_not_found` (404): No invite with that id in this account.\n- `invite_used` (400): The invite was already accepted.\n- `already_member` (400): The user is already a member of the team.\n- `not_a_member` (404): The user is not a member of the team.\n- `team_id_unavailable` (409): The team id cannot be used in this tenant. Pick another id or let the API generate one.\n- `use_team_member_route` (400): This generic route cannot create memberships. Use `POST /team/{team_id}/member` for team members or `POST /role/{role_id}/users` for role grants.\n- `role_not_found` (404): No role with that id in this account.\n- `invalid_role` (400): The role belongs to another account.\n- `flow_not_found` (400): The login flow does not exist in this account.\n- `revision_not_found` (404): The revision is not in the flow history.\n- `invalid_webhook_event` (400): An event is not in the webhook event catalog. `message` and `details.valid_events` list the valid ones.\n- `invalid_webhook_url` (400): The webhook URL must be an absolute `https` URL.\n- `not_a_webhook` (400): The operation only applies to `webhook` subscriptions.\n- `delivery_not_found` (404): No webhook delivery with that id for this subscription.\n- `delivery_in_progress` (409): The delivery is being attempted right now; retry the redeliver in a minute.",
7523
7523
  "enum": [
7524
7524
  "bad_request",
7525
7525
  "validation_error",
@@ -7562,6 +7562,8 @@
7562
7562
  "m2m_quota_exceeded",
7563
7563
  "signup_disabled",
7564
7564
  "email_taken",
7565
+ "username_taken",
7566
+ "invalid_username",
7565
7567
  "invalid_email",
7566
7568
  "invalid_name",
7567
7569
  "same_email",
@@ -36278,6 +36280,10 @@
36278
36280
  "example": [
36279
36281
  "role_6555fd293acc2f0fac0e3452"
36280
36282
  ]
36283
+ },
36284
+ "actor_user_id": {
36285
+ "type": "string",
36286
+ "description": "The person making the change, when your backend calls on their behalf with a machine token: it is who the tenant's log names. Must be a user of this tenant."
36281
36287
  }
36282
36288
  },
36283
36289
  "additionalProperties": false,
@@ -36559,6 +36565,15 @@
36559
36565
  ],
36560
36566
  "description": "Removes the User's membership of the given Team (the User itself is not deleted). Emits `team.member.removed` and leaves an entry in the tenant's log.",
36561
36567
  "parameters": [
36568
+ {
36569
+ "schema": {
36570
+ "type": "string"
36571
+ },
36572
+ "in": "query",
36573
+ "name": "actor_user_id",
36574
+ "required": false,
36575
+ "description": "The person removing (or leaving), when your backend calls on their behalf with a machine token: it is who the tenant's log names. Must be a user of this tenant."
36576
+ },
36562
36577
  {
36563
36578
  "schema": {
36564
36579
  "type": "string"
@@ -37766,7 +37781,7 @@
37766
37781
  "tags": [
37767
37782
  "team"
37768
37783
  ],
37769
- "description": "Accepts the invite whose secret is `token` on behalf of `user_id`, an existing user of this tenant. The user's email must be verified and equal to the invited one (`invite_email_mismatch` otherwise, with the invited address masked in `details`). Never creates a user. Use it from the page you gave as the invite's `accept_url`.",
37784
+ "description": "Accepts the invite — by the `token` of its link, or by `invite_id` — on behalf of `user_id`, an existing user of this tenant. The user's email must be verified and equal to the invited one (`invite_email_mismatch` otherwise, with the invited address masked in `details`). Never creates a user. Use `token` from the page you gave as the invite's `accept_url`, and `invite_id` from a pending-invitation notice in your app.",
37770
37785
  "requestBody": {
37771
37786
  "required": true,
37772
37787
  "content": {
@@ -37774,14 +37789,18 @@
37774
37789
  "schema": {
37775
37790
  "type": "object",
37776
37791
  "required": [
37777
- "token",
37778
37792
  "user_id"
37779
37793
  ],
37780
37794
  "properties": {
37781
37795
  "token": {
37782
37796
  "type": "string",
37783
37797
  "minLength": 1,
37784
- "description": "The invite secret, as it arrived in the fragment of the `accept_url` link."
37798
+ "description": "The invite secret, as it arrived in the fragment of the `accept_url` link. Give this or `invite_id`."
37799
+ },
37800
+ "invite_id": {
37801
+ "type": "string",
37802
+ "minLength": 1,
37803
+ "description": "The invite id, for accepting from your app without the link (a \"pending invitation\" notice; see `GET /user/{user_id}/team-invites`). Give this or `token`."
37785
37804
  },
37786
37805
  "user_id": {
37787
37806
  "type": "string",
@@ -38008,6 +38027,516 @@
38008
38027
  }
38009
38028
  }
38010
38029
  },
38030
+ "/user/{user_id}/team-invites": {
38031
+ "get": {
38032
+ "operationId": "team/listInvitesForUser",
38033
+ "summary": "List a user's pending team invites",
38034
+ "tags": [
38035
+ "team"
38036
+ ],
38037
+ "description": "Pending (not accepted, revoked, declined or expired) invites to any team of this tenant addressed to the user's email. Only when that email is verified; otherwise `email_verified: false` and an empty list.",
38038
+ "parameters": [
38039
+ {
38040
+ "schema": {
38041
+ "type": "string"
38042
+ },
38043
+ "in": "path",
38044
+ "name": "user_id",
38045
+ "required": true
38046
+ }
38047
+ ],
38048
+ "security": [
38049
+ {
38050
+ "bearerAuth": []
38051
+ }
38052
+ ],
38053
+ "responses": {
38054
+ "200": {
38055
+ "description": "Default Response",
38056
+ "content": {
38057
+ "application/json": {
38058
+ "schema": {
38059
+ "type": "object",
38060
+ "required": [
38061
+ "email_verified",
38062
+ "data"
38063
+ ],
38064
+ "properties": {
38065
+ "email_verified": {
38066
+ "type": "boolean",
38067
+ "description": "False when the user's email is not verified: nothing is listed then, since the address could be anybody's."
38068
+ },
38069
+ "data": {
38070
+ "type": "array",
38071
+ "items": {
38072
+ "type": "object",
38073
+ "required": [
38074
+ "id",
38075
+ "email",
38076
+ "team",
38077
+ "roles",
38078
+ "mode",
38079
+ "expires_at",
38080
+ "account",
38081
+ "createdAt"
38082
+ ],
38083
+ "properties": {
38084
+ "id": {
38085
+ "type": "string",
38086
+ "description": "TeamInvite ID"
38087
+ },
38088
+ "email": {
38089
+ "type": "string",
38090
+ "description": "Email address that was invited"
38091
+ },
38092
+ "team": {
38093
+ "type": "string",
38094
+ "description": "Id of the team the invitee will be added to upon acceptance."
38095
+ },
38096
+ "inviter": {
38097
+ "type": "string",
38098
+ "description": "Id of the user that created the invitation, if known."
38099
+ },
38100
+ "roles": {
38101
+ "type": "array",
38102
+ "items": {
38103
+ "type": "string"
38104
+ },
38105
+ "description": "Role ids that will be applied to the new TeamMember on acceptance."
38106
+ },
38107
+ "mode": {
38108
+ "anyOf": [
38109
+ {
38110
+ "type": "string",
38111
+ "enum": [
38112
+ "auto"
38113
+ ]
38114
+ },
38115
+ {
38116
+ "type": "string",
38117
+ "enum": [
38118
+ "invite"
38119
+ ]
38120
+ }
38121
+ ],
38122
+ "description": "`auto` adds the user directly if they already exist in the tenant and only falls back to a ticketed invite when the email is unknown. `invite` always issues a ticket + email regardless of whether the user exists."
38123
+ },
38124
+ "redirect_uri": {
38125
+ "type": "string",
38126
+ "description": "URI to redirect the invitee to after a successful accept."
38127
+ },
38128
+ "expires_at": {
38129
+ "type": "string",
38130
+ "description": "ISO 8601 timestamp at which the invite stops being valid."
38131
+ },
38132
+ "consume_date": {
38133
+ "type": "string",
38134
+ "description": "ISO 8601 timestamp at which the invite was accepted. Absent for pending invites."
38135
+ },
38136
+ "account": {
38137
+ "type": "string",
38138
+ "description": "Object is related with this account"
38139
+ },
38140
+ "metadata": {
38141
+ "type": "object",
38142
+ "properties": {},
38143
+ "additionalProperties": true,
38144
+ "description": "TeamInviteMetadata",
38145
+ "default": {}
38146
+ },
38147
+ "createdAt": {
38148
+ "type": "string",
38149
+ "description": "TeamInvite creation date"
38150
+ },
38151
+ "updatedAt": {
38152
+ "type": "string",
38153
+ "description": "TeamInvite updated date"
38154
+ }
38155
+ },
38156
+ "description": "TeamInvite"
38157
+ }
38158
+ }
38159
+ }
38160
+ }
38161
+ }
38162
+ }
38163
+ },
38164
+ "400": {
38165
+ "description": "`validation_error` — The body, query or path failed schema validation. `details.issues` lists each failing field.",
38166
+ "content": {
38167
+ "application/json": {
38168
+ "schema": {
38169
+ "allOf": [
38170
+ {
38171
+ "$ref": "#/components/schemas/ErrorResponse"
38172
+ },
38173
+ {
38174
+ "type": "object",
38175
+ "properties": {
38176
+ "error_code": {
38177
+ "type": "string",
38178
+ "enum": [
38179
+ "validation_error"
38180
+ ]
38181
+ }
38182
+ }
38183
+ }
38184
+ ]
38185
+ }
38186
+ }
38187
+ }
38188
+ },
38189
+ "401": {
38190
+ "description": "`unauthorized` — The request carries no valid credentials.",
38191
+ "content": {
38192
+ "application/json": {
38193
+ "schema": {
38194
+ "allOf": [
38195
+ {
38196
+ "$ref": "#/components/schemas/ErrorResponse"
38197
+ },
38198
+ {
38199
+ "type": "object",
38200
+ "properties": {
38201
+ "error_code": {
38202
+ "type": "string",
38203
+ "enum": [
38204
+ "unauthorized"
38205
+ ]
38206
+ }
38207
+ }
38208
+ }
38209
+ ]
38210
+ }
38211
+ }
38212
+ }
38213
+ },
38214
+ "403": {
38215
+ "description": "`forbidden` — The credentials are valid but do not allow this operation.\n\n`insufficient_scope` — The token lacks a scope this operation requires. `message` names it.\n\n`user_suspended` — The user is suspended and cannot sign in or be modified.",
38216
+ "content": {
38217
+ "application/json": {
38218
+ "schema": {
38219
+ "allOf": [
38220
+ {
38221
+ "$ref": "#/components/schemas/ErrorResponse"
38222
+ },
38223
+ {
38224
+ "type": "object",
38225
+ "properties": {
38226
+ "error_code": {
38227
+ "type": "string",
38228
+ "enum": [
38229
+ "forbidden",
38230
+ "insufficient_scope",
38231
+ "user_suspended"
38232
+ ]
38233
+ }
38234
+ }
38235
+ }
38236
+ ]
38237
+ }
38238
+ }
38239
+ }
38240
+ },
38241
+ "404": {
38242
+ "description": "`account_not_found` — No Auth Account matches the request (domain, header or token).",
38243
+ "content": {
38244
+ "application/json": {
38245
+ "schema": {
38246
+ "allOf": [
38247
+ {
38248
+ "$ref": "#/components/schemas/ErrorResponse"
38249
+ },
38250
+ {
38251
+ "type": "object",
38252
+ "properties": {
38253
+ "error_code": {
38254
+ "type": "string",
38255
+ "enum": [
38256
+ "account_not_found"
38257
+ ]
38258
+ }
38259
+ }
38260
+ }
38261
+ ]
38262
+ }
38263
+ }
38264
+ }
38265
+ },
38266
+ "429": {
38267
+ "description": "`too_many_requests` — Rate limit exceeded. Honour the `Retry-After` header.",
38268
+ "content": {
38269
+ "application/json": {
38270
+ "schema": {
38271
+ "allOf": [
38272
+ {
38273
+ "$ref": "#/components/schemas/ErrorResponse"
38274
+ },
38275
+ {
38276
+ "type": "object",
38277
+ "properties": {
38278
+ "error_code": {
38279
+ "type": "string",
38280
+ "enum": [
38281
+ "too_many_requests"
38282
+ ]
38283
+ }
38284
+ }
38285
+ }
38286
+ ]
38287
+ }
38288
+ }
38289
+ }
38290
+ },
38291
+ "500": {
38292
+ "description": "`internal_error` — Unexpected server error. Retry later; the request id is logged.",
38293
+ "content": {
38294
+ "application/json": {
38295
+ "schema": {
38296
+ "allOf": [
38297
+ {
38298
+ "$ref": "#/components/schemas/ErrorResponse"
38299
+ },
38300
+ {
38301
+ "type": "object",
38302
+ "properties": {
38303
+ "error_code": {
38304
+ "type": "string",
38305
+ "enum": [
38306
+ "internal_error"
38307
+ ]
38308
+ }
38309
+ }
38310
+ }
38311
+ ]
38312
+ }
38313
+ }
38314
+ }
38315
+ }
38316
+ }
38317
+ }
38318
+ },
38319
+ "/team/invite/decline": {
38320
+ "post": {
38321
+ "operationId": "team/declineInvite",
38322
+ "summary": "Decline a team invite for a signed-in user",
38323
+ "tags": [
38324
+ "team"
38325
+ ],
38326
+ "description": "The invited user says no: the invite is spent (its link stops working) and `team.invite.revoked` is emitted with reason `declined`. Same checks as accepting.",
38327
+ "requestBody": {
38328
+ "required": true,
38329
+ "content": {
38330
+ "application/json": {
38331
+ "schema": {
38332
+ "type": "object",
38333
+ "required": [
38334
+ "invite_id",
38335
+ "user_id"
38336
+ ],
38337
+ "properties": {
38338
+ "invite_id": {
38339
+ "type": "string",
38340
+ "minLength": 1
38341
+ },
38342
+ "user_id": {
38343
+ "type": "string",
38344
+ "description": "The user declining — must have the invited email, verified."
38345
+ }
38346
+ },
38347
+ "additionalProperties": false
38348
+ }
38349
+ }
38350
+ }
38351
+ },
38352
+ "security": [
38353
+ {
38354
+ "bearerAuth": []
38355
+ }
38356
+ ],
38357
+ "responses": {
38358
+ "200": {
38359
+ "description": "Default Response",
38360
+ "content": {
38361
+ "application/json": {
38362
+ "schema": {
38363
+ "type": "object",
38364
+ "required": [
38365
+ "status"
38366
+ ],
38367
+ "properties": {
38368
+ "status": {
38369
+ "type": "string",
38370
+ "enum": [
38371
+ "declined"
38372
+ ]
38373
+ }
38374
+ }
38375
+ }
38376
+ }
38377
+ }
38378
+ },
38379
+ "400": {
38380
+ "description": "`invalid_ticket` — The ticket does not exist or is not the kind this endpoint accepts.\n\n`ticket_used` — The ticket was already consumed.\n\n`ticket_expired` — The ticket is past its expiry.\n\n`validation_error` — The body, query or path failed schema validation. `details.issues` lists each failing field.",
38381
+ "content": {
38382
+ "application/json": {
38383
+ "schema": {
38384
+ "allOf": [
38385
+ {
38386
+ "$ref": "#/components/schemas/ErrorResponse"
38387
+ },
38388
+ {
38389
+ "type": "object",
38390
+ "properties": {
38391
+ "error_code": {
38392
+ "type": "string",
38393
+ "enum": [
38394
+ "invalid_ticket",
38395
+ "ticket_used",
38396
+ "ticket_expired",
38397
+ "validation_error"
38398
+ ]
38399
+ }
38400
+ }
38401
+ }
38402
+ ]
38403
+ }
38404
+ }
38405
+ }
38406
+ },
38407
+ "401": {
38408
+ "description": "`unauthorized` — The request carries no valid credentials.",
38409
+ "content": {
38410
+ "application/json": {
38411
+ "schema": {
38412
+ "allOf": [
38413
+ {
38414
+ "$ref": "#/components/schemas/ErrorResponse"
38415
+ },
38416
+ {
38417
+ "type": "object",
38418
+ "properties": {
38419
+ "error_code": {
38420
+ "type": "string",
38421
+ "enum": [
38422
+ "unauthorized"
38423
+ ]
38424
+ }
38425
+ }
38426
+ }
38427
+ ]
38428
+ }
38429
+ }
38430
+ }
38431
+ },
38432
+ "403": {
38433
+ "description": "`invite_email_mismatch` — The invite is for another email address than the accepting user's. `details.invited_email` shows it masked.\n\n`invite_email_unverified` — The accepting user's email matches the invite but is not verified yet.\n\n`forbidden` — The credentials are valid but do not allow this operation.\n\n`insufficient_scope` — The token lacks a scope this operation requires. `message` names it.\n\n`user_suspended` — The user is suspended and cannot sign in or be modified.",
38434
+ "content": {
38435
+ "application/json": {
38436
+ "schema": {
38437
+ "allOf": [
38438
+ {
38439
+ "$ref": "#/components/schemas/ErrorResponse"
38440
+ },
38441
+ {
38442
+ "type": "object",
38443
+ "properties": {
38444
+ "error_code": {
38445
+ "type": "string",
38446
+ "enum": [
38447
+ "invite_email_mismatch",
38448
+ "invite_email_unverified",
38449
+ "forbidden",
38450
+ "insufficient_scope",
38451
+ "user_suspended"
38452
+ ]
38453
+ }
38454
+ }
38455
+ }
38456
+ ]
38457
+ }
38458
+ }
38459
+ }
38460
+ },
38461
+ "404": {
38462
+ "description": "`not_found` — The resource does not exist in this account.\n\n`account_not_found` — No Auth Account matches the request (domain, header or token).",
38463
+ "content": {
38464
+ "application/json": {
38465
+ "schema": {
38466
+ "allOf": [
38467
+ {
38468
+ "$ref": "#/components/schemas/ErrorResponse"
38469
+ },
38470
+ {
38471
+ "type": "object",
38472
+ "properties": {
38473
+ "error_code": {
38474
+ "type": "string",
38475
+ "enum": [
38476
+ "not_found",
38477
+ "account_not_found"
38478
+ ]
38479
+ }
38480
+ }
38481
+ }
38482
+ ]
38483
+ }
38484
+ }
38485
+ }
38486
+ },
38487
+ "429": {
38488
+ "description": "`too_many_requests` — Rate limit exceeded. Honour the `Retry-After` header.",
38489
+ "content": {
38490
+ "application/json": {
38491
+ "schema": {
38492
+ "allOf": [
38493
+ {
38494
+ "$ref": "#/components/schemas/ErrorResponse"
38495
+ },
38496
+ {
38497
+ "type": "object",
38498
+ "properties": {
38499
+ "error_code": {
38500
+ "type": "string",
38501
+ "enum": [
38502
+ "too_many_requests"
38503
+ ]
38504
+ }
38505
+ }
38506
+ }
38507
+ ]
38508
+ }
38509
+ }
38510
+ }
38511
+ },
38512
+ "500": {
38513
+ "description": "`internal_error` — Unexpected server error. Retry later; the request id is logged.",
38514
+ "content": {
38515
+ "application/json": {
38516
+ "schema": {
38517
+ "allOf": [
38518
+ {
38519
+ "$ref": "#/components/schemas/ErrorResponse"
38520
+ },
38521
+ {
38522
+ "type": "object",
38523
+ "properties": {
38524
+ "error_code": {
38525
+ "type": "string",
38526
+ "enum": [
38527
+ "internal_error"
38528
+ ]
38529
+ }
38530
+ }
38531
+ }
38532
+ ]
38533
+ }
38534
+ }
38535
+ }
38536
+ }
38537
+ }
38538
+ }
38539
+ },
38011
38540
  "/api": {
38012
38541
  "get": {
38013
38542
  "operationId": "api/list",
@@ -65298,25 +65827,25 @@
65298
65827
  "tags": [
65299
65828
  "dbconnection"
65300
65829
  ],
65301
- "description": "Creates a new user and database credential (email + password) in a single call against the tenant database connection. Public and account-scoped (no management token). Gated per-connection by `disable_signup`. The user is created with `email_verified: false`; the account notification settings (`verify_email_auto_send`, `welcome_email_enabled`) drive any follow-up emails. Does not establish a session — the client logs in afterwards.",
65830
+ "description": "Creates a new user and database credential in a single call against the tenant database connection. The identifier follows the connection `login_identifier` (email, username, or either); the password is optional, and a user created without one sets it through the password reset email. Public and account-scoped (no management token). Gated per-connection by `disable_signup`. The user is created with `email_verified: false`; the account notification settings (`verify_email_auto_send`, `welcome_email_enabled`) drive any follow-up emails. Does not establish a session — the client logs in afterwards.",
65302
65831
  "requestBody": {
65303
65832
  "required": true,
65304
65833
  "content": {
65305
65834
  "application/json": {
65306
65835
  "schema": {
65307
65836
  "type": "object",
65308
- "required": [
65309
- "email",
65310
- "password"
65311
- ],
65312
65837
  "properties": {
65313
65838
  "email": {
65314
65839
  "type": "string",
65315
- "description": "Email login identifier."
65840
+ "description": "Email login identifier. Required unless the connection signs in by username, and whenever `password` is omitted."
65841
+ },
65842
+ "username": {
65843
+ "type": "string",
65844
+ "description": "Username login identifier, stored as typed (case-sensitive). Required on a connection whose `login_identifier` is `username`; rejected on an `email` one. No `@` or whitespace."
65316
65845
  },
65317
65846
  "password": {
65318
65847
  "type": "string",
65319
- "description": "Plaintext password (validated against the connection policy, hashed on write)."
65848
+ "description": "Plaintext password (validated against the connection policy, hashed on write). Omit it to create the user without one: they set it through the password reset email."
65320
65849
  },
65321
65850
  "name": {
65322
65851
  "type": "string"
@@ -65346,7 +65875,7 @@
65346
65875
  "description": "Default Response"
65347
65876
  },
65348
65877
  "400": {
65349
- "description": "`invalid_connection` — The connection does not exist, is disabled, or is not of the type this flow needs.\n\n`password_too_weak` — The password does not meet the connection policy. `message` lists each unmet rule.\n\n`validation_error` — The body, query or path failed schema validation. `details.issues` lists each failing field.",
65878
+ "description": "`bad_request` — The request is malformed. `message` says what is wrong.\n\n`invalid_connection` — The connection does not exist, is disabled, or is not of the type this flow needs.\n\n`invalid_username` — The username is empty, or contains an `@` or whitespace. `message` says which.\n\n`password_too_weak` — The password does not meet the connection policy. `message` lists each unmet rule.\n\n`validation_error` — The body, query or path failed schema validation. `details.issues` lists each failing field.",
65350
65879
  "content": {
65351
65880
  "application/json": {
65352
65881
  "schema": {
@@ -65360,7 +65889,9 @@
65360
65889
  "error_code": {
65361
65890
  "type": "string",
65362
65891
  "enum": [
65892
+ "bad_request",
65363
65893
  "invalid_connection",
65894
+ "invalid_username",
65364
65895
  "password_too_weak",
65365
65896
  "validation_error"
65366
65897
  ]
@@ -65424,7 +65955,7 @@
65424
65955
  }
65425
65956
  },
65426
65957
  "409": {
65427
- "description": "`email_taken` — Another user in this account already uses that email.",
65958
+ "description": "`email_taken` — Another user in this account already uses that email.\n\n`username_taken` — Another user of this database connection already uses that username.",
65428
65959
  "content": {
65429
65960
  "application/json": {
65430
65961
  "schema": {
@@ -65438,7 +65969,8 @@
65438
65969
  "error_code": {
65439
65970
  "type": "string",
65440
65971
  "enum": [
65441
- "email_taken"
65972
+ "email_taken",
65973
+ "username_taken"
65442
65974
  ]
65443
65975
  }
65444
65976
  }