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

# Admin API

> Dashboard-facing endpoints for tenant setup, operations, and analytics.

## Base path

```txt theme={null}
https://platform.watermelonn.app/api/v1/admin
```

All routes require a Supabase access token in the Authorization header.

## Auth and onboarding

| Method | Endpoint        | Description                                      |
| ------ | --------------- | ------------------------------------------------ |
| GET    | `/auth/me`      | Returns linked tenant and role for current user. |
| POST   | `/auth/onboard` | Creates tenant and links current user as owner.  |

## Dashboard and operations

| Method | Endpoint             | Description                                                 |
| ------ | -------------------- | ----------------------------------------------------------- |
| GET    | `/stats`             | Returns KPI metrics, top intents, and recent conversations. |
| GET    | `/conversations`     | Paginated/filterable conversation list.                     |
| GET    | `/conversations/:id` | Full conversation detail and related tickets.               |

## Tickets

| Method | Endpoint       | Description                                              |
| ------ | -------------- | -------------------------------------------------------- |
| GET    | `/tickets`     | Lists tickets with status/priority filters.              |
| GET    | `/tickets/:id` | Returns ticket detail with conversation and audit trail. |
| PATCH  | `/tickets/:id` | Updates ticket status and/or priority.                   |

## Intents

| Method | Endpoint       | Description                          |
| ------ | -------------- | ------------------------------------ |
| GET    | `/intents`     | Lists intents with usage hit counts. |
| GET    | `/intents/:id` | Retrieves a single intent.           |
| POST   | `/intents`     | Creates a new intent configuration.  |
| PUT    | `/intents/:id` | Updates an existing intent.          |
| DELETE | `/intents/:id` | Deletes an intent.                   |

## Integrations, audit, settings

| Method | Endpoint        | Description                                        |
| ------ | --------------- | -------------------------------------------------- |
| GET    | `/integrations` | Lists tenant integrations with masked credentials. |
| GET    | `/audit`        | Paginates audit entries with category filters.     |
| GET    | `/settings`     | Returns tenant settings + credential preview.      |
| PUT    | `/settings`     | Updates tenant name/config (merged update).        |

## Example: update ticket

```bash theme={null}
curl -X PATCH https://platform.watermelonn.app/api/v1/admin/tickets/TICKET_ID \
  -H "Authorization: Bearer SUPABASE_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status":"in_progress","priority":"high"}'
```
