# Accept an invite (single-use token)

> Accept an invite (single-use token): CustomDomain™ API reference in the members group. Covers request parameters, the request body, responses and error codes.

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

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

Accepts the invite and returns the member with a member-scoped API key for the inviter's tenant. The token is the capability, so no API key is needed; when `email` is supplied it must match the invited email. The token is spent on success, once. A second accept that races the first, or one racing a resend that replaced the link, is refused with 409. A repeat after the accept has finished finds no invite and answers 404, as does a link for an invite that was removed. A pending invite whose link has lapsed is refused with 410 `invite_expired`.

### Authentication

None.

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | string | yes |  |
| `email` | string | no | When supplied, must match the invited email. |
| `user_id` | string | no | The accepting user's id in the calling application, recorded as `invited_by`. |

### Responses

| Status | Description |
| --- | --- |
| `200` | Accepted |
| `400` | Error envelope: {code, title, details}. |
| `404` | Error envelope: {code, title, details}. |
| `409` | Error envelope: {code, title, details}. |
| `410` | Error envelope: {code, title, details}. |

### `200` 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 |  |
| `application_id` | string | yes | The inviter tenant's default application. |
| `api_key` | string | yes | Member-scoped API key for the inviter's tenant; shown once. |

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