---
title: "Create S3 Sync"
method: POST
path: "/v2/collections/{collection_name}/sync/s3"
tags: ["sync"]
---

# Create S3 Sync

`POST /v2/collections/{collection_name}/sync/s3`

Create a Sync for a collection and start the initial backfill. AWS S3 authenticates with cross-account assume-role (recommended) or an access key. Works across S3-compatible cloud storage: AWS S3, Google Cloud Storage, Cloudflare R2, Supabase Storage, and Backblaze B2 (each has its own create endpoint). Returns the sync; indexing runs asynchronously.

## Path parameters

- `collection_name` string, required

## Headers

- `authorization` string, nullable

## Request body

- S3SyncCreateRequestDocs
  - `bucket` string, required — Bucket to keep in sync with the collection.
  - `prefix` string — Key prefix to scope the sync (e.g. 'docs/2024/'). Empty syncs the whole bucket.
  - `region` string — Region of the bucket (AWS region for S3, or the provider's region, e.g. 'auto' for R2, 'us-west-004' for Backblaze B2).
  - `storage_type` 's3' | 'r2' | 'supabase' | 'backblaze' — Cloud storage type. 's3' = AWS S3 (assume-role or access-key). 'r2'/'supabase'/'backblaze' are S3-compatible and require access-key auth with an endpoint_url.
  - `auth` S3SyncCreateRequestDocsAuth, required — Auth for reading the bucket: assume-role (AWS S3) or access-key (S3 or S3-compatible). Non-S3 stores require access-key auth.
  - `processing_type` 'advanced' | 'basic', required — Parsing tier. 'advanced' = full document understanding; 'basic' = faster/cheaper.
  - `include_patterns` string[] — Glob patterns; only matching keys are synced. Empty includes everything under the prefix.
  - `exclude_patterns` string[] — Glob patterns; matching keys are excluded.
  - `deletion_policy` 'mirror' | 'archive' | 'ignore' — How to propagate objects removed from the source: `mirror` removes them from the collection so they no longer appear in search; `archive` keeps the document's content but marks it archived, excluded from search by default and surfaced with `include_archived: true`; `ignore` leaves the indexed copy in place.
  - `metadata_mapping` object, nullable — Maps an S3 object tag/key to a Captain metadata field name.
  - `custom_metadata` object — Static metadata applied to every synced document.
  - `sync_interval_minutes` integer, nullable — Scheduled reconcile cadence. MINIMUM 5 minutes (the scheduler ticks every 5 min); values below 5 are silently raised to 5; >=5 honored exactly. null/omitted = manual (events + on-demand only). For sub-5-min propagation use the event webhook.

## Response `201`

Successful Response

- S3SyncConnectorResponseDocs
  - `sync_id` string
  - `collection_name` string
  - `bucket` string
  - `prefix` string
  - `region` string
  - `storage_type` 's3' | 'gcs' | 'r2' | 'supabase' | 'backblaze' — The sync's cloud storage type. Returned by the list endpoint (GET /v2/syncs) only; other sync endpoints omit this field.
  - `auth_method` 'iam_role' | 'access_key' | 'service_account' — How the sync authenticates to the bucket: 'iam_role' (AWS cross-account assume-role), 'access_key' (S3-compatible key pair), or 'service_account' (GCS service-account JSON).
  - `endpoint_url` string, nullable — S3-compatible endpoint URL (access-key syncs on non-AWS providers); null for AWS S3. Returned by the list endpoint (GET /v2/syncs) only; other sync endpoints omit this field.
  - `processing_type` 'advanced' | 'basic'
  - `include_patterns` string[]
  - `exclude_patterns` string[]
  - `deletion_policy` 'mirror' | 'archive' | 'ignore'
  - `status` 'active' | 'paused' | 'inactive'
  - `secret_set` boolean — True once an event-webhook secret has been minted.
  - `sns_subscribe_url` string, nullable — SNS subscribe URL; only surfaced by the subscribe-webhook endpoint.
  - `last_backfill_job_id` string, nullable
  - `last_reconcile_at` string, nullable
  - `sync_interval_minutes` integer, nullable — Effective (already-clamped) cadence; null = manual.
  - `next_sync_at` integer, nullable — Epoch ms of the next due scheduled reconcile.
  - `sync_state` 'idle' | 'running' | 'error'
  - `last_sync_at` integer, nullable
  - `last_sync_error` string, nullable
  - `created_at` string
  - `updated_at` string, nullable

---

[API](https://skmtc.dev/runcaptain/apis/api-reference.md) · [All operations](https://skmtc.dev/runcaptain/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/runcaptain/api-reference/revisions/aa3902536e0b/schema)
