> ## 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.

# Any other language

> There is no Python, Ruby, Go, PHP or Java client yet — the only typed clients are @trylath/sdk and @trylath/react. Everything is a POST with a bearer token, and the OpenAPI document generates a client for most languages in one command.

<Steps>
  <Step title="Every operation is one POST">
    The operation name is the path: `email.send` is `POST /email/send`, `auth.signin.start` is `POST /auth/signin/start`. The body is the input object. There is no other shape to learn.

    The reply is `{ activityId, result }`. A refusal is `{ error: { code, message, fix } }` with a meaningful status.

    ```python theme={null}
    # Python, with nothing but requests
    import os, requests

    r = requests.post(
        "https://platform.trylath.com/email/send",
        headers={"Authorization": f"Bearer {os.environ['LATH_API_KEY']}"},
        json={"to": "you@example.com", "subject": "Hello", "text": "First one."},
    )
    r.raise_for_status()
    print(r.json()["result"]["status"])
    ```
  </Step>

  <Step title="Generate a client from the OpenAPI document">
    The document is generated from the same operation registry as the REST routes, so a generated client is as current as the API. `openapi-generator` covers most languages; most people need nothing more than this.

    ```bash theme={null}
    curl -o lath.json https://platform.trylath.com/openapi.json

    openapi-generator generate -i lath.json -g python -o ./lath-client
    openapi-generator generate -i lath.json -g go     -o ./lath-client
    openapi-generator generate -i lath.json -g ruby   -o ./lath-client
    ```
  </Step>

  <Step title="The two things you would have had for free">
    **Idempotency.** Anything not retry-safe takes an `Idempotency-Key` header. The reference marks which operations those are, and a key reused with different input is refused rather than quietly accepted.

    **Webhook signatures.** `Lath-Signature` is `t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">`. Compare in constant time and reject anything older than five minutes. The webhooks guide has the whole scheme in about ten lines, in a form that ports to any language.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://platform.trylath.com/email/send \
        -H "Authorization: Bearer $LATH_API_KEY" \
        -H "Idempotency-Key: order-1043-receipt" \
        -H "Content-Type: application/json" \
        -d '{"to":"you@example.com","subject":"Receipt","text":"Thanks."}'
      ```

      ```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: "Receipt",
        text: "Thanks.",
      }, { idempotencyKey: "order-1043-receipt" });
      ```

      ```bash CLI theme={null}
      lath email send \
        --to you@example.com \
        --subject Receipt \
        --text Thanks. \
        --idempotency-key order-1043-receipt
      ```
    </CodeGroup>
  </Step>

  <Step title="And the CLI works anywhere">
    `npx @trylath/cli` needs Node on the machine but nothing in your project, which makes it a reasonable way to script Lath from a Makefile, a CI job or a language with no client.

    ```bash theme={null}
    npx @trylath/cli email send --to you@example.com --subject Hi --text Hello
    ```
  </Step>
</Steps>
