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

> ## Agent Instructions
> Every Lath operation is POST https://platform.trylath.com/<operation name with dots replaced by slashes>, with a JSON body and `Authorization: Bearer <key>`. `email.send` is POST /email/send.
> Branch on `error.code`, never on `error.message`. Every refusal also carries `error.fix`, which names the next step.
> Send an `Idempotency-Key` header on any operation that is not retry-safe, so a retry cannot run it twice.
> A `lath_test_` key emails only the account's own members and sends no SMS; a `lath_live_` key reaches real recipients and is billed.
> The OpenAPI document, generated from the same registry as the routes, is at https://platform.trylath.com/openapi.json.

# API reference

> One POST per operation — 228 of them — with a bearer key, a JSON body and the same envelope on every reply.

Every operation is one `POST` to its name, with a JSON body and a bearer key. There are no path parameters, no query strings and no other verbs, so this page is the whole shape and the pages after it are the operations.

## Base URL

```text theme={null}
https://platform.trylath.com
```

The path is the operation name with its dots turned into slashes: `email.send` is `POST /email/send`. A `/v1` prefix is still accepted on every operation and is not needed.

## Authentication

Send a key as `Authorization: Bearer <key>`. A secret key (`lath_live_…`, `lath_test_…`) belongs on a server; a publishable key (`lath_live_pk…`, `lath_test_pk…`) reaches only the operations an end user performs for themselves, each marked `auth:public`. The key decides the environment, live or test. [Keys and permissions](/auth/keys-and-permissions) covers both.

## A request and its response

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://platform.trylath.com/email/send \
    -H "Authorization: Bearer $LATH_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"to":"you@example.com","subject":"Hello from Lath","text":"It works."}'
  ```

  ```ts TypeScript theme={null}
  import { createLath } from "@trylath/sdk";

  const lath = createLath({ key: process.env.LATH_API_KEY });

  const { result } = await lath.email.send({
    to: "you@example.com",
    subject: "Hello from Lath",
    text: "It works.",
  });
  ```

  ```bash CLI theme={null}
  lath email send --to you@example.com --subject 'Hello from Lath' --text 'It works.'
  ```
</CodeGroup>

Every success is `{ activityId, result }`. `activityId` names the audit record the call wrote and is empty for a read; `result` is the operation's own output, described on its page.

```json 200 theme={null}
{
  "activityId": "0b8e5f7a-2c1d-4e3b-9a6f-7d5c4b3a2e10",
  "result": {
    "messageId": "6f2a9c4e-1b7d-4a8e-b3c5-9e0d2f1a7b64",
    "status": "queued",
    "attachments": [],
    "to": "you@example.com",
    "from": "no-reply@acme.via.trylath.com",
    "fromName": "Acme",
    "subject": "Hello from Lath",
    "template": null,
    "templateVersion": null,
    "templateLocale": null,
    "sendAfter": null
  }
}
```

## Errors

A refusal is `{ error: { code, message, fix, requestId } }` with a status that matches its class. Branch on `code`; `fix` names the next step. The [error codes](/reference/error-codes) page lists every one.

## Retries, paging and limits

Send an `Idempotency-Key` header on a write you might retry, and a repeat returns the first answer instead of acting twice. Lists page with `before` and `nextBefore`. Each key may make 600 requests a minute. [API conventions](/platform/api-conventions) has the detail, and [rate limits](/platform/rate-limits) the per-operation ceilings.

## The OpenAPI document

The document these pages are built from is served at `https://platform.trylath.com/openapi.json`, generated from the same operation registry as the routes. Point a client generator at it, or read [Any other language](/frameworks/other-languages).
