# Invite a member to the caller's tenant

> Invite a member to the caller's tenant: CustomDomain™ API reference in the members group. Lists request parameters, the request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/members/inviteMember

## `POST https://api.customdomain.ai/v1/members`

Creates a pending member and its single-use invite link. The response carries `invite_token`; send the invitee a link built from it. The link works for 7 days, after which the member is reported as `expired` until an admin resends or revokes it. The inviter's email is taken from the credential that sends the invite, never from the body. Requires admin or owner (`member:manage`); a caller cannot invite a role above their own, and `owner` is reached only by promoting an existing member.

### Authentication

`apiKey`

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | string | yes |  |
| `role` | `owner`, `admin`, `member`, `viewer` | no |  |
| `inviter_name` | string | no | Display name of the person sending the invite, shown to the invitee. Optional; at most 80 characters. |

### Responses

| Status | Description |
| --- | --- |
| `201` | Invited |
| `400` | Error envelope: {code, title, details}. |
| `401` | Error envelope: {code, title, details}. |
| `403` | Error envelope: {code, title, details}. |

### `201` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `tenant_id` | string | yes |  |
| `email` | string | yes |  |
| `role` | `owner`, `admin`, `member`, `viewer` | yes |  |
| `status` | `active`, `pending`, `expired` | yes | `active` once accepted, `pending` while the invite link works, `expired` once it has lapsed. |
| `invited_by` | string | no | The accepting user's id in the calling application, when one was supplied at accept. |
| `inviter_email` | string | no | Who sent (or last re-sent) the invite, resolved from the sending credential. |
| `inviter_name` | string | no | The sender's display name, when one was supplied. |
| `invite_sent_at` | string | no | When the current invite link was issued. |
| `invite_expires_at` | string | no | When the current invite link stops working. Absent for members never invited by link. |
| `invite_token` | string | no | The single-use invite token. Present only in the invite, resend and get-invite responses, never in the roster. |
| `accepted_at` | string | no |  |
| `created_at` | string | yes |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
