Skip to content

Connection API Reference

This guide provides a complete reference for the DBConvert Streams Connection API endpoints. For practical implementation examples in different programming languages (curl, Python, Node.js, PowerShell), see our Programming Examples Guide.

Prerequisites

  • A valid DBConvert Streams API key
  • The API server running (default: http://127.0.0.1:8020/api/v1)
  • Basic understanding of REST APIs and JSON

Important

Before using any connection or stream endpoints, you must first call the /user/configs endpoint to load existing configurations:

bash
curl -X GET "http://127.0.0.1:8020/api/v1/user/configs" \
  -H "X-API-Key: your_api_key_here"

This endpoint loads all user configurations including existing connections and stream configurations. Make sure to call this endpoint:

  • When starting your application
  • Before listing or managing connections
  • Before creating or managing streams

API Endpoints Overview

EndpointMethodDescription
/connectionsGETList all connections
/connectionsPOSTCreate a new connection
/connections/{id}GETGet connection details
/connections/{id}PUTUpdate a connection
/connections/{id}DELETEDelete a connection
/connections/{id}/pingPOSTTest a connection
/connections/{id}/clonePUTClone a connection
/connections/{id}/databasesGETList available databases
/connections/{id}/schemasPOSTCreate a new schema (PostgreSQL only)
/connections/{id}/tablesGETList tables in database

Authentication

All API requests require authentication using your API key. Include it in the request header:

bash
X-API-Key: your_api_key_here

Endpoint Details

Create Connection

POST /connections

Creates a new database connection.

Required Fields

  • name: A unique name for your connection
  • type: Database type (mysql or postgresql)
  • host: Database server hostname or IP
  • port: Database server port
  • username: Database user
  • password: Database password
  • database: Database name

Optional Fields

  • schema: Database schema (PostgreSQL only)

Response

json
{
  "id": "conn_2sZyDMeIbdaXnN9OL7vYzzAiZU5",
  "name": "mysql-source",
  "type": "mysql",
  "host": "localhost",
  "port": 3306,
  "username": "root",
  "database": "source_db"
}

Test Connection

POST /connections/{connection_id}/ping

Tests if a connection is working properly.

Response - Success

json
{
  "ping": "ok"
}

Response - Failure

json
{
  "ping": "failed",
  "error": "Connection refused"
}

List Connections

GET /connections

Returns an array of all configured connections.

Response

json
[
  {
    "id": "conn_2sZyDMeIbdaXnN9OL7vYzzAiZU5",
    "name": "mysql-source",
    "type": "mysql",
    "host": "localhost",
    "port": 3306
  }
]

Get Connection Details

GET /connections/{connection_id}

Returns detailed information about a specific connection.

Update Connection

PUT /connections/{connection_id}

Updates an existing connection. Requires all fields to be provided, even if only some are being changed.

Delete Connection

DELETE /connections/{connection_id}

Removes a connection. Returns 204 on success.

Clone Connection

PUT /connections/{connection_id}/clone

Creates a copy of an existing connection with a new ID.

Response

json
{
  "id": "conn_2sZyDMeIbdaXnN9OL7vYzzAiZU5",
  "created": 1738677334
}

List Databases

GET /connections/{connection_id}/databases

Lists all available databases for a connection.

Response (MySQL)

json
[
  {
    "name": "source_db"
  },
  {
    "name": "new_db"
  }
]

Response (PostgreSQL)

json
[
  {
    "name": "postgres",
    "schemas": ["public", "custom_schema"]
  }
]

Create Schema

POST /connections/{connection_id}/schemas?database=database_name

Creates a new schema in a PostgreSQL database.

Request Body

json
"new_schema_name"

List Tables

GET /connections/{connection_id}/tables

Lists all tables in the configured database.

Response

json
[
  "users",
  "products",
  "orders"
]

Error Handling

The API uses standard HTTP status codes and returns error details in the response body:

json
{
  "error": "Error message description"
}

Common status codes:

  • 400: Invalid request
  • 401: Invalid or missing API key
  • 404: Resource not found
  • 503: Service unavailable (e.g., failed connection test)

See Also

DBConvert Streams - event driven replication for databases