> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.segmentationapi.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.segmentationapi.com/_mcp/server.

# SDKs

> Install the SegmentationAPI TypeScript SDK and run upload, job, and download.

`@segmentationapi/sdk` wraps the generated Fetch client from `api/openapi.yaml`.

```sh
pnpm add @segmentationapi/sdk
```

```ts
import { SegmentationAPIClient } from "@segmentationapi/sdk";

const apiKey = process.env.SEGMENTATION_API_KEY;
if (!apiKey) {
  throw new Error("SEGMENTATION_API_KEY is required");
}

const client = new SegmentationAPIClient({ token: apiKey });
const upload = await client.uploads.createUploadPresign({ contentType: "image/png" });

await fetch(upload.uploadUrl, {
  method: "PUT",
  headers: { "content-type": "image/png" },
  body: pngBytes,
});

const created = await client.jobs.createJob({
  type: "image",
  tasks: [upload.taskId],
  prompts: ["person"],
});

const job = await client.jobs.retrieveJob({ jobId: created.jobId });
if (job.status === "success") {
  const result = await client.jobs.retrieveJobResult({ jobId: job.jobId });
  console.log(result.assets);
}
```

Keep keys on a server. Browser apps should use an access-token provider, not `sk_live_`.