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

# API Reference

> Complete REST API documentation for the Wassist platform

The Wassist REST API provides programmatic access to all platform features. Build integrations, automate workflows, and manage your WhatsApp agents at scale.

## Base URL

All API requests should be made to:

```
https://backend.wassist.app/api/v1/
```

## Authentication

The Wassist API uses API key authentication. Include your API key in the `X-API-Key` header of every request:

```bash theme={null}
X-API-Key: your-api-key-here
```

### Getting Your API Token

1. Log in to [wassist.app](https://wassist.app)
2. [Navigate to **Settings** → **API Keys**](https://wassist.app/settings/)
3. Click **Create API Key**
4. Copy and securely store your token

<Warning>
  Keep your API token secret. Never expose it in client-side code or commit it to version control.
</Warning>

### Example Request

```bash theme={null}
curl -X GET https://backend.wassist.app/api/v1/agents/ \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json"
```

## Request Format

* All request bodies should be JSON
* Set `Content-Type: application/json` header
* For file uploads, use `multipart/form-data`

```bash theme={null}
curl -X POST https://backend.wassist.app/api/v1/agents/ \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"name": "My New Agent"}'
```

## Response Format

All responses are JSON. Successful responses include the requested data:

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "My Agent",
  "description": "A helpful assistant",
  ...
}
```

### Paginated Responses

List endpoints return paginated results:

```json theme={null}
{
  "count": 42,
  "next": "https://backend.wassist.app/api/v1/agents/?offset=20",
  "previous": null,
  "results": [
    { "id": "...", "name": "Agent 1" },
    { "id": "...", "name": "Agent 2" }
  ]
}
```

Use `offset` and `limit` query parameters to paginate:

```
GET /agents/?offset=20&limit=20
```

## Error Responses

Errors return appropriate HTTP status codes with a JSON body:

```json theme={null}
{
  "error": "Agent not found",
  "code": "not_found"
}
```

### Common Status Codes

| Code  | Description                          |
| ----- | ------------------------------------ |
| `200` | Success                              |
| `201` | Created                              |
| `204` | No Content (successful delete)       |
| `400` | Bad Request (validation error)       |
| `401` | Unauthorized (invalid/missing token) |
| `403` | Forbidden (insufficient permissions) |
| `404` | Not Found                            |
| `429` | Rate Limited                         |
| `500` | Server Error                         |

## Rate Limiting

API requests are rate-limited to ensure fair usage. Current limits:

* **100 requests per minute** per API token

When rate limited, you'll receive a `429` response:

```json theme={null}
{
  "error": "Rate limit exceeded",
  "retry_after": 60
}
```

## API Resources

<CardGroup cols={2}>
  <Card title="Agents" icon="robot" href="/api-reference/agents/list">
    Create and manage AI agents with all their configurations.
  </Card>

  <Card title="WhatsApp Accounts" icon="whatsapp" iconType="brands" href="/api-reference/whatsapp-account/list">
    Connect and manage WhatsApp Business accounts.
  </Card>

  <Card title="WhatsApp Linking" icon="link" href="/api-reference/account-link/create">
    Create link sessions for connecting new accounts.
  </Card>

  <Card title="Business API Proxy" icon="arrow-right-arrow-left" href="/api-reference/whatsapp-account/proxy/get">
    Access the WhatsApp Business API directly.
  </Card>
</CardGroup>

## Quick Reference

### Agents

| Method   | Endpoint               | Description        |
| -------- | ---------------------- | ------------------ |
| `GET`    | `/agents/`             | List all agents    |
| `POST`   | `/agents/`             | Create an agent    |
| `GET`    | `/agents/{id}/`        | Get an agent       |
| `PUT`    | `/agents/{id}/`        | Update an agent    |
| `DELETE` | `/agents/{id}/`        | Delete an agent    |
| `POST`   | `/agents/{id}/deploy/` | Deploy to WhatsApp |
| `POST`   | `/agents/{id}/share/`  | Share with a user  |

### WhatsApp Accounts

| Method | Endpoint                                | Description        |
| ------ | --------------------------------------- | ------------------ |
| `GET`  | `/whatsapp-accounts/`                   | List accounts      |
| `GET`  | `/whatsapp-accounts/{id}/`              | Get an account     |
| `POST` | `/whatsapp-accounts/{id}/deploy-agent/` | Deploy agent       |
| `POST` | `/whatsapp-accounts/{id}/add-number/`   | Add phone number   |
| `*`    | `/whatsapp-accounts/{id}/proxy/{path}`  | Business API proxy |

### WhatsApp Linking

| Method | Endpoint                        | Description         |
| ------ | ------------------------------- | ------------------- |
| `POST` | `/whatsapp-link-sessions/`      | Create link session |
| `GET`  | `/whatsapp-link-sessions/`      | List sessions       |
| `GET`  | `/whatsapp-link-sessions/{id}/` | Get session         |

## Support

Need help with the API?

<CardGroup cols={2}>
  <Card title="Contact Support" icon="envelope" href="mailto:contact@wassist.app">
    Reach out to our team.
  </Card>
</CardGroup>
