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

# Introduction

> Build secure, real-time customer support integrations with the Weav API and webhooks.

# Build on Weav

The Weav Developer Platform helps you integrate AI-powered customer support directly into your product stack. Use the API to manage agents, conversations, messages, customers, companies, and **agent training data**, and to run your **Help Center knowledge base**: articles, categories, sections, translations, revisions, redirects, suggestions, and search. Every request is scoped to one organization.

Agent training data and the Help Center knowledge base are separate. Agent training data (`/v1/training-data`) is what your AI agents learn from, and it never appears on your Help Center. Help Center articles (`/v1/kb-*`) are public pages. When you publish an article in your default language, Weav also copies it into the training data for every agent.

Authentication uses bearer tokens. Endpoints are versioned under `/v1` and return consistent JSON with machine-readable error codes. That makes retries, validation errors, and long-term maintenance easier to handle as your integration grows.

Webhooks complement the API by sending events to your systems in real time when conversations, customers, agents, or training data change. Together, the API and webhooks give you the full integration loop: send commands into Weav and react to updates from Weav in near real time.

### What you can build

- Sync conversations and customer records with your CRM
- Trigger automations from live support events
- Manage AI agents and agent training data programmatically
- Publish and maintain Help Center articles from your own docs pipeline
- Build internal tooling for support operations and analytics

<AccordionGroup>
  <Accordion title="How API + webhooks work together">
    1. Your app calls the Weav API to create or update resources.
    2. Weav emits webhook events as those resources change.
    3. Your backend processes events and updates your downstream systems.
  </Accordion>
  <Accordion title="Integration best practices">
    - Use idempotent handlers for webhook processing
    - Retry safely on transient failures
    - Log webhook delivery IDs and API error codes for traceability
  </Accordion>
</AccordionGroup>

# Base URL and OpenAPI spec

All endpoints live under one versioned base URL:

```
https://api.weav.com/v1
```

