> For a complete page index of the Captain API documentation, fetch https://docs.filesearch.dev/llms.txt?excludeSpec=true

# Reconcile Sync

POST https://api.filesearch.dev/v2/syncs/{sync_id}/reconcile

Run an on-demand reconciliation: list the bucket, diff it against Captain's indexed state, then index added/modified objects and apply the deletion policy to removed ones. Returns the deltas. This is the same operation the scheduled cadence runs automatically.

Reference: https://docs.filesearch.dev/reference/sync/manage/reconcile

## Request

### Path parameters

- `sync_id` (string, required) — The sync id.

### Headers

- `authorization` (string, optional, nullable) — Bearer \{api\_key}. Your Captain API key.

## Response

### 200

Successful Response

- `sync_id` (string, optional)
- `job_id` (string, optional, nullable) — Index job spawned for the deltas, if any.
- `added` (integer, optional)
- `modified` (integer, optional)
- `removed` (integer, optional)
- `unchanged` (integer, optional)
- `deleted_documents` (integer, optional) — Documents removed from the collection (mirror) or archived (archive) this pass.

## Examples

**Response**

```json
{
  "sync_id": "sync_7e0abee6e110457db2c8",
  "job_id": "65fca451551c43d097e3f206c93d921e-1786121649",
  "added": 0,
  "modified": 1,
  "removed": 0,
  "unchanged": 0,
  "deleted_documents": 0
}
```

**SDK Code**

```python Python REST
import requests

BASE_URL = "https://api.filesearch.dev"
API_KEY = "your_api_key"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

response = requests.post(
    f"{BASE_URL}/v2/syncs/sync_7e0abee6e110457db2c8/reconcile",
    headers=headers
)

print(response.json())
```

```typescript TypeScript REST
const BASE_URL = "https://api.filesearch.dev";
const API_KEY = "your_api_key";

const response = await fetch(
    `${BASE_URL}/v2/syncs/{sync_id}/reconcile`,
    {
        method: "POST",
        headers: {
            "Authorization": `Bearer ${API_KEY}`,
            "Content-Type": "application/json"
        }
    }
);

const data = await response.json();
console.log(data);
```