How to Manage Dev and Prod Environments via API
Use this tutorial to create a dev and prod group pair, provision a destination for each group, deploy the same connection configuration to both, and set different sync frequencies to control cost and cadence.
Prerequisites
- You have a scoped API key and secret.
- You know the destination
servicetype you want to use, for example,snowflakeorbigquery. - You know the connection
serviceyou want to deploy, for example,salesforceorpostgres_rds. - You have
jqinstalled.
Instructions
- Set your environment variables.
- Create a dev group and a prod group.
- Create a destination for each group.
- Deploy the same connection to both groups.
- Set different sync frequencies.
- Review the dev and prod pattern.
Set your environment variables
export FIVETRAN_API_KEY="<your_api_key>"
export FIVETRAN_API_SECRET="<your_api_secret>"
export FIVETRAN_BASE_URL="https://api.fivetran.com/v1"
export FIVETRAN_AUTH_HEADER=$(printf "%s" "$FIVETRAN_API_KEY:$FIVETRAN_API_SECRET" | base64 | tr -d '\n')
# The destination service to use for both groups.
export DESTINATION_SERVICE="<your_destination_service>"
# Example: snowflake
# The connection service to deploy to both groups.
export CONNECTION_SERVICE="<your_connection_service>"
# Example: salesforce
Create dev and prod groups
Use the Create a Group endpoint twice to create separate groups for dev and prod.
Group names must be unique within your account. Choose names that clearly identify the environment, such as my-pipeline-dev and my-pipeline-prod.
If you later need to move a connection to a different group, use PATCH /v1/connections/{connectionId} with a new group_id value. See Update a Connection for details.
Create the dev group
CREATE_DEV_GROUP_RESPONSE=$(curl --silent --show-error \
--request POST \
--url "$FIVETRAN_BASE_URL/groups" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{"name": "my-pipeline-dev"}')
echo "$CREATE_DEV_GROUP_RESPONSE"
export DEV_GROUP_ID=$(echo "$CREATE_DEV_GROUP_RESPONSE" | jq -r '.data.id')
echo "DEV_GROUP_ID=$DEV_GROUP_ID"
Create the prod group
CREATE_PROD_GROUP_RESPONSE=$(curl --silent --show-error \
--request POST \
--url "$FIVETRAN_BASE_URL/groups" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{"name": "my-pipeline-prod"}')
echo "$CREATE_PROD_GROUP_RESPONSE"
export PROD_GROUP_ID=$(echo "$CREATE_PROD_GROUP_RESPONSE" | jq -r '.data.id')
echo "PROD_GROUP_ID=$PROD_GROUP_ID"
Create a destination for each group
Use the Create a Destination endpoint to provision a destination for each group. Both destinations use the same service type but point to separate database schemas or warehouses.
Create the dev destination
CREATE_DEV_DEST_RESPONSE=$(curl --silent --show-error \
--request POST \
--url "$FIVETRAN_BASE_URL/destinations" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data @- <<JSON
{
"group_id": "$DEV_GROUP_ID",
"service": "$DESTINATION_SERVICE",
"region": "GCP_US_EAST4",
"time_zone_offset": "-5",
"config": {
"host": "<dev_host>",
"port": "<dev_port>",
"database": "<dev_database>",
"user": "<dev_user>",
"password": "<dev_password>"
}
}
JSON
)
echo "$CREATE_DEV_DEST_RESPONSE"
Create the prod destination
CREATE_PROD_DEST_RESPONSE=$(curl --silent --show-error \
--request POST \
--url "$FIVETRAN_BASE_URL/destinations" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data @- <<JSON
{
"group_id": "$PROD_GROUP_ID",
"service": "$DESTINATION_SERVICE",
"region": "GCP_US_EAST4",
"time_zone_offset": "-5",
"config": {
"host": "<prod_host>",
"port": "<prod_port>",
"database": "<prod_database>",
"user": "<prod_user>",
"password": "<prod_password>"
}
}
JSON
)
echo "$CREATE_PROD_DEST_RESPONSE"
The config object is destination-specific. Use the schema in Create a Destination for your selected destination service to review the required and optional fields.
Deploy the same connection to both groups
Use the Create a Connection endpoint twice with the same service and config but a different group_id to deploy identical connections to both environments. Start both connections paused so you can verify setup before enabling syncs.
Create the dev connection
CREATE_DEV_CONNECTION_RESPONSE=$(curl --silent --show-error \
--request POST \
--url "$FIVETRAN_BASE_URL/connections" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data @- <<JSON
{
"service": "$CONNECTION_SERVICE",
"group_id": "$DEV_GROUP_ID",
"paused": true,
"config": {
"schema": "my_source_dev"
}
}
JSON
)
echo "$CREATE_DEV_CONNECTION_RESPONSE"
export DEV_CONNECTION_ID=$(echo "$CREATE_DEV_CONNECTION_RESPONSE" | jq -r '.data.id')
echo "DEV_CONNECTION_ID=$DEV_CONNECTION_ID"
Create the prod connection
CREATE_PROD_CONNECTION_RESPONSE=$(curl --silent --show-error \
--request POST \
--url "$FIVETRAN_BASE_URL/connections" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data @- <<JSON
{
"service": "$CONNECTION_SERVICE",
"group_id": "$PROD_GROUP_ID",
"paused": true,
"config": {
"schema": "my_source_prod"
}
}
JSON
)
echo "$CREATE_PROD_CONNECTION_RESPONSE"
export PROD_CONNECTION_ID=$(echo "$CREATE_PROD_CONNECTION_RESPONSE" | jq -r '.data.id')
echo "PROD_CONNECTION_ID=$PROD_CONNECTION_ID"
The config object is connector-specific. Use the schema in Create a Connection for your selected connection service to review all available fields.
Both connections in this tutorial are created with "paused": true. Run setup tests on each connection after creation to confirm that credentials and network access are valid before unpausing.
Set different sync frequencies
Use the Update a Connection endpoint to configure a less frequent sync schedule for dev and a more frequent one for prod. Unpause both connections at the same time.
The sync_frequency field accepts values in minutes. Supported values include 5, 15, 30, 60, 120, 180, 360, 480, 720, and 1440.
Set dev sync frequency: 1440 minutes, once per day
curl --silent --show-error \
--request PATCH \
--url "$FIVETRAN_BASE_URL/connections/$DEV_CONNECTION_ID" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{"paused": false, "sync_frequency": 1440}' | jq
Set prod sync frequency: 60 minutes, once per hour
curl --silent --show-error \
--request PATCH \
--url "$FIVETRAN_BASE_URL/connections/$PROD_CONNECTION_ID" \
--header "Accept: application/json" \
--header "Authorization: Basic $FIVETRAN_AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{"paused": false, "sync_frequency": 60}' | jq
Dev and prod pattern
The dev group uses a longer sync interval, 1440 minutes to reduce API call volume and destination write costs during development and testing. The prod group uses a shorter interval, 60 minutes, to keep the customer-facing data fresh.
When you are ready to promote a configuration change — such as updated credentials, a new schema selection, or a modified config — apply it first to the dev connection, verify the next sync completes successfully, and then apply the same change to the prod connection. This gives you a controlled rollout path without affecting production data availability.
Endpoints used in this workflow
POST /v1/groupsPOST /v1/destinationsPOST /v1/connectionsPATCH /v1/connections/{connectionId}