The full OpenAPI 3 specification is at [`https://api.weav.com/v1/openapi.json`](https://api.weav.com/v1/openapi.json). Use it to generate clients or import the API into Postman or Insomnia. The endpoint pages in this section are generated from the same spec.

Send `Accept: application/json` on every request, and `Content-Type: application/json` on requests with a JSON body.

---

# Plan access


| Endpoints                                                                                                                                                | Available on                  |
| -------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| Help Center knowledge base: `/v1/kb`, `/v1/kb-articles`, `/v1/kb-categories`, `/v1/kb-sections`, `/v1/kb-proposals`, `/v1/kb-redirects`, `/v1/kb-search` | Every plan                    |
| Everything else: agents, companies, conversations, customers, messages, training data                                                                    | Plans that include API access |


If your plan doesn't include API access, those other endpoints return:

```json
{
  "error": "API access is not available on your current plan.",
  "code": "API_ACCESS_UNAVAILABLE"
}
```

with status `403`.

---

# Authentication

The Weav API uses **Bearer token authentication** with organization-scoped API tokens. Send the token in the `Authorization` header on every request:

```
Authorization: Bearer YOUR_API_KEY
```

> A token belongs to one organization. It can only read and change that organization's data, and IDs from other organizations return `404`.

---

### Get an API Key

Workspace admins can create API tokens in the Weav dashboard:

1. Go to **Settings → Developers → API Tokens**
2. Click **Create API token**
3. Enter a name, and optionally an expiration date
4. Create the token
5. Copy the token immediately and store it securely

> ⚠️ **Important**\
> The plain-text token is shown only once at creation time.\
> If you lose it, delete the token and create a new one.

Tokens created in Settings have **read and write** access: they can call every `GET` endpoint and every `POST`, `PUT`, `PATCH`, and `DELETE` endpoint. Read-only tokens aren't available yet, so keep tokens server-side and give each integration its own token so you can revoke it on its own.

---

### Use the Key in Requests

Example using `curl`:

```bash
curl -X GET "https://api.weav.com/v1/agents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

---

### Common Authentication Failures

### 401 — Unauthenticated

The token is missing, malformed, expired, or deleted.

```json
{
  "message": "Unauthenticated."
}
```

---

### 403 — Insufficient Token Ability

The token is valid but lacks the ability the HTTP method needs: `external-api:read` for `GET` and `HEAD`, `external-api:write` for everything else. Tokens created in Settings have both.

```json
{
  "error": "Token missing required ability: external-api:write",
  "code": "INSUFFICIENT_TOKEN_ABILITY"
}
```

---

### Authentication Best Practices

- Store API keys in a secure secrets manager (never in frontend code)
- Set expirations where possible
- Rotate keys regularly
- Delete unused keys immediately
- Send requests server-to-server over HTTPS only

---

# Rate limits

Each token can make **60 requests per minute**. Every response includes your current budget:

```
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 52
```

Requests over the limit return `429`:

```json
{
  "error": "Too many requests. Please try again later.",
  "code": "RATE_LIMIT_EXCEEDED"
}
```

Slow down when `X-RateLimit-Remaining` gets low, and after a `429` wait before retrying. Back off exponentially and add jitter if the next request is limited too.

---

# Pagination

List endpoints are paginated. Pass `page` (starting at 1) and `per_page` (1 to 100, default 15):

```bash
curl "https://api.weav.com/v1/customers?page=2&per_page=50" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

Results are in `data`. Page details are in `meta`, and ready-made page URLs in `links`:

```json
{
  "data": [],
  "links": {
    "first": "https://api.weav.com/v1/customers?page=1",
    "last": "https://api.weav.com/v1/customers?page=3",
    "prev": "https://api.weav.com/v1/customers?page=1",
    "next": "https://api.weav.com/v1/customers?page=3"
  },
  "meta": {
    "current_page": 2,
    "from": 51,
    "last_page": 3,
    "path": "https://api.weav.com/v1/customers",
    "per_page": 50,
    "to": 100,
    "total": 150
  }
}
```

Keep requesting `links.next` until it is `null`. `GET /v1/kb-proposals` returns only `data` and `meta` (`current_page`, `last_page`, `per_page`, `total`), so step `page` up until it reaches `last_page`.

---

# Safe concurrent article edits

Several people or tools may edit the same Help Center article at once. Article responses include an `ETag` header built from the article's last update time:

```
ETag: "2026-11-09T17:24:00.649773Z"
```

Send that value back in `If-Match` when you change the article. If someone else changed it in the meantime, Weav rejects the request instead of overwriting their edit:

```bash
curl -X PUT "https://api.weav.com/v1/kb-articles/ARTICLE_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H 'If-Match: "2026-11-09T17:24:00.649773Z"' \
  -d '{"translations":[{"locale":"en","content":"# Updated content"}]}'
```

`If-Match` works on these article endpoints:

- `PUT /v1/kb-articles/{id}`
- `DELETE /v1/kb-articles/{id}`
- `POST /v1/kb-articles/{id}/publish`
- `POST /v1/kb-articles/{id}/unpublish`
- `DELETE /v1/kb-articles/{id}/translations/{locale}`
- `POST /v1/kb-articles/{id}/revisions/{revisionId}/restore`


| Status | Code                  | What to do                                                                                                 |
| ------: | --------------------- | ---------------------------------------------------------------------------------------------------------- |
| 412    | `PRECONDITION_FAILED` | The article changed since you read it. Fetch it again, reapply your change, and retry with the new `ETag`. |
| 409    | `ARTICLE_LOCKED`      | Another request is writing to the same article right now. Retry after a short delay.                       |


Weak ETags (`W/"..."`) are accepted. Leaving out `If-Match`, or sending `*`, skips the check.

---

# Error handling

The Weav API uses predictable HTTP status codes and machine-readable error codes for most authorization and business-rule failures. Treat every non-2xx response as a failure: check the HTTP status first, then the error code if there is one.

Most errors use a standard JSON envelope with `error` and an optional `code`. Validation failures use Laravel's validation shape (`message` + `errors`). A few endpoint-specific responses use custom payloads, so handle both shapes.

### Error response formats

### Standard API error envelope

```json
{
  "error": "Human-readable description",
  "code": "ERROR_CODE",
  "errors": {}
}
```

- `error` *(string)*: human-readable message
- `code` *(string, optional)*: machine-readable identifier
- `errors` *(object, optional)*: additional context/details

### Validation errors (422)

Use this format when payload/query/path validation fails.

```json
{
  "message": "The given data was invalid.",
  "errors": {
    "field_name": ["Validation message"]
  }
}
```

### Endpoint-specific business-state error example (422)

Some flows can return a custom shape such as:

```json
{
  "success": false,
  "message": "No completed URLs found to resync"
}
```

> Treat this as a non-retryable business-state error unless your app changes input/state before retrying.

### HTTP status codes to handle


| Status | Meaning                             | Typical cause                                         | Retry guidance               |
| ------: | ----------------------------------- | ----------------------------------------------------- | ---------------------------- |
| 400    | Bad request / business rule failure | Invalid assignment type, invalid type/code path       | Usually no                   |
| 401    | Unauthenticated                     | Missing, invalid, or expired bearer token             | No (fix auth)                |
| 403    | Forbidden                           | Missing token ability, plan access, or blocked action | No (fix permissions/input)   |
| 404    | Not found                           | Resource missing or outside your organization         | No (fix ID/scope)            |
| 409    | Conflict                            | Article locked by another write, or state conflict    | Yes for `ARTICLE_LOCKED`     |
| 412    | Precondition failed                 | `If-Match` doesn't match the article's current `ETag` | After re-reading the article |
| 422    | Validation/business-state failure   | Invalid fields, unsupported state                     | No (fix payload/state)       |
| 429    | Too many requests                   | More than 60 requests per minute on one token         | Yes, after waiting           |
| 500    | Server error                        | Internal processing/creation failure                  | Sometimes (with backoff)     |
| 503    | Service unavailable                 | A storage operation failed temporarily                | Yes (with backoff)           |


### Common error codes


| Code                         | Status | Description                                                                 |
| ---------------------------- | ------: | --------------------------------------------------------------------------- |
| `INSUFFICIENT_TOKEN_ABILITY` | 403    | Token lacks required ability (`external-api:read` or `external-api:write`)  |
| `API_ACCESS_UNAVAILABLE`     | 403    | Your plan doesn't include API access for non-Help Center endpoints          |
| `FORBIDDEN`                  | 403    | Operation blocked by business rule (for example protected agent operations) |
| `RESOURCE_NOT_FOUND`         | 404    | Resource doesn't exist in your organization                                 |
| `RATE_LIMIT_EXCEEDED`        | 429    | Token went over 60 requests per minute                                      |
| `INVALID_SENDER`             | 400    | Invalid message sender reference                                            |
| `INVALID_ASSIGNEE`           | 400    | Invalid assignee reference                                                  |
| `INVALID_ASSIGNEE_TYPE`      | 400    | Assignee type violates conversation/channel rules                           |
| `INVALID_TYPE`               | 400    | Unsupported training data type                                              |
| `INVALID_AGENT`              | 400    | Agent missing or outside your organization                                  |
| `URL_DISCOVERY_REQUIRED`     | 422    | URL training data must be created via `POST /v1/training-data/url/process`  |
| `NO_URLS_PROVIDED`           | 422    | URL process request had no valid URLs                                       |
| `UNSAFE_URL_TARGET`          | 422    | A URL points to a private or unsafe address                                 |
| `DOMAIN_POLICY_BLOCKED`      | 422    | A URL is blocked by your organization's domain policy                       |
| `PROCESSING_FAILED`          | 500    | URL/training processing failed server-side                                  |
| `CREATION_FAILED`            | 500    | Resource creation failed server-side                                        |


### Help Center error codes


| Code                      | Status | Description                                                                 |
| ------------------------- | ------: | --------------------------------------------------------------------------- |
| `PRECONDITION_FAILED`     | 412    | The article changed since you read it (`If-Match` mismatch)                 |
| `ARTICLE_LOCKED`          | 409    | Another request is writing to the same article; retry shortly               |
| `PROPOSAL_CONFLICT`       | 409    | The suggestion can't be published in its current state                      |
| `NOT_PREVIEWABLE`         | 409    | A preview isn't available, for example the suggestion is no longer pending  |
| `API_REFERENCE_READ_ONLY` | 422    | The article is generated from the OpenAPI spec and can't be edited directly |
| `SLUG_TAKEN`              | 422    | Another article already uses that slug in the same language                 |
| `SLUG_RESERVED`           | 422    | The slug is reserved by the Help Center                                     |
| `RESERVED_SLUG`           | 422    | The slug is reserved by the Help Center                                     |
| `INVALID_SLUG`            | 422    | The slug must contain letters or numbers                                    |
| `INVALID_LOCALE`          | 422    | The translation locale isn't valid                                          |
| `DUPLICATE_LOCALE`        | 422    | Each translation in a request must have a different locale                  |
| `TRANSLATION_INCOMPLETE`  | 422    | A new translation needs both a title and content                            |
| `TRANSLATION_NOT_FOUND`   | 404    | The article has no translation in that locale                               |
| `LAST_TRANSLATION`        | 422    | An article must keep at least one translation                               |
| `INVALID_CATEGORY`        | 422    | The category doesn't exist in your Help Center                              |
| `SECTION_NOT_FOUND`       | 422    | The section doesn't exist in your Help Center                               |
| `ORDER_MISMATCH`          | 422    | A reorder request must list exactly the items in that group                 |
| `INVALID_PATH`            | 422    | A redirect path must be between 1 and 255 characters                        |
| `RESERVED_PATH`           | 422    | A redirect path starts with a reserved segment                              |
| `ASSET_DELETE_FAILED`     | 503    | An image couldn't be deleted; try again                                     |


### Best practices

- Log status, code, and response body for all non-2xx responses.
- Treat 4xx as request/integration issues, 5xx as transient/system issues.
- Only retry idempotent operations, with exponential backoff and jitter.
- Surface validation details from `errors` directly in developer tooling.

---

This knowledge base is built and hosted on [Weav](https://weav.com).
