/ API / Endpoints
Docs/API/Endpoints

Endpoints

All paths are relative to https://nosqlsync.com/engine and require an API key.

Connections

GET/connections

List saved connections. Credentials are never returned — each item has id, name, type, dbType and endpoint (host).

POST/connections

Save a connection. Admin only. Supports Idempotency-Key.

POST/connections/test

Test credentials without saving them. Body: { dbType, credentials }. Returns { ok, latencyMs } or { ok: false, message }.

PATCH/connections/:id

Rename a connection or replace its credentials. Body: { name?, credentials? }. Admin only.

DELETE/connections/:id

Delete a connection. Admin only.

POST/connections/:id/test

Re-test a saved connection.

GET/connections/:id/databases

List databases (or schemas, for PostgreSQL) on a source.

GET/connections/:id/collections

List collections or tables in a database. Query: ?database=.

POST /connections
{
  "name": "Production Mongo",
  "type": "source",              // "source" | "target"
  "dbType": "mongodb",           // see Sources and Targets for valid values
  "credentials": { "uri": "mongodb+srv://…" }
}

Valid dbType values: mongodb, dynamodb, firestore, cosmosdb, cassandra, couchbase, postgresql, mysql, mariadb, mssql, redshift, bigquery, snowflake, clickhouse. Credential fields for each are on the Sources and Targets pages.

Migrations

GET/migrations

List migrations, newest first, as { migrations: [...] }.

POST/migrations

Create a migration. Returns { id, name, status: "created" }. Supports Idempotency-Key.

GET/migrations/:id

Get a migration with its status, progress, record counts, last error and latest validation.

PATCH/migrations/:id

Update driftPolicy or lagAlertThresholdMs. Admin only.

DELETE/migrations/:id

Delete a migration. It must be stopped first (409 otherwise). Tables already written to the target are not dropped. Admin only.

POST /migrations
{
  "name": "orders → postgres",
  "sourceConnectionId": "3f1c…",
  "targetConnectionId": "a92d…",
  "sourceDatabase": "shop",
  "sourceCollection": "orders",
  "targetTable": "orders",
  "mode": "one-time",              // "one-time" | "cdc" | "dual-write"
  "driftPolicy": "add_column",     // optional: "add_column" | "ignore" | "alert_and_pause"
  "groupId": "…", "groupName": "…" // optional: group related migrations together
}

Actions

EndpointEffect
POST /migrations/:id/startQueue the migration. Requires a schema mapping. 409 if already active, 402 if over a plan limit.
POST /migrations/:id/pausePause a running or queued live sync.
POST /migrations/:id/resumeResume a paused live sync.
POST /migrations/:id/stopCancel the job and set status to stopped.
POST /migrations/:id/cutoverDual-write only, admin only. See Cutover.
POST /migrations/:id/validateRun a validation and return the report. See Validation.

Schema

GET/migrations/:id/schema

Get the current schema mapping.

POST/migrations/:id/schema/introspect

Sample the source and propose a mapping. Optional body: { nestedDecisions: { "<path>": "flatten" | "jsonb" | "child-table" } }.

PUT/migrations/:id/schema

Save a mapping. Body: { mappings: [{ sourceField, targetColumn, sqlType, nullable, isPrimaryKey }] }. See Schema mapping.

Monitoring

GET/migrations/:id/logs

Server-Sent Events stream of log lines.

GET/migrations/:id/metrics

Throughput and, for live sync, replication lag.

GET/migrations/:id/drift

Schema drift events. See Schema drift.

GET/migrations/:id/validation-runs

All validation runs for the migration.

GET/live-sync/metrics

Lag and throughput for every live sync in the workspace.

GET/events

Server-Sent Events stream of status and progress changes for the whole workspace. Supports Last-Event-ID.

Validation runs

GET/validation-runs/:runId/export

Download a report. Query: ?format=md (default) or ?format=json.

POST/validation-runs/:runId/share

Create a public read-only link. Returns { sharePath: "/reports/…" }. Admin only.

DELETE/validation-runs/:runId/share

Revoke the public link. Admin only.

Webhooks

GET/webhooks

List webhook endpoints.

POST/webhooks

Create an endpoint. Body: { url, events: ["migration.completed", …] }. Returns the signing secret once.

POST/webhooks/:id/secret

Rotate the signing secret. The new secret is returned once.

POST/webhooks/:id/test

Send a test event to the endpoint.

DELETE/webhooks/:id

Delete an endpoint.

API keys

GET/api-keys

List your keys (prefix, scope, environment, last used).

POST/api-keys

Create a key. Body: { name, scope?: "read" | "write" | "admin", env?: "Production" | "Staging" }. The raw key is returned once.

DELETE/api-keys/:id

Revoke a key immediately.

Team and workspace

GET/team

List members and pending invites.

POST/team

Invite someone. Body: { email, role: "admin" | "member" }. Admin only.

PATCH/team/:id

Change a member's role. Owner only.

DELETE/team/:id

Remove a member or cancel an invite. Admin only.

GET/audit-logs

Audit events, newest first. Admin only; requires the Team plan or above.

GET/user

The authenticated user.