Skip to Content

Invite a mailbox user to set their own password.

Nominates an address as this mailbox's recovery address and mails it one code. If the mailbox has NO password credential the code sets the first password and verifies the address in the same act (7 days); if it already has one, the code is an ordinary 24-hour confirmation code that sets nothing and can only be spent from the mailbox's own session. Never re-sent automatically: calling again replaces the outstanding invitation with a fresh code. Callable with an account key or a system key.

openemail.passwords.invite(
  identityId: string,
  body: PasswordsInviteBody,
  options?: CallOptions,
): ApiPromise<RecoveryInvitationSent>

It calls POST /identities/{identityId}/invitation: Invite a mailbox user to set their own password in the API reference.

Example

const recoveryInvitationSent = await openemail.passwords.invite(identityId, { email: 'ada@example.com' })

Arguments

ArgumentTypeDescription
identityIdstringMailbox identity ULID. The path's {identityId}.
bodyPasswordsInviteBodyThe request's body.

Options

It takes no options of its own. Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).

Answer

Awaited, it is the API's JSON, RecoveryInvitationSent. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.

Errors

StatusWhat it means
400validation_failed; or recovery_address_self, meaning the address reaches the mailbox it would recover, which is a closed loop
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
403recovery_disabled: the account's policy is admin_only AND the mailbox already has a password, so there is nothing an invitation could do that the policy permits
404Mailbox not found or not accessible to this principal
409recovery_address_verified: this mailbox already has a VERIFIED recovery address. Re-pointing one is PUT /recovery, which re-proves the mailbox's password; an invitation may only nominate where there is nothing to displace
413too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing
429rate_limited: too many invitations for this mailbox, or too much mail to that destination
503recovery_mail_unavailable: the code could not be sent for a reason on the platform's side (the mail binding is unconfigured, the sending service refused the message, or the directory of the mailbox's own account could not answer whether the address routes back to the mailbox), so nothing was stored and the call may be retried. A refusal that concerns the recipient's own address is deliberately indistinguishable from a sent code. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.

Types

PasswordsInviteBody

/** The body of `passwords.invite`. */
type PasswordsInviteBody = {
  /** The address to nominate as this mailbox's recovery address, and to mail the code to */
  email: string
  /** The hostname to tell the recipient to sign in at, e.g. webmail.open.email. Printed as a bare hostname and never as a link (§XVII.7): a user being invited has never been here, and a code with no destination is a dead end */
  surface?: string
}

It names these types of the API, each on a page of its own: RecoveryInvitationSent.