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

# API Cookbook

> Common end-to-end tasks against the Invent API, with copy-pasteable curl.

These recipes assume you already have a credential. If not, start with [Invent for Agents](/api-reference/getting-started/for-agents). Every call uses the base URL `https://api.useinvent.com`, the header `Authorization: Bearer YOUR_API_KEY`, and the `c` org shorthand. The [OpenAPI spec](https://api.useinvent.com/openapi.json) is the authoritative contract for every endpoint and body.

<Note>
  Keys authenticate the `/orgs` and `/chats` routes; the [OpenAPI spec](https://api.useinvent.com/openapi.json) lists everything available. Pagination uses `page` (1-based) and `take` (max 100); counts come back in the `pagination-count`, `pagination-page`, and `pagination-take` response headers.
</Note>

## Stand up an assistant

<Steps>
  <Step title="Create the assistant">
    `name` is required (1 to 1024 characters); `enabled` is optional. Creating an assistant is limited to 10 per hour per org.

    ```bash theme={"system"}
    curl -X POST "https://api.useinvent.com/orgs/c/assistants" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "name": "Customer Support Bot", "enabled": true }'
    ```
  </Step>

  <Step title="Fetch it back">
    ```bash theme={"system"}
    curl -X GET "https://api.useinvent.com/orgs/c/assistants/ASSISTANT_ID" \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```
  </Step>

  <Step title="Configure instructions, knowledge, channels, and actions">
    These are set through additional assistant endpoints. Check [openapi.json](https://api.useinvent.com/openapi.json) for the exact paths and bodies, or use the dashboard.
  </Step>
</Steps>

## Work with your audience

```bash List contacts (filtered, paginated) theme={"system"}
curl -X GET "https://api.useinvent.com/orgs/c/contacts?page=1&take=20&status=SUBSCRIBED" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

`status` accepts `ALL`, `SUBSCRIBED`, `UNSUBSCRIBED`, `BLOCKED`, or `AI_REPLIES_DISABLED`. To create or update contacts, see the contact endpoints in [openapi.json](https://api.useinvent.com/openapi.json).

## Audit your connections

```bash theme={"system"}
curl -X GET "https://api.useinvent.com/orgs/c/connections?page=1&take=50" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Connections are the integrations (WhatsApp, Slack, Stripe, and more) wired to an organization.

## Put an assistant in front of customers

Assistants talk to customers through connected channels (WhatsApp, Instagram, web chat, and more) and the [web widget](/assistants/widget). Wire up a channel or embed the widget to go live. See the channel and connection endpoints in [openapi.json](https://api.useinvent.com/openapi.json).

## Errors

`401` means a missing or invalid key (or an endpoint not available to keys), `400` a bad parameter, `404` not found, and `429` rate limited (the general limit is 500 requests per minute per IP). See the [API introduction](/api-reference/getting-started/introduction) for the full table.
