API Reference
Database API
Manage CDC mappings, versions, promotions, and database subscriptions.
The Database API manages domain mappings (table-to-topic configurations), mapping versions, environment promotion, and database subscriptions.
Mappings
List Mappings
GET /api/database/mappingsReturns all mappings scoped to the current application and environment.
Get Mapping
GET /api/database/mappings/:idCreate Mapping
POST /api/database/mappingsRequest Body:
{
"table": "sessions",
"topic": "session.status",
"events": ["insert", "update"],
"triggerColumns": ["status", "ended_at"],
"payload": {
"sessionId": "$row.id",
"status": "$row.status",
"endedAt": "$row.ended_at"
},
"when": {
"or": [
{ "changed": "status" },
{ "changed": "ended_at" }
]
},
"environment": "development"
}Update Mapping
PATCH /api/database/mappings/:idDelete Mapping
DELETE /api/database/mappings/:idGet Mappings by Topic
GET /api/database/mappings/topic/:topicEnvironment Status
GET /api/database/mappings/statusReturns the promotion status of all mappings across environments. Used by the Environment Grid UI.
Response:
[
{
"id": "map_123",
"table": "sessions",
"topic": "session.status",
"environments": {
"development": { "version": 3, "active": true },
"staging": { "version": 2, "active": true },
"production": { "version": 1, "active": true }
}
}
]Versions
List Versions
GET /api/database/mappings/:id/versionsCreate Version Snapshot
POST /api/database/mappings/:id/versionsRequest Body:
{
"environment": "development"
}Promote Mapping
POST /api/database/mappings/:id/promoteCopies the source environment's latest version into the next environment (dev → staging, staging → prod).
Request Body:
{
"environment": "staging"
}Subscriptions
List Subscriptions
GET /api/database/subscriptionsCreate Subscription
POST /api/database/subscriptionsRequest Body:
{
"mappingId": "map_123"
}Activate / Deactivate
POST /api/database/subscriptions/:id/activate
POST /api/database/subscriptions/:id/deactivateDelivery Logs
GET /api/database/subscriptions/logs?event=database.update