> ## Documentation Index
> Fetch the complete documentation index at: https://raveculture-mintlify-api-spec-sync-1774445910.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Invite API

> Generate and validate invite codes for platform access

# Invite API

Generate and validate invite codes for gating access to the Agentbot platform. These endpoints are backend-only.

<Note>Invite codes are now persisted in the database and survive server restarts. Code generation requires internal API key authentication to prevent invite flooding. Code validation remains public.</Note>

## Generate invite code

```http theme={null}
POST /api/invite/generate
```

Generates a new invite code. Requires internal API key authentication via the `Authorization: Bearer <INTERNAL_API_KEY>` header.

### Errors

| Code | Description                         |
| ---- | ----------------------------------- |
| 401  | Missing or invalid internal API key |
| 500  | Failed to generate invite code      |

### Response

```json theme={null}
{
  "code": "a1b2c3d4e5f6"
}
```

| Field  | Type   | Description                                             |
| ------ | ------ | ------------------------------------------------------- |
| `code` | string | A 12-character hex string generated from 6 random bytes |

## Validate invite code

```http theme={null}
POST /api/invite/validate
```

Validates and consumes an invite code. The operation is atomic — only one concurrent request can successfully consume a given code. Once validated, the code is marked as used and cannot be reused. No authentication required.

### Request body

| Field  | Type   | Required | Description                 |
| ------ | ------ | -------- | --------------------------- |
| `code` | string | Yes      | The invite code to validate |

### Response (valid)

```json theme={null}
{
  "valid": true
}
```

### Response (invalid)

```json theme={null}
{
  "valid": false
}
```

### Errors

| Code | Description                               |
| ---- | ----------------------------------------- |
| 400  | Code is missing, invalid, or already used |
