# Invite a person to the organization

> POST /v1/invitations. The person joins the organization by accepting the invitation (acceptInvitation, or the onboarding Invitations step) after signing in with a verified…

Source: https://legion.ambient.xyz/docs/api/identity/create-invitation

`POST https://api.legion.ambient.xyz/v1/invitations`

Authenticate with an API key: `Authorization: Bearer $LEGION_API_KEY`.

The person joins the organization by accepting the invitation
(`acceptInvitation`, or the onboarding Invitations step) after signing
in with a verified email address matching `email`; signing in alone
does not add them. Invitations expire after 7 days. A person can belong to several organizations; inviting someone who already belongs to this one returns 409 `already_member`. An email with a
pending invitation returns 409 `invitation_exists`; an expired one is
replaced.

Legion emails the person the organization, role, inviter and
expiry, and a link to the web app's sign-in page (`invite_url`),
where they sign in using `email`. A failure to send the
email never fails this request: the invitation is created and
`delivery.status` says what happened (see `InvitationDelivery`). Use
`resendInvitation` to try again.

At most 5 invitation emails go to one address in any hour, across
invitations and organizations; beyond that the invitation is not
created and the response is 429 `rate_limited` with `Retry-After`.

Inviting an **owner** needs a signed-in session in the web app:
with an API key, `role: owner` is refused with 403 `session_required`
and nothing is created or sent. An owner can open the payout dashboard,
which an API key may not, so a key must not make a new owner
either. Member invitations work with an API key.

## Request body

- `email`, string (email), required
- `role`, InvitableRole, required

Example:

```json
{
  "email": "you@example.com",
  "role": "owner"
}
```

## Responses

### 201

The invitation.

- `id`, string (uuid), required
- `email`, string (email), required
- `role`, InvitableRole, required
- `created_at`, string (date-time), required
- `expires_at`, string (date-time), required
- `invited_by`, InvitationInviter, required: The person who created the invitation.
  - `name`, string, required
  - `email`, string (email), required
- `delivery`, InvitationDelivery, required: The outcome of the latest attempt to email the invitation. `sent`: the mail server accepted the email. `failed`: sending the email failed; `resendInvitation` tries again. `not_configured`: Legion has no mail connection, so nothing was sent (invitations made before also show this).
  - `status`, InvitationDeliveryStatus, required
  - `last_sent_at`, string (date-time): When an email was last sent successfully. Absent until one is.
  - `send_count`, integer, required: How many emails were sent successfully.
- `expired`, boolean: Whether `expires_at` has passed, so the invitation can no longer be accepted.
- `invite_url`, string (uri): The link the email carries: the invitation's join page in the web app, `/join/{id}` (before, the sign-in page). Opened signed out, it asks the invitee to sign in and comes back; signed in with `email`, it shows the invitation with Join and Decline (`getMyInvitation`). It works only for the invited address; the inviter can pass it on by hand if the email does not arrive. Absent when Legion has no app origin configured.

Example:

```json
{
  "id": "0192f1a2-7c3d-7e4f-8a9b-0c1d2e3f4a5b",
  "email": "you@example.com",
  "role": "owner",
  "created_at": "2026-10-15T12:00:00Z",
  "expires_at": "2026-10-15T12:00:00Z",
  "invited_by": {
    "name": "string",
    "email": "you@example.com"
  },
  "delivery": {
    "status": "sent",
    "last_sent_at": "2026-10-15T12:00:00Z",
    "send_count": 0
  },
  "expired": false,
  "invite_url": "https://legion.ambient.xyz/join/0199b51a-77e0-7b21-9f3a-5c0d2e8b4a61"
}
```

### 400

The request is malformed or fails validation. An image reference that
is not a container image reference answers `invalid_image_reference`.

### 401

Missing, unknown, expired or revoked credentials.

### 403

The caller lacks the permission this operation requires (`forbidden`),
or signed in without having joined an organization yet
(`no_organization`; `getOnboarding` and the invitation and
organization operations under it work), or could not sign in
(`email_unverified`, `account_conflict`, and `domain_not_allowed`). `not_invited` is no longer returned to
session tokens.

`access_not_approved`: a signed-in person who is not approved
for the beta yet. Every operation that takes a credential answers it to
them, except `getMe` and `joinMyWaitlist`; the problem carries
`access` (`waitlisted` or `not_requested`, and the email). Approved
means a member of an organization, holding a pending invitation, or Legion; an API key always belongs to a member.

`oauth_token_mcp_only`: the caller sent an OAuth access token (`lgo_`), which is accepted
only by `mcpMessage` and the tool calls it dispatches. Every other operation answers it, whatever
the token's scope. Use an API key or the Legion web app.

`org_suspended`: the caller's organization is suspended. Every operation that takes a
credential answers it, by session or API key, except `getMe` (which shows `org.suspended_at` and
`org.suspension_reason`) and the support operations under `/v1/support/`.

`terms_not_accepted`: an approved caller who has not accepted
the current version of the Terms of Use and the Acceptable Use Policy. Every operation that takes a credential answers it, except `getMe`,
`acceptLegalDocuments`, `joinMyWaitlist` and the wind-down operations
(`listRentals`, `stopRental`, `deleteRental`, `listHosts`,
`updateListing` with `listed` false, `removeHost`); the problem
carries `legal`. An API key acts for the person who created it, so it
is refused until that person accepts. Terminal
operations also return
`session_required` (called with an API key) and `step_up_required`
(neither a sign-in nor a step-up challenge within the step-up window).

### 409

The resource's current state does not allow the operation. `legal_versions_stale`: a legal document version sent is not the current one; the
problem's `legal` holds the current documents.

### 429

Rate limited (`code` is `rate_limited`), or the organization asked the
pull-through mirror to copy in too many different tags or digests of one
repository today (`mirror_quota_exceeded`). Retry after the `Retry-After`
seconds.

### 500

An unexpected server error. Safe to retry.

## Errors

- 403 [`no_organization`](https://legion.ambient.xyz/docs/errors#no_organization)
- 409 [`already_member`](https://legion.ambient.xyz/docs/errors#already_member)
- 409 [`invitation_exists`](https://legion.ambient.xyz/docs/errors#invitation_exists)
- 429 [`rate_limited`](https://legion.ambient.xyz/docs/errors#rate_limited)

## Example request

```sh
curl -s -X POST "https://api.legion.ambient.xyz/v1/invitations" \
  -H "Authorization: Bearer $LEGION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "you@example.com",
  "role": "owner"
}'
```
