How Can I Create a Destination Using the REST API?
Question
How can I create a destination using the API?
Environment
REST API
Answer
Use the Create a Destination endpoint after creating or identifying a group. See step 2 of the REST API quickstart for the group setup flow.
Prerequisite: complete the destination's setup guide first
The REST API only registers a destination, so you must complete the cloud-side setup first. Before calling POST /v1/destinations, create users, roles, warehouses, and databases, and configure permissions or authentication credentials in your warehouse. Each destination's setup guide lists the required setup:
Once the cloud-side setup is complete, call the API using the configured destination credentials.
Destination-specific auth fields
Some destinations use an explicit auth method field that determines which credential fields are required. For example, auth for Snowflake or auth_type for Redshift. Sending fields that belong to a different auth method results in an HTTP 400 Bad Request error. Other destinations, such as Databricks and BigQuery, imply the auth method from whichever credential fields you provide.
The following Snowflake examples illustrate this pattern. The auth field accepts PASSWORD or KEY_PAIR. Sending both, or using an invalid value such as PRIVATE_KEY, causes an HTTP 400 error.
Required fields by auth method: Snowflake
| Field | PASSWORD | KEY_PAIR | Notes |
|---|---|---|---|
host | required | required | Format: your-account.snowflakecomputing.com |
port | required | required | |
database | required | required | |
user | required | required | |
auth | "PASSWORD" | "KEY_PAIR" | Required; no other values are accepted |
password | required | omit | Sending password with KEY_PAIR returns 400 |
private_key | omit | required | PEM-formatted RSA private key |
is_private_key_encrypted | omit | required | true or false |
passphrase | omit | if key encrypted | Required only when is_private_key_encrypted: true |
role | recommended | recommended | Omitting uses the user's default role, which may lack the permissions Fivetran requires |
default_virtual_warehouse | recommended | recommended | Omitting uses the user's default warehouse, which may cause permission errors |
Example: PASSWORD auth
curl -X POST "https://api.fivetran.com/v1/destinations" \
-u "$FIVETRAN_API_KEY:$FIVETRAN_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"group_id": "YOUR_GROUP_ID",
"service": "snowflake",
"region": "GCP_US_EAST4",
"time_zone_offset": "-5",
"config": {
"host": "your-account.snowflakecomputing.com",
"port": 443,
"database": "FIVETRAN",
"auth": "PASSWORD",
"user": "FIVETRAN_USER",
"password": "YOUR_SNOWFLAKE_PASSWORD",
"role": "FIVETRAN_ROLE",
"default_virtual_warehouse": "FIVETRAN_WAREHOUSE"
}
}'
Example: KEY_PAIR auth
curl -X POST "https://api.fivetran.com/v1/destinations" \
-u "$FIVETRAN_API_KEY:$FIVETRAN_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"group_id": "YOUR_GROUP_ID",
"service": "snowflake",
"region": "GCP_US_EAST4",
"time_zone_offset": "-5",
"config": {
"host": "your-account.snowflakecomputing.com",
"port": 443,
"database": "FIVETRAN",
"auth": "KEY_PAIR",
"user": "FIVETRAN_USER",
"private_key": "-----BEGIN PRIVATE KEY-----\nYOUR_KEY_CONTENT\n-----END PRIVATE KEY-----",
"is_private_key_encrypted": false,
"role": "FIVETRAN_ROLE",
"default_virtual_warehouse": "FIVETRAN_WAREHOUSE"
}
}'
If your private key has a passphrase, set "is_private_key_encrypted": true and add "passphrase": "YOUR_PASSPHRASE".
A failed POST /v1/destinations leaves no partial resource. Correct the request body and retry.
Other destinations follow the same pattern
Many destination types have an auth or connection method enum with mutually exclusive field sets, but some infer the method from the credential fields you provide. Before constructing the payload, see the destination's setup guide and the Create a Destination API reference for the exact field names and accepted values.