Skip to main content

Overview

The GET /files endpoint supports incremental data loading through timestamp-based filters. This enables efficient Change Data Capture (CDC) workflows for syncing to Snowflake, BigQuery, or other data warehouses.
Instead of fetching all files on every sync, use updatedAfter or createdAfter to retrieve only what’s changed since your last sync.

Timestamp Filters

updatedAfter

Filters files updated on or after the specified timestamp. GET /files?updatedAfter=2025-01-01T00:00:00.000Z

createdAfter

Filters files created on or after the specified timestamp. GET /files?createdAfter=2025-01-01T00:00:00.000Z

Timestamp Contract

All timestamps in the response (createdAt, updatedAt) are returned in UTC with millisecond precision.

Watermark Semantics

Inclusive Comparison (>=)

The updatedAfter and createdAfter filters use inclusive comparison. This means:
  • A file with updatedAt = 2025-01-01T12:00:00.000Z will be returned when querying with updatedAfter=2025-01-01T12:00:00.000Z

Deduplication Requirement

Because of inclusive comparison, clients may receive duplicate records across paginated requests or subsequent syncs. You must deduplicate using fileId + updatedAt.
Example deduplication in Snowflake:

Ordering & Pagination

Default Sort Order

When using updatedAfter for incremental loading, always sort by updatedAt in ascending order for reliable watermark tracking.

Pagination Parameters

The API uses offset-based pagination with page and limit parameters. Example request:

Pagination Stability Warning

Offset-based pagination may produce inconsistent results if records are updated during pagination. You may miss records or see duplicates.
Mitigation strategies:
  1. Use smaller time windows for updatedAfter
  2. Always deduplicate by fileId + updatedAt
  3. Re-sync periodically with a larger time window to catch missed records

What Triggers updatedAt?

The updatedAt timestamp changes when any of these events occur:

Delete Handling

Important: Deleted files are excluded from the GET /files response and do not appear in updatedAfter queries. This endpoint provides insert/update only — not full CDC.

Tracking Deletions

If you need to detect deleted files:
1

Option A: Periodic Full Sync

Do a full sync periodically and compare with your existing data to detect missing records.
2

Option B: Deletion Events Endpoint

Contact the fileAI team about a dedicated deletion events endpoint (roadmap item).

Best Practices

After each successful sync, store the maximum updatedAt value from the batch:
Paginate through all pages before updating your watermark:
Always deduplicate records by fileId + updatedAt before inserting into your data warehouse.
Run full syncs (e.g., weekly) to:
  • Catch any records missed due to pagination issues
  • Detect deleted records by comparing with existing data

Snowflake Integration Example


Response Schema


Quick Reference


Need Help?

Contact Support

Reach out to the fileAI engineering team for questions about CDC implementation or to request new features.