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

# API reference

> Complete API conventions: auth, request formats, errors, and core resources

## Base URLs

HelpGenie supports both REST-style routes and direct Supabase function invocation.

```
Primary: https://api.helpgenie.ai/v1
Alternative: https://helpgenie.ai/api/v1
Direct Supabase: POST https://api.helpgenie.ai/v1
```

REST routes follow:

```
{BASE_URL}/{resource}[/{id}]
```

## Authentication

All auth methods use the `Authorization` header.

```
Authorization: Bearer <token>
```

### API key (recommended for external integrations)

```
Authorization: Bearer hg_live_...
```

* Prefix: `hg_live_`
* Rate limit: `60 requests/minute` per key
* Maximum `5` active keys per user

### Session JWT (browser/app context)

```
Authorization: Bearer <supabase_access_token>
```

### Service role key (server-to-server)

```
Authorization: Bearer <SUPABASE_SERVICE_ROLE_KEY>
x-user-id: <user-uuid>
Content-Type: application/json
```

## Request formats

### REST-style (recommended)

```
GET    /v1/{resource}         → action: "all"
GET    /v1/{resource}/list    → action: "list"
GET    /v1/{resource}/{id}    → action: "get"
POST   /v1/{resource}         → action: "create"
PATCH  /v1/{resource}/{id}    → action: "update"
DELETE /v1/{resource}/{id}    → action: "delete"
```

### Custom actions (POST body)

```json theme={null}
POST /v1/{resource}
{
  "action": "custom-action",
  "id": "optional-id",
  "data": {}
}
```

### Direct invocation (POST body)

```json theme={null}
POST https://api.helpgenie.ai/v1
{
  "resource": "genies",
  "action": "list",
  "id": null,
  "data": {}
}
```

**resource** `string` *required*

API resource name. Example: `genies`, `knowledge-base`, `integrations`, `api-keys`.

**action** `string` *required*

Action for the selected resource (for example `list`, `get`, `create`, `update`, `delete`).

**id** `string`

Optional resource identifier for single-record actions.

**data** `object`

Action-specific parameters (filters, pagination, payload fields).

## Response envelope

```json theme={null}
{
  "success": true,
  "data": {
    // action-specific response data
  }
}
```

**Error (4xx / 5xx):**

```json theme={null}
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "status": 400
  }
}
```

## Error codes

| Code | Status | Description |
| - | - | - |
| `UNAUTHORIZED` | 401 | Missing or invalid Authorization header |
| `INVALID_TOKEN` | 401 | Token is invalid or expired |
| `FORBIDDEN` | 403 | User lacks permission for the resource |
| `NOT_FOUND` | 404 | Resource not found |
| `AGENT_NOT_FOUND` | 404 | Genie not found or access denied |
| `VALIDATION_ERROR` | 400 | Invalid request format or data |
| `INVALID_ACTION` | 400 | Action not supported for the resource |
| `RATE_LIMIT_EXCEEDED` | 429 | Too many requests |
| `INTERNAL_ERROR` | 500 | Server error |

## Access control

Roles determine access scope:

* **internal\_admin** - Full cross-account access.
* **business** - Access to their own business data.
* **consumer** - Limited read-only/interaction access.

Admin users can pass `adminMode: true` or a `userId` parameter to operate on resources owned by other users.

## Resource map

> [card] [Genies](https://docs.helpgenie.ai/api-reference/genies.md)
>
> Create, update, list, and delete voice AI genies

> [card] [Genie groups](https://docs.helpgenie.ai/api-reference/genie-groups.md)
>
> Group and organize genies

> [card] [Conversations](https://docs.helpgenie.ai/api-reference/conversations.md)
>
> Sync, analyze, and manage conversations

> [card] [Knowledge base](https://docs.helpgenie.ai/api-reference/knowledge-base.md)
>
> Manage documents and attach them to genies

> [card] [Document folders](https://docs.helpgenie.ai/api-reference/document-folders.md)
>
> Organize knowledge base documents into folders

> [card] [Voices](https://docs.helpgenie.ai/api-reference/voices.md)
>
> Manage voice favorites and track usage

> [card] [Voice collections](https://docs.helpgenie.ai/api-reference/voice-collections.md)
>
> Create and manage curated voice collections

> [card] [Leads](https://docs.helpgenie.ai/api-reference/leads.md)
>
> Capture and manage customer leads

> [card] [Marketplace](https://docs.helpgenie.ai/api-reference/marketplace.md)
>
> Browse and publish genie templates

> [card] [Profiles](https://docs.helpgenie.ai/api-reference/profiles.md)
>
> Manage user profiles and settings

> [card] [Teams](https://docs.helpgenie.ai/api-reference/teams.md)
>
> Create teams, invite members, manage roles

> [card] [Activities](https://docs.helpgenie.ai/api-reference/activities.md)
>
> Track platform activity and audit logs

> [card] [Goals](https://docs.helpgenie.ai/api-reference/goals.md)
>
> Manage agent goals and outcomes

> [card] [API keys](https://docs.helpgenie.ai/api-reference/api-keys.md)
>
> Create, revoke, and delete developer API keys

> [card] [Phone numbers](https://docs.helpgenie.ai/api-reference/phone-numbers.md)
>
> Provision, release, and manage Twilio phone numbers

> [card] [QR codes](https://docs.helpgenie.ai/api-reference/qr-code.md)
>
> Manage QR code images for genie pages

> [card] [Worker genies](https://docs.helpgenie.ai/api-reference/worker-genies.md)
>
> Autonomous background AI agents for tasks and integrations

> [card] [Analytics](https://docs.helpgenie.ai/api-reference/analytics.md)
>
> Platform analytics, trends, and genie performance

> [card] [Billing](https://docs.helpgenie.ai/api-reference/billing.md)
>
> Subscriptions, usage, invoices, and checkout

> [card] [Branding](https://docs.helpgenie.ai/api-reference/branding.md)
>
> Team branding, logos, and style configuration

> [card] [Portals](https://docs.helpgenie.ai/api-reference/portals.md)
>
> Create multi-genie portal pages

> [card] [Playbooks](https://docs.helpgenie.ai/api-reference/playbooks.md)
>
> Browse and apply pre-built genie playbooks

> [card] [Capabilities](https://docs.helpgenie.ai/api-reference/capabilities.md)
>
> Discover resources and actions at runtime


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