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

# Update a data source

`PATCH /api/public/organizations/{orgId}/data-sources/{id}`

## Request

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

Updates an existing data source connection settings. Requires admin access to the organization. Secrets you leave out keep their saved values, except where the change would send them somewhere new: changing `host`, `port`, `username`, `snowflakeAccountId`, an Oracle data source's `databaseName` (its service name) or the SSH tunnel (`sshEnabled`, `sshHost`, `sshPort`) requires `password` again when one is saved, and turning the SSH tunnel on or changing its `sshHost`, `sshPort` or `sshUsername` requires `sshPassword` again when one is saved. Without it the request fails with a 400 `ValidationError`.

## Path parameters

- `orgId` string, required: Organization ID
- `id` string, required: Data source 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
  - `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, nullable: SSH tunnel password
  - `sshPrivateKey` string, nullable: SSH private key
  - `sshPrivateKeyPassphrase` string, nullable: SSH private key passphrase
  - `maxPoolSize` integer, nullable: Maximum number of connections in the pool per container
  - `unsetPassword` boolean, nullable
  - `password` string, nullable: Database password
  - `unsetSshPassword` boolean, nullable
  - `unsetSshPrivateKey` boolean, nullable
  - `unsetSshPrivateKeyPassphrase` boolean, nullable
  - `bigQueryJsonKey` string, nullable: BigQuery JSON key

## Response `200`

Data source updated 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 or validation error
- `401`: Unauthorized - Missing or invalid API key
- `404`: Not found - Data source 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)
