Skip to main content

Connection APIs

These APIs are in beta

The connection APIs are in beta and may have future breaking changes.

The connection APIs allow you to programmatically create and manage database connections in your Omni instance.

Create a connection

Creates a new database connection.

POST /api/unstable/connections
curl -X POST 'https://myorg.omniapp.co/api/unstable/connections' \
--H 'Authorization: Bearer <TOKEN>' \
--H 'Content-Type: application/json' \
--d '{
"dialect": "bigquery",
"name": "My BigQuery Connection",
"region": "us",
"passwordUnencrypted": "<SERVICE_ACCOUNT_JSON_FILE>",
"defaultSchema": "my_dataset",
"includeSchemas": "dataset1,dataset2",
"includeOtherCatalogs": "other_project1,other_project2",
"maxBillingBytes": "1000000000"
}'

Note: For BigQuery, you must include a service account JSON file encoded as a string in the passwordUnencrypted field.

Parameters

ParameterTypeRequiredDefaultDescription
dialectstringYes -

The database dialect. Must be one of:

  • bigquery - Google BigQuery
  • mysql - MySQL
  • postgres - PostgreSQL
  • redshift - Amazon Redshift
  • snowflake - Snowflake
  • motherduck - MotherDuck
  • mssql - Microsoft SQL Server
  • databricks - Databricks
  • clickhouse - ClickHouse
  • trino - Trino
  • athena - Amazon Athena
  • exasol - Exasol
  • starrocks - StarRocks
namestringYes -A descriptive name for the connection.
hoststringYes* -

The hostname or IP address of the database server.

  • Not required for MotherDuck
  • For Snowflake, provide only the account identifier (e.g., myaccount not myaccount.snowflakecomputing.com)
  • For BigQuery, this is automatically determined from the service account
portnumberYes* Varies by dialect

The port number for the database connection.

Not required for Snowflake, MotherDuck, BigQuery, Databricks, and Athena.

databasestringYes -

The default database/catalog to connect to.

  • For BigQuery, this is the project ID
  • For Athena, this is the data catalog
usernamestringYes* -

The username to authenticate with.

  • Not required for MotherDuck
  • For BigQuery, this is the client email from the service account
passwordUnencryptedstringYes* -

The password to authenticate with.

  • For BigQuery, this must be the JSON service account key file content.
  • For Snowflake with keypair authentication, this can be omitted.
includeSchemasstringNo X""Comma-separated list of schemas to include. Leave empty to include all schemas.
includeOtherCatalogsstringNo X""Comma-separated list of other catalogs/databases to include. Only applicable for databases that support multi-catalog queries: BigQuery, Snowflake, MotherDuck, Databricks, Trino, Athena.
warehousestringYes* -

Required for:

  • Snowflake - Specify the warehouse
  • Databricks - Specify the HTTP path
defaultSchemastringNo X-The default schema to use. Required for MSSQL.
queryTimeoutSecondsnumberNo X900The timeout in seconds for queries. Maximum value is 3600 (1 hour). Only applicable for databases that support query timeouts.
trustServerCertificatebooleanNo XfalseWhether to trust the server certificate. Only applicable for MSSQL, Exasol, and ClickHouse.
regionstringYes* "us" for BigQuery,
"us-east-1" for Athena

Required for BigQuery and Athena connections.

  • For BigQuery, specify a region like "us"
  • For Athena, specify an AWS region like "us-east-1"
maxBillingBytesstringNo XnullOnly applicable for BigQuery. Maximum bytes that can be billed for a BigQuery query.
scratchSchemastringNo XnullSchema to use for data input (upload) tables. If not specified, a suitable default will be chosen.
systemTimezonestringNo XUTCThe timezone to use for the system.
queryTimezonestringNo X"NONE"The timezone to use for queries.
allowsUserSpecificTimezonesbooleanNo XfalseWhether to allow users to specify their own timezones.

Database-specific requirements

BigQuery
tip

Refer to the BigQuery setup guide for help retrieving the required information.

The following is required when creating a BigQuery connection:

  • A service account JSON key file in the passwordUnencrypted field. The service account file must be a valid JSON document with the following structure:

    {
    "type": "service_account",
    "project_id": "your-project-id",
    "private_key_id": "key-id",
    "private_key": "-----BEGIN PRIVATE KEY-----\nkey-content\n-----END PRIVATE KEY-----\n",
    "client_email": "service-account-email@your-project-id.iam.gserviceaccount.com",
    "client_id": "client-id",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account-email%40your-project-id.iam.gserviceaccount.com"
    }
  • A region (defaults to "us")

You can also optionally set a maxBillingBytes limit.

Databricks
tip

Refer to the Databricks setup guide for help retrieving the required information.

To create a Databricks connection, specify the warehouse field with the HTTP path value.

Additionally:

  • port is not required
  • Set useMachineAuth to true for machine-based authentication
MotherDuck
tip

Refer to the MotherDuck setup guide for help retrieving the required information.

To create a MotherDuck connection, the passwordUnencrypted field should contain your MotherDuck token. The host, port, and username fields aren't required.

Snowflake
tip

Refer to the Snowflake setup guide for help retrieving the required information.

The following is required when creating a Snowflake connection:

  • Your account identifier in the host field. This should be a value like myorg, not myorg.snowflakecomputing.com
  • A warehouse

A port isn't required.

Response

201 Created

Successful requests will return a 201 Created status and a response body similar to the following:

