> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorylake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Invitation

> Creates an invitation and emails the invitee

```
POST /openapi/memorylake/admin/v1/invitations
```

Creates an invitation and emails the invitee. One live invitation per email per team: if a pending one exists, revoke it first — re-inviting is revoke + create (there is no resend endpoint). Invitation emails expire after 7 days. Creation is capped per team per 24 hours; the cap counts created invitations, and 429 responses carry Retry-After.

<Note>
  **Permission required:** `member:invite`

  * Changes that give someone an admin role, or that reduce what an admin can reach, also require the team owner or an admin.
</Note>

### Headers

<ParamField header="Idempotency-Key" type="string">
  Optional. Retrying with the same value replays the first result instead of sending a second email.
</ParamField>

### Request Body

<ParamField body="email" type="string" required>
  Invitee email address. One live invitation per address per team.
</ParamField>

<ParamField body="role" type="string" required>
  Role the invitee will hold on acceptance: tenant\_admin, tenant\_member, or a custom role key of this team. The owner role cannot be invited.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://app.memorylake.ai/openapi/memorylake/admin/v1/invitations' \
    -H 'Authorization: Bearer sk_xxxxxx' \
    -H 'Idempotency-Key: 7c1d2e3f-0a9b-4c8d-b7e6-f5a4d3c2b1a0' \
    -H 'Content-Type: application/json' \
    -d '{
      "email": "alice@example.com",
      "role": "tenant_member"
    }'
  ```
</RequestExample>

### Response

<ResponseField name="data" type="object">
  <Expandable title="Invitation object">
    <ResponseField name="created_at" type="integer">First invitation time, Unix seconds</ResponseField>
    <ResponseField name="email" type="string">Invitee email address (normalised to lowercase)</ResponseField>
    <ResponseField name="expires_at" type="integer">Expiry time of the current invitation email, Unix seconds</ResponseField>
    <ResponseField name="id" type="string">Stable identifier of this invitation</ResponseField>
    <ResponseField name="role" type="string">Role the invitee will hold on acceptance: tenant\_admin | tenant\_member | \<custom role></ResponseField>
    <ResponseField name="status" type="string">Invitation state. One of: `pending`, `accepted`, `rejected`, `expired`, `revoked`.</ResponseField>
    <ResponseField name="accepted_at" type="integer">Acceptance time, Unix seconds. Present only when accepted.</ResponseField>
    <ResponseField name="accepted_principal_id" type="string">principal\_id of the member this invitation produced. Present only when accepted.</ResponseField>
    <ResponseField name="last_invited_at" type="integer">Most recent invitation email time, Unix seconds. Omitted on rows that predate this field.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success (201) theme={null}
  {
    "success": true,
    "message": "Operation completed successfully",
    "data": {
      "created_at": 1760000000,
      "email": "alice@example.com",
      "expires_at": 1760000000,
      "id": "c079f4f4e529b9d687b3cce00eeb9644",
      "role": "tenant_member",
      "status": "pending",
      "accepted_at": 1760000000,
      "accepted_principal_id": "5a4863beca31b3b37f780badf1652511",
      "last_invited_at": 1760000000
    }
  }
  ```
</ResponseExample>

### Errors

Errors answer with `success: false`, a `message` and an `error_code`. See [Error Codes](/features/memorylake/api-reference/errors) for every code.

| Status | Meaning |
| - | - |
| `400` | A parameter or the body is invalid |
| `401` | The API key is missing, invalid, disabled or expired |
| `403` | The key is not allowed to do this |
| `409` | The request conflicts with the current state, e.g. a duplicate or a limit reached |
| `422` | The body or a parameter failed validation |
| `429` | Too many requests. Wait for the time in `Retry-After` |
| `500` | Server-side error |
| `503` | Temporarily unavailable. Retry later |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.