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

# Quickstart

> Go from API key to automatic Xactimate export.

If you are using ChatGPT, Claude, Codex, or another MCP-aware client, start with [CapOut MCP](/mcp/overview). This page covers the direct REST API.

## 1. Authenticate REST calls

Include your API key as the `capout-api-key` header.

```bash theme={null}
export CAPOUT_API_KEY="capout_test_your_api_key"
```

## 2. Upload a document

The upload API supports both a fetchable `url` and an inline `file_base64` payload.

```bash theme={null}
curl https://api.capout.ai/upload \
  -X POST \
  -H "content-type: application/json" \
  -H "capout-api-key: $CAPOUT_API_KEY" \
  -d '{
    "url": "https://example.com/claims/123/estimate.pdf",
    "file_name": "claim-123-estimate.pdf",
    "xn_address": "restoration-team@example.xn",
    "profile_code": "5L"
  }'
```

Inline base64 uploads use the same endpoint with a different request body:

```bash theme={null}
curl https://api.capout.ai/upload \
  -X POST \
  -H "content-type: application/json" \
  -H "capout-api-key: $CAPOUT_API_KEY" \
  -d '{
    "file_base64": "BASE64_PDF_CONTENT",
    "file_name": "claim-123-estimate.pdf",
    "xn_address": "restoration-team@example.xn",
    "profile_code": "5L"
  }'
```

See [Upload a document](/guides/upload-a-document) for Python and Node.js examples that turn a local file into the `file_base64` value.

Store the returned `document_id` and use it to track workflow completion:

Expected shape:

```json theme={null}
{
  "document_id": "doc_123",
  "workflow_id": "wf_123",
  "status": "processing",
  "created_at": "2026-04-14T14:30:00Z",
  "status_url": "/status/doc_123",
  "ws_url": "/ws/status"
}
```

## 3. Poll the document status

```bash theme={null}
curl https://api.capout.ai/status/doc_123 \
  -H "capout-api-key: $CAPOUT_API_KEY"
```

Typical response while work is still running:

```json theme={null}
{
  "document_id": "doc_123",
  "status": "processing",
  "workflow_complete": false,
  "completed_at": null,
  "updated_at": "2026-04-14T14:31:12Z"
}
```

## 4. Switch to realtime updates

Mint a short-lived token, then connect with SSE or WebSocket.

```bash theme={null}
curl https://api.capout.ai/ws/token \
  -X POST \
  -H "capout-api-key: $CAPOUT_API_KEY"
```

Browser-friendly SSE example:

```js theme={null}
const tokenResponse = await fetch("https://api.capout.ai/ws/token", {
  method: "POST",
  headers: {
    "capout-api-key": process.env.CAPOUT_API_KEY,
  },
}).then((res) => res.json());

const streamUrl = new URL(tokenResponse.sse_url, "https://api.capout.ai");
streamUrl.searchParams.set("token", tokenResponse.token);
streamUrl.searchParams.append("document_id", "doc_123");

const source = new EventSource(streamUrl);

source.onmessage = (event) => {
  console.log(JSON.parse(event.data));
};
```

## 5. Check remaining claims

```bash theme={null}
curl https://api.capout.ai/claims \
  -H "capout-api-key: $CAPOUT_API_KEY"
```

Next:

* [Authentication](/authentication)
* [CapOut MCP](/mcp/overview)
* [Realtime updates](/guides/realtime-updates)
* [API reference](/api-reference/overview)