{
"success": true,
"data": "c0f12353-4817-4398-bcc0-d501e6dd2f64"
}
FieldTypeDescription
successbooleanIndicates if the connection was created successfully
datastringThe UUID of the newly created connection
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
IssueError detail
Invalid JSONBad Request: Invalid JSON
Invalid dialectInvalid connection dialect
Invalid methodInvalid method
Missing required fieldsBad Request: <field>: Required
Invalid Snowflake hostBad Request: host: Please only include your Snowflake account identifier
403 Forbidden
{
"detail": "Permission denied",
"status": 403
}
IssueError detail
Insufficient permissionsPermission denied
429 Too Many Requests

Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.

Update a connection

Updates properties of an existing connection.

PATCH /api/unstable/connections/:connectionId
curl -X PATCH 'https://myorg.omniapp.co/api/unstable/connections/c0f12353-4817-4398-bcc0-d501e6dd2f64' \
--H 'Authorization: Bearer <TOKEN>' \
--H 'Content-Type: application/json' \
--d '{
"userAttributeNameForConnectionEnvironments": "environment",
"userAttributeValuesForDefaultEnvironment": "dev,prod"
}'

Parameters

ParameterTypeRequiredDefaultDescription
connectionIdURL parameterYes -The UUID of the connection to update.
userAttributeNameForConnectionEnvironmentsstring | nullYes -

The name of the user attribute to use for connection environments.

To remove the attribute, set to null.

userAttributeValuesForDefaultEnvironmentstring | nullYes -

A comma-separated list of user attribute values that will be associated with the default connection environment. For example: "dev,prod,staging"

To remove the attribute values, set to null.

Response

200 OK

Successful requests will return a 200 OK status and a response body similar to the following:

{
"success": true,
"message": "Updated dynamic user attribute settings."
}

If user attribute settings were removed:

{
"success": true,
"message": "Removed dynamic user attribute settings."
}
FieldTypeDescription
successbooleanIndicates if the connection was updated successfully
messagestringA message describing the action taken
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
IssueError detail
Invalid JSONBad Request: Invalid JSON
Invalid methodInvalid method
Missing userAttributeNameForConnectionEnvironmentsBad Request: userAttributeNameForConnectionEnvironments: Invalid input
Missing userAttributeValuesForDefaultEnvironmentBad Request: userAttributeValuesForDefaultEnvironment: Invalid input
Both parameters missingBad Request: userAttributeNameForConnectionEnvironments: Invalid input, userAttributeValuesForDefaultEnvironment: Invalid input
User attribute already in useUser attribute value "value" is already in use
403 Forbidden
{
"detail": "Permission denied",
"status": 403
}
IssueError detail
Insufficient permissionsPermission denied
429 Too Many Requests

Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.

List connections

Retrieves a list of database connections with optional filtering and sorting.

GET /api/unstable/connections
curl -X GET 'https://myorg.omniapp.co/api/unstable/connections' \
--H 'Authorization: Bearer <TOKEN>' \
--H 'Content-Type: application/json'

Parameters

Note: All parameters must be provided as query parameters.

ParameterTypeRequiredDefaultDescription
namestringNo X-

Filter connections by name (case-insensitive, partial matching).

databasestringNo X-

Filter connections by database name (case-insensitive, partial matching).

dialectstringNo X-

Filter connections by dialect(s). For multiple dialects, provide a comma-separated list (e.g., postgres,mysql). Valid values: athena, bigquery, clickhouse, databricks, exasol, motherduck, mssql, mysql, postgres, redshift, snowflake, starrocks, trino

includeDeletedbooleanNo Xfalse

When set to true, includes connections that have been deleted. Default is false, which returns only active connections.

sortFieldstringNo Xname

Field to sort connections by. Valid values:

  • name - Sort by connection name
  • dialect - Sort by database dialect
  • database - Sort by database name
sortDirectionstringNo Xdesc

Direction for sorting. Valid values:

  • asc - Ascending order (A-Z, 0-9)
  • desc - Descending order (Z-A, 9-0)

Response

200 OK

Successful requests will return a 200 OK status and a response body similar to the following:

{
"connections": [
{
"id": "c0f12353-4817-4398-bcc0-d501e6dd2f64",
"name": "Production Database",
"dialect": "postgres",
"database": "prod_db",
"deletedAt": null,
"userAttributeNameForConnectionEnvironments": "environment",
"userAttributeValuesForDefaultEnvironment": ["prod"],
"branchConnectionEnvironmentOverridesUserAttr": false,
"environmentConnectionSwitchesSchemaModel": false
},
{
"id": "789e0123-e45b-67d8-a456-426614174000",
"name": "Development Database",
"dialect": "mysql",
"database": "dev_db",
"deletedAt": null,
"userAttributeNameForConnectionEnvironments": null,
"userAttributeValuesForDefaultEnvironment": null,
"branchConnectionEnvironmentOverridesUserAttr": false,
"environmentConnectionSwitchesSchemaModel": false
}
]
}
FieldTypeDescription
connectionsarrayArray of connection objects
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
IssueError detail
Invalid or unrecognized query parameterBad Request: formErrors: Unrecognized key(s) in object: '<invalidParam>'
Invalid sort fieldBad Request: sortField: Invalid enum value. Expected 'database' | 'dialect' | 'name', received '<invalidField>'
Invalid dialect valueInvalid dialect(s): <invalidDialect>
429 Too Many Requests

Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.