Run MongoDB → MotherDuck migration
POST /migrate
Extracts data from MongoDB for the specified flocks and loads it into MotherDuck. Supports two modes:
- incremental (default): queries
MAX(last_updated)per collection/flock and only fetches records changed since then. Changed records are upserted (delete + re-insert by uid). - full: deletes all flock data and re-inserts everything from MongoDB. Use for initial loads or resets.
Default flocks: ["example", "sheepy-owners-club"].
Collections migrated (19): person, organisation, member, payment, message, membership_type, ticket_type, booking, ticket, attendee, activity, bank_account, badge, connection, evidence, pledge, grant, group, group_member.
Note: The HTTP API Gateway has a 30s timeout. For long-running
migrations, invoke the Lambda directly via aws lambda invoke.
Authorizations
Section titled “Authorizations ”Request Body
Section titled “Request Body ”object
List of flock bucket IDs to migrate.
Example
[ "example"]incremental syncs only records changed since the last run.
full deletes all flock data and re-inserts everything.
Specific collections to migrate. If omitted, all 19 collections are migrated.
Example
[ "person", "member"]If true, returns a cost summary without actually running the migration. Useful for estimating MotherDuck DU cost.
Examples
Incremental sync (default)
{ "flocks": [ "example" ]}Full reload
{ "flocks": [ "example" ], "mode": "full"}Sync only person and member
{ "flocks": [ "example" ], "collections": [ "person", "member" ]}Cost summary without migrating
{ "summary": true}All defaults (incremental, both flocks)
{}Responses
Section titled “ Responses ”Migration completed successfully
object
Example
successExample
incrementalExample
[ "example"]Row counts per collection per flock.
object
object
Example
{ "person": { "example": 1250 }, "organisation": { "example": 340 }}Total rows inserted across all tables and flocks.
Example
6770Example
{ "status": "success", "mode": "incremental", "flocks": [ "example" ], "totals": { "person": { "example": 1250 }, "organisation": { "example": 340 }, "member": { "example": 980 }, "payment": { "example": 4200 } }, "grand_total": 6770}Authentication required
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExample
{ "error": { "code": "unauthorized", "message": "Authentication required" }}Internal server error
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExample
{ "error": { "code": "schema_error", "message": "Schema application failed" }}