Invitations by e-mail
Last updated: 2026-11-27T14:16:11-03:00 (UTC-3)
With invitation_email, a console invitation can go straight to the invitee over SMTP. The message carries only the single-use invitation link: never an API key, a console token or a password. When console single sign-on is configured, an invitation only pre-provisions the user, who then signs in through SSO; no console token is ever issued.
How to turn it on
Section titled “How to turn it on”features: console_users: true user_invitations: true invitation_email: true # operator control, default false; requires user_invitations and PostgreSQLadmin: invitation_email: host: smtp.example.com port: 587 tls: starttls # starttls (default) | implicit | plaintext username: gateway password_env: GATEWAY_SMTP_PASSWORD from: "m7gtw <gateway@example.com>" console_url: https://gateway.example.com default_expiry_hours: 72 # Boot-only network trust, never editable from the console: allow_plaintext_loopback: false allowed_private_cidrs: [] # e.g. [10.0.0.0/8] for an internal relayThe delivery settings can also be set, replaced and reverted in the console (Console users → Invitation e-mail) or through the API. A console override replaces the whole YAML delivery block; Revert to YAML drops it, together with its stored password.
| Field | Default | Bounds and meaning |
|---|---|---|
host |
— | DNS name or IP address of the SMTP server. It passes the same IP guard as alert webhooks: loopback, link-local and other private addresses are refused unless allowed below. |
port |
— | 1–65535. Usually 587 for STARTTLS and 465 for implicit TLS. |
tls |
starttls |
starttls: the server must offer STARTTLS; if it does not, the send fails with tls_required before any credential or address is sent. implicit: TLS from the first byte. plaintext: accepted only for a loopback host with allow_plaintext_loopback: true (a local relay or a test). Certificates are verified against the system roots, TLS 1.2 or later. |
username |
empty | Up to 256 characters. With a username the gateway authenticates with AUTH PLAIN, always after TLS. |
password_env (YAML) / password (console, API) |
empty | In YAML, the name of the environment variable that holds the password. Set from the console, the password is encrypted with the control-plane provider key (storage.provider_encryption_key_env) and is write-only: the API and the console only say whether one is stored. An empty password on save keeps the stored one, but only while host, port, tls and username stay the same: changing any of them answers 400 password_required until the password is typed again or cleared, so a stored password can never be steered to another server. clear_password removes it. |
from |
— | One address, with an optional display name. |
console_url |
— | Absolute https URL of the console the link opens, without credentials, query or fragment; an optional path prefix is kept. http is accepted only for a loopback host with allow_plaintext_loopback. The gateway never builds the link from the request’s Host header. |
default_expiry_hours |
72 | 1–168. Used when an invitation omits expires_in_hours. |
allow_plaintext_loopback (YAML only) |
false |
Allows tls: plaintext and an http console URL for loopback hosts. |
allowed_private_cidrs (YAML only) |
[] |
Up to 32 private canonical prefixes the SMTP host may resolve to. |
require_verified_email (YAML only) |
true |
An SSO claim needs a verified e-mail from the identity provider (step 3 below); false restores claims by link possession alone when the IdP sends no e-mail. The settings API returns it under trust, and the console shows it. |
Changes apply on every replica at the next send: the settings are read from PostgreSQL each time. A block that only declares the boot trust is valid; the delivery settings can then come from the console alone.
Sending an invitation
Section titled “Sending an invitation”In Console users → Invitations, fill in the e-mail field and press Send invitation. Through the API, add email:
POST /api/v1/admin/invitationsContent-Type: application/jsonX-CSRF-Token: <token>
{"name": "Alice Example", "role": "team_viewer", "team_ids": ["team_platform"], "email": "alice@example.com"}{"invitation": {"id": "inv_…", "name": "Alice Example", "role": "team_viewer", "email": "alice@example.com", "status": "pending", "expires_at": "…"}, "emailed": true}- The answer has no token and no link: an e-mailed invitation reaches only its recipient. Without
email, the answer is unchanged (token andaccept_pathonce). expires_in_hoursis optional whileinvitation_emailis on; it defaults todefault_expiry_hours.- The token is 32 random bytes. Only its SHA-256 is stored; it is single use, expires to the second and can be revoked from the list.
- If the SMTP server refuses or cannot be reached, the answer is
502 invitation_email_failedwith the class (destination_rejected,tls_required,tls_failed,upstream_rejected,upstream_retryable,timeout,network,settings_invalid) and the invitation is revoked in the same step, so no token that never arrived stays usable. Create it again once the cause is fixed. - Bulk import does not send e-mail; it keeps returning links.
The message is plain text: a greeting with the invitee’s name, the role, the link <console_url>/ui/#invite=<token>, the expiry in UTC and a warning not to forward it. The token travels in the URL fragment, which browsers never send to a server.
The mail system sees the link
Section titled “The mail system sees the link”Anyone who can read the message can accept the invitation until it is used or expires: the sending relay, the recipient’s mail provider, a forwarding rule, a mail archive or a security scanner that opens links. Keep the expiry short, revoke an invitation that went to a wrong address, and prefer SSO pre-provisioning (below), where the link alone is not enough to sign in.
Test message
Section titled “Test message”Send test (or POST /api/v1/admin/invitation-email/test with {"to": "ops@example.com"}) sends one fixed message, without any link, with the saved effective settings. The answer is {"delivered": true} or {"delivered": false, "error_class": "…"}. Only a global administrator (users:manage) can read, change or test the settings; operators, viewers and team roles are refused.
With single sign-on: pre-provisioning
Section titled “With single sign-on: pre-provisioning”When console OIDC (oidc_login with admin.oidc) or SAML (saml_login with admin.saml) is configured, every invitation created while invitation_email is on is SSO-only ("sso_only": true, for e-mailed and link invitations alike):
- The invitee opens the link. Accepting it creates no user and no token: the gateway answers
202 {"sso_required": true}and sets a 15-minute claim cookie (HttpOnly,Secure,SameSite=None, sealed with the session key) that binds this browser to the invitation. - The console offers the console OIDC or SAML sign-in. At that sign-in, if the verified identity has no local user yet, the gateway creates the invited user with the invitation’s role and teams (checked again at that moment), links that identity to it and marks the invitation accepted, in one transaction.
- With
require_verified_email(the default), a sign-in without a verified e-mail never claims an invitation. For an e-mailed invitation, when the identity provider sends an e-mail at all (OIDCemail; for SAML the e-mail attribute,emailoradmin.jit.saml_email_attribute), it must be verified (OIDCemail_verified: true; for SAML one value and, if configured,admin.jit.saml_email_verified_attributeset totrue) and equal to the invited address. An unverified, multi-valued or different e-mail refuses the claim and the invitation stays pending. Only withrequire_verified_email: falseand no e-mail sent does possession of the link plus the federated sign-in complete it. - Later sign-ins resolve the user through that link, like a JIT user. Role, teams and deactivation stay with the console.
An identity that already has a user ignores the claim. A refused or expired claim fails the sign-in with the generic federated failure, never falls through to JIT, and the invitation stays pending until it expires or is revoked. Every OIDC and SAML callback clears the claim cookie, whatever its outcome. The claim runs under the same federated MFA fence as a JIT creation.
Links created by an invitation are honored only while invitation_email is on, and links created by JIT only while federated_jit is on: turning one feature on never revives the users the other one’s flag cut off. Named OIDC providers (oidc_providers) keep their explicit subject links and do not claim invitations: they resolve a user only through a subject link an administrator declared and never create a user or a federated link, while a claim creates both. Invite such users directly and declare their subject link.
Every step is in the identity audit trail (and its hash chain): invitation.create, invitation.email_sent, invitation.email_failed (which also revokes), invitation.revoke, invitation.accept (with :oidc or :saml in the actor for an SSO claim), invitation.expire (recorded once by a sweep that runs every minute on each replica, actor system) and invitation_email.update / invitation_email.revert for the settings. Logs record invitation_email_sent, invitation_email_failed with the class, invitation_sso_accepted and invitation_sso_refused, never the token, the address list or the password.
Limits
Section titled “Limits”- One recipient per invitation; no HTML, branding or localization of the message.
- No API mail providers yet, only SMTP.
- Delivery is synchronous (up to 20 seconds) and not retried: a temporary SMTP failure revokes the invitation, which you create again.
- The SSO claim needs the console’s own OIDC or SAML login; named OIDC providers do not claim invitations (see above).
- An organization admin sends invitations for its organization with the same settings.
- Turning
invitation_emailoff stops sign-ins through the links it created, even withfederated_jiton; turning it back on restores them.
Upgrade
Section titled “Upgrade”Migration 172 adds the settings table, the invitation columns email, sso_only, emailed_at and expiry_audited_at, and the origin column of federated identities (existing links are jit). An SSO-only invitation stores a domain-separated digest of its token, so an older binary cannot redeem it for a console token during a rollback; it just reports the link as invalid. Upgrade every replica before turning the flag on, and remove invitation_email and admin.invitation_email from YAML before rolling back.
Admin API routes
Section titled “Admin API routes”Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.
| Route | What it does |
|---|---|
GET /api/v1/admin/invitation-email |
The effective SMTP settings, their source and the YAML base; the password is never returned |
PUT /api/v1/admin/invitation-email |
Replaces the console override of the delivery settings at the current version |
DELETE /api/v1/admin/invitation-email |
Drops the console override and its stored password, so the YAML applies |