curl --request POST \
--url https://api.nango.dev/environments \
--header 'Authorization: Bearer <NANGO-ACCOUNT-API-KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "staging",
"webhooks": {
"primary_url": "https://app.example.com/webhooks/nango",
"on_sync_completion_always": false
}
}'
{
"data": {
"id": 123,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"name": "staging",
"is_production": false,
"callback_url": "https://api.nango.dev/oauth/callback",
"slack_notifications": false,
"otlp_endpoint": null,
"otlp_headers": [],
"webhooks": {
"primary_url": "https://app.example.com/webhooks/nango",
"secondary_url": null,
"on_sync_completion_always": false,
"on_auth_creation": true,
"on_auth_refresh_error": true,
"on_sync_error": true,
"on_async_action_completion": true,
"on_connection_deletion": true,
"signing_key": "5f1c0d2e-6a1b-4f3c-9d8e-7b6a5c4d3e2f"
}
}
}
Create an environment
Create a new environment
curl --request POST \
--url https://api.nango.dev/environments \
--header 'Authorization: Bearer <NANGO-ACCOUNT-API-KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "staging",
"webhooks": {
"primary_url": "https://app.example.com/webhooks/nango",
"on_sync_completion_always": false
}
}'
{
"data": {
"id": 123,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"name": "staging",
"is_production": false,
"callback_url": "https://api.nango.dev/oauth/callback",
"slack_notifications": false,
"otlp_endpoint": null,
"otlp_headers": [],
"webhooks": {
"primary_url": "https://app.example.com/webhooks/nango",
"secondary_url": null,
"on_sync_completion_always": false,
"on_auth_creation": true,
"on_auth_refresh_error": true,
"on_sync_error": true,
"on_async_action_completion": true,
"on_connection_deletion": true,
"signing_key": "5f1c0d2e-6a1b-4f3c-9d8e-7b6a5c4d3e2f"
}
}
}
account:environments:create scope. Create one from Account API keys in the dashboard.is_production: true to create a production environment. This also requires account:environments:set_production. The reserved name prod is always production and cannot be combined with is_production: false.
Pass webhooks to configure URLs and subscriptions. Nango generates a webhook signing key for the new environment. See Receive webhooks from Nango for delivery behavior, event types, and signature verification.
The response returns the complete environment settings, including the plaintext webhook signing key and environment uuid. Use the uuid to create an Environment API key or delete the environment. Creating an environment also creates a default full-access Environment API key, but the secret is not returned.
curl --request POST \
--url https://api.nango.dev/environments \
--header 'Authorization: Bearer <NANGO-ACCOUNT-API-KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "staging",
"webhooks": {
"primary_url": "https://app.example.com/webhooks/nango",
"on_sync_completion_always": false
}
}'
{
"data": {
"id": 123,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"name": "staging",
"is_production": false,
"callback_url": "https://api.nango.dev/oauth/callback",
"slack_notifications": false,
"otlp_endpoint": null,
"otlp_headers": [],
"webhooks": {
"primary_url": "https://app.example.com/webhooks/nango",
"secondary_url": null,
"on_sync_completion_always": false,
"on_auth_creation": true,
"on_auth_refresh_error": true,
"on_sync_error": true,
"on_async_action_completion": true,
"on_connection_deletion": true,
"signing_key": "5f1c0d2e-6a1b-4f3c-9d8e-7b6a5c4d3e2f"
}
}
}
Authorizations
An Environment API key from your Nango environment, or an Account API key for account-level endpoints.
Body
Environment name. Lowercase letters, digits, hyphens, and underscores only. Max 255 characters. The reserved name prod is always treated as production.
255^[a-z0-9_-]+$"staging"
Whether to mark the environment as production. Defaults to false, except for the reserved name prod.
Custom OAuth callback URL for this environment.
Legacy public-key authorization HMAC key. Use Connect sessions instead.
1000Whether legacy public-key authorization HMAC verification is enabled. Use Connect sessions instead.
Whether Slack notifications are enabled for this environment.
OpenTelemetry collector endpoint. Requires a plan with OpenTelemetry export. Pass an empty string to set an empty endpoint.
Headers sent with OpenTelemetry export requests. Requires a plan with OpenTelemetry export. Maximum 100 headers.
100Show child attributes
Show child attributes
Initial webhook settings. Omitted URLs default to null; omitted subscription flags default to true.
Show child attributes
Show child attributes
Response
Successfully created an environment
Show child attributes
Show child attributes
Was this page helpful?