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

# Upload

> Request presigned upload URLs, upload files to S3, and manage task IDs for segmentation jobs.

Media never goes through the API origin as raw bytes. Request a presigned URL, PUT the file to S3, then pass the returned `taskId` into `client.jobs.createJob()`.

## Request a URL

```bash
curl -X POST \
  https://api.segmentationapi.com/v1/uploads/presign \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_SEGMENTATION_API_KEY" \
  -d '{"contentType": "image/png"}'
```

```ts
const upload = await client.uploads.createUploadPresign({ contentType: "image/png" });
```

The JSON body and `PresignUploadResponse` fields are in the [API reference](/api-reference). The URL expires after `expiresIn` seconds (300 by default).

## PUT the file

```bash
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/png" \
  --data-binary "@frame-0001.png"
```

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

The `Content-Type` on the PUT must match the `contentType` you presigned. A mismatch is a 403 from S3.

## Formats

Common, well-tested types:

| Type   | MIME types                                                       |
| ------ | ---------------------------------------------------------------- |
| Images | `image/png`, `image/jpeg`, `image/webp`                          |
| Video  | `video/mp4`, `video/quicktime`, `video/webm`, `video/x-matroska` |

Any `image/*` or `video/*` MIME type is accepted. The type you presign with is the type your PUT must send.