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

# TypeScript SDK

> An official TypeScript SDK is in flight. Use raw fetch in the meantime.

The official TypeScript SDK ships once the API surface stabilizes past the LinkedIn and Meta-trio approvals. Until then, use raw `fetch` against the documented endpoints — the API surface is small (one POST and a few GETs for v1).

A starting point that works today:

```ts theme={"system"}
type LmpKey = `lmp_${"live" | "test"}_${string}`;

export class Letmepost {
  constructor(private readonly key: LmpKey, private readonly baseUrl = "https://api.letmepost.dev") {}

  async post(body: object, idempotencyKey: string) {
    const res = await fetch(`${this.baseUrl}/v1/posts`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${this.key}`,
        "Idempotency-Key": idempotencyKey,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
    });
    if (!res.ok) throw await res.json();
    return res.json();
  }
}
```

## Reply threading (Bluesky)

Build a Bluesky thread by publishing the root post, then replying to it with the parent's strong ref. Both `uri` and `cid` come back in the publish response under `results[]`. Pass them per target in `options`:

```ts theme={"system"}
const lmp = new Letmepost(process.env.LMP_KEY as LmpKey);

// 1. Publish the root post.
const root = await lmp.post(
  { targets: [{ accountId: "acc_…" }], text: "1/ kicking off a thread" },
  "thread-root-001",
);
const parent = root.results[0];

// 2. Reply to it. replyToUri + replyToCid are sent together.
await lmp.post(
  {
    targets: [
      {
        accountId: "acc_…",
        options: {
          platform: "bluesky",
          replyToUri: parent.uri,
          replyToCid: parent.cid,
        },
      },
    ],
    text: "2/ it threads now",
  },
  "thread-reply-002",
);
```

For replies deeper than the first, also pin the thread's original post with `replyRootUri` and `replyRootCid` so every reply stays anchored to the root. Omit the root and it defaults to the parent, which is correct for a reply to a top-level post.

The schemas live in [`@letmepost/schemas`](https://github.com/rosekamallove/letmepost.dev/tree/main/packages/schemas) — once published, importing types from there is the safe path.

Watch the [GitHub release feed](https://github.com/rosekamallove/letmepost.dev/releases) for the SDK announcement.
