Create GCS Sync

Create a Google Cloud Storage Sync for a collection and start the initial backfill. GCS authenticates with a service-account JSON (stored in Secrets Manager, never returned), so there is no region, endpoint_url, or access-key pair. Returns the sync; indexing runs asynchronously.

Path parameters

collection_namestringRequired
Destination collection.

Headers

authorizationstring or nullOptional

Bearer {api_key}. Your Captain API key.

Request

This endpoint expects an object.
bucketstringRequired
GCS bucket to keep in sync with the collection.
service_account_jsonstringRequired

Google service-account key JSON (type=‘service_account’) with read access to the bucket (roles/storage.objectViewer). Stored securely in Secrets Manager, never returned.

processing_typeenumRequired

Parsing tier. ‘advanced’ = full document understanding; ‘basic’ = faster/cheaper.

prefixstringOptionalDefaults to

Object-name prefix to scope the sync (e.g. ‘docs/2024/’). Empty syncs the whole bucket.

include_patternslist of stringsOptional

Glob patterns; only matching object names are synced.

exclude_patternslist of stringsOptional

Glob patterns; matching object names are excluded.

deletion_policyenumOptionalDefaults to mirror

How to propagate objects deleted from GCS: ‘mirror’ removes them from the collection (soft-delete), ‘ignore’ leaves the collection untouched. ‘archive’ is accepted but currently behaves like ‘mirror’ (documents are soft-deleted; a separate archived flag is planned).

metadata_mappingmap from strings to strings or nullOptional
Maps a GCS object metadata key to a Captain metadata field name.
custom_metadataobject or nullOptional
Static metadata applied to every synced document.
sync_interval_minutesinteger or nullOptional

Scheduled reconcile cadence in minutes (minimum 5; below 5 clamps to 5; null = manual).

Response

Successful Response
sync_idstringOptional
collection_namestringOptional
bucketstringOptional
prefixstringOptional
regionstringOptional
storage_typeenumOptional

The sync’s cloud storage type. Returned by the list endpoint (GET /v2/syncs) only; other sync endpoints omit this field.

auth_methodenumOptional

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_urlstring or nullOptional

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_typeenumOptional
include_patternslist of stringsOptional
exclude_patternslist of stringsOptional
deletion_policyenumOptional
statusenumOptional
secret_setbooleanOptional

True once an event-webhook secret has been minted.

sns_subscribe_urlstring or nullOptional

SNS subscribe URL; only surfaced by the subscribe-webhook endpoint.

last_backfill_job_idstring or nullOptional
last_reconcile_atstring or nullOptional
sync_interval_minutesinteger or nullOptional

Effective (already-clamped) cadence; null = manual.

next_sync_atinteger or nullOptional
Epoch ms of the next due scheduled reconcile.
sync_stateenum or nullOptional
last_sync_atinteger or nullOptional
last_sync_errorstring or nullOptional
created_atstringOptional
updated_atstring or nullOptional
© 2026 Captain