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

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# Introduction

> The LangWatch REST API: authentication, the OpenAPI document, and where each surface lives.

Every page in this section is generated from LangWatch's OpenAPI 3.1 document, so what you read here is what the API accepts.

## The OpenAPI document

Fetch the whole thing, unauthenticated:

```
GET https://app.langwatch.ai/api/gateway/v1/openapi.json
```

One document covers every surface below, which is what you point a client generator, a Postman import, or an agent at. Self-hosted: same path on your own DNS.

## Authentication

Most endpoints take a project API key:

```
X-Auth-Token: sk-lw-...
```

`Authorization: Bearer sk-lw-...` works too. Some families need an **organization** API key instead, because they carry signing secrets and organization-wide data: [webhook endpoints](/docs/features/webhooks), [gateway spend](/docs/ai-gateway/billing-events), and everything that provisions the organization itself, from the [organization profile](/docs/api-reference/organization/overview) and its [members](/docs/api-reference/members/overview) through [roles](/docs/api-reference/roles/overview) and [role bindings](/docs/api-reference/role-bindings/overview). Create either kind under **Settings > API Keys**.

Two surfaces authenticate differently again. The [SCIM 2.0 endpoints](/docs/api-reference/scim/overview) take a SCIM bearer token, because the caller is your identity provider. [Creating organizations on a self-hosted instance](/docs/api-reference/organizations/overview) takes the instance administrator credential, because it runs before any organization exists.

The AI Gateway's own inference endpoints (`/v1/chat/completions` and friends) authenticate with a [virtual key](/docs/ai-gateway/virtual-keys) rather than an API key, and live on the gateway host.

## Conventions

* Request and response fields are `lower_snake_case`.
* Money is an integer number of nano-USD (billionths of a dollar), with a decimal string rendered from it for display. The integer is the source of truth: sum integers, round once.
* Timestamps are ISO 8601, except spend and event filters, which take epoch milliseconds.
* List endpoints are cursor-paged: follow `next_cursor` until it comes back `null`. A full page does not mean there is more, and a short page does not mean there is not.
* Errors carry a stable `error.code` to branch on. See [Errors](/docs/ai-gateway/api/errors).
