---
title: "Create a data source"
method: POST
path: "/api/public/organizations/{orgId}/data-sources"
tags: ["Data Sources"]
---

# Create a data source

`POST /api/public/organizations/{orgId}/data-sources`

## Request

- Base URL: `https://charts.basedash.com`
- URL: `https://charts.basedash.com/api/public/organizations/{orgId}/data-sources`
- Auth: HTTP bearer

Creates a new data source connection for an organization. Requires admin access to the organization. Currently only direct database connections are supported.

## Path parameters

- `orgId` string, required: Organization ID

## Request body

- object
  - `snowflakeAccountId` string: Snowflake account ID
  - `snowflakeWarehouse` string: Snowflake warehouse
  - `snowflakeRole` string: Snowflake role
  - `snowflakePrivateKey` string: Snowflake private key
  - `snowflakePrivateKeyPassphrase` string: Snowflake private key passphrase
  - `databaseName` string, nullable: Database name
  - `username` string: Database username
  - `host` string: Database host
  - `port` integer: Database port
  - `password` string: Database password
  - `bigQueryJsonKey` string: BigQuery JSON key
  - `bigQueryProjectId` string: BigQuery project ID
  - `spannerInstanceId` string: Spanner instance ID
  - `athenaWorkgroup` string: Athena workgroup
  - `athenaOutputLocation` string: Athena output location (s3://...)
  - `athenaCatalog` string: Athena catalog
  - `sslEnabled` boolean: Enable SSL connection
  - `sslVerifyServerCertificate` boolean: Verify the server's TLS certificate when SSL is on
  - `sslCaCertificate` string, nullable: PEM CA certificate to trust for the server certificate
  - `sshEnabled` boolean: Enable SSH tunnel
  - `sshHost` string: SSH tunnel host
  - `sshPort` integer: SSH tunnel port
  - `sshUsername` string: SSH tunnel username
  - `sshPassword` string: SSH tunnel password
  - `sshPrivateKey` string: SSH private key
  - `sshPrivateKeyPassphrase` string: SSH private key passphrase
  - `maxPoolSize` integer: Maximum number of connections in the pool per container
  - `type` 'direct', required: Connection type (currently only direct)
  - `dialect` union, required: Database dialect/type
    - 'ELASTICSEARCH'
    - 'POSTGRES'
    - 'SUPABASE'
    - 'MYSQL'
    - 'PLANETSCALE'
    - 'ATHENA'
    - 'BIGQUERY'
    - 'CLICKHOUSE'
    - 'SPANNER'
    - 'SNOWFLAKE'
    - 'REDSHIFT'
    - 'SQL_SERVER'
    - 'ORACLE'
    - 'DATABRICKS'
    - 'POSTHOG'
    - 'DUCKDB'
    - 'MOTHERDUCK'
  - `displayName` string, required: Display name for the data source

## Response `201`

Data source created successfully

- object
  - `data` object, required
    - `id` string, required: Data source ID
    - `displayName` string, required: Display name for the data source
    - `description` string, required: Description of the data source
    - `dialect` union, required: Database dialect/type
      - 'ELASTICSEARCH'
      - 'POSTGRES'
      - 'SUPABASE'
      - 'MYSQL'
      - 'PLANETSCALE'
      - 'ATHENA'
      - 'BIGQUERY'
      - 'CLICKHOUSE'
      - 'SPANNER'
      - 'SNOWFLAKE'
      - 'REDSHIFT'
      - 'SQL_SERVER'
      - 'ORACLE'
      - 'DATABRICKS'
      - 'POSTHOG'
      - 'DUCKDB'
      - 'MOTHERDUCK'
    - `databaseName` string, nullable, required: Database name
    - `username` string, nullable, required: Database username
    - `host` string, nullable, required: Database host
    - `port` number, nullable, required: Database port
    - `sslEnabled` boolean, nullable, required: Whether SSL is enabled
    - `sslCustomCertificatesEnabled` boolean, nullable, required: Whether custom SSL certificates are enabled
    - `sslVerifyServerCertificate` boolean, nullable, required: Whether the server's TLS certificate is verified when SSL is on. Null for data sources created before this setting, which don't verify
    - `sshEnabled` boolean, nullable, required: Whether SSH tunnel is enabled
    - `sshHost` string, nullable, required: SSH tunnel host
    - `sshPort` number, nullable, required: SSH tunnel port
    - `sshUsername` string, nullable, required: SSH tunnel username
    - `bigQueryProjectId` string, nullable, required: BigQuery project ID
    - `spannerInstanceId` string, nullable, required: Spanner instance ID
    - `athenaWorkgroup` string, nullable, required: Athena workgroup
    - `athenaOutputLocation` string, nullable, required: Athena output location
    - `athenaCatalog` string, nullable, required: Athena data catalog
    - `snowflakeAccountId` string, nullable, required: Snowflake account ID
    - `snowflakeWarehouse` string, nullable, required: Snowflake warehouse
    - `snowflakeRole` string, nullable, required: Snowflake role
    - `lastSuccessfulSyncAt` string, date-time, nullable, required: Last successful schema sync timestamp
    - `lastSyncStatus` union, required: Status of the last schema sync
      - 'PENDING'
      - 'SUCCESS'
      - 'FAILED'
      - 'NEVER_SYNCED'
    - `lastSyncAttemptAt` string, date-time, nullable, required: Last schema sync attempt timestamp
    - `hasCompletedFirstSync` boolean, required: Whether the first schema sync has completed
    - `syncErrorMessage` string, nullable, required: Error message from the last failed sync
    - `lastHealthyAt` string, date-time, required: Last time the connection was healthy
    - `lastHealthStatus` union, required: Connection health status
      - 'HEALTHY'
      - 'UNHEALTHY'
    - `lastHealthCheckAttemptAt` string, date-time, required: Last health check attempt timestamp
    - `isDemo` boolean, required: Whether this is a demo data source
    - `isBasedashWarehouse` boolean, required: Whether this is a Basedash-managed warehouse
    - `createdAt` string, date-time, required: Creation timestamp
    - `updatedAt` string, date-time, required: Last update timestamp

## Other responses

- `400`: Bad request - Invalid JSON body, validation error, or unsupported type
- `401`: Unauthorized - Missing or invalid API key
- `404`: Not found - Organization not found or no admin access
- `429`: Rate limit exceeded - Too many requests
- `500`: Internal server error

---

[API](https://skmtc.dev/basedash/apis/basedash-public-api.md) - [All operations](https://skmtc.dev/basedash/apis/basedash-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/basedash/apis/basedash-public-api/revisions/efb9d40bc6f7?raw)
