curl --request POST \
--url https://api.nango.dev/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "staging",
"is_production": true,
"callback_url": "<string>",
"hmac_key": "<string>",
"hmac_enabled": true,
"slack_notifications": true,
"otlp_endpoint": "<string>",
"otlp_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://api.nango.dev/environments"
payload = {
"name": "staging",
"is_production": True,
"callback_url": "<string>",
"hmac_key": "<string>",
"hmac_enabled": True,
"slack_notifications": True,
"otlp_endpoint": "<string>",
"otlp_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'staging',
is_production: true,
callback_url: '<string>',
hmac_key: '<string>',
hmac_enabled: true,
slack_notifications: true,
otlp_endpoint: '<string>',
otlp_headers: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://api.nango.dev/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nango.dev/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'staging',
'is_production' => true,
'callback_url' => '<string>',
'hmac_key' => '<string>',
'hmac_enabled' => true,
'slack_notifications' => true,
'otlp_endpoint' => '<string>',
'otlp_headers' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nango.dev/environments"
payload := strings.NewReader("{\n \"name\": \"staging\",\n \"is_production\": true,\n \"callback_url\": \"<string>\",\n \"hmac_key\": \"<string>\",\n \"hmac_enabled\": true,\n \"slack_notifications\": true,\n \"otlp_endpoint\": \"<string>\",\n \"otlp_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nango.dev/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"staging\",\n \"is_production\": true,\n \"callback_url\": \"<string>\",\n \"hmac_key\": \"<string>\",\n \"hmac_enabled\": true,\n \"slack_notifications\": true,\n \"otlp_endpoint\": \"<string>\",\n \"otlp_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nango.dev/environments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"staging\",\n \"is_production\": true,\n \"callback_url\": \"<string>\",\n \"hmac_key\": \"<string>\",\n \"hmac_enabled\": true,\n \"slack_notifications\": true,\n \"otlp_endpoint\": \"<string>\",\n \"otlp_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"name": "staging"
}
}
Create an environment
Create a new environment
curl --request POST \
--url https://api.nango.dev/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "staging",
"is_production": true,
"callback_url": "<string>",
"hmac_key": "<string>",
"hmac_enabled": true,
"slack_notifications": true,
"otlp_endpoint": "<string>",
"otlp_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://api.nango.dev/environments"
payload = {
"name": "staging",
"is_production": True,
"callback_url": "<string>",
"hmac_key": "<string>",
"hmac_enabled": True,
"slack_notifications": True,
"otlp_endpoint": "<string>",
"otlp_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'staging',
is_production: true,
callback_url: '<string>',
hmac_key: '<string>',
hmac_enabled: true,
slack_notifications: true,
otlp_endpoint: '<string>',
otlp_headers: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://api.nango.dev/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nango.dev/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'staging',
'is_production' => true,
'callback_url' => '<string>',
'hmac_key' => '<string>',
'hmac_enabled' => true,
'slack_notifications' => true,
'otlp_endpoint' => '<string>',
'otlp_headers' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nango.dev/environments"
payload := strings.NewReader("{\n \"name\": \"staging\",\n \"is_production\": true,\n \"callback_url\": \"<string>\",\n \"hmac_key\": \"<string>\",\n \"hmac_enabled\": true,\n \"slack_notifications\": true,\n \"otlp_endpoint\": \"<string>\",\n \"otlp_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nango.dev/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"staging\",\n \"is_production\": true,\n \"callback_url\": \"<string>\",\n \"hmac_key\": \"<string>\",\n \"hmac_enabled\": true,\n \"slack_notifications\": true,\n \"otlp_endpoint\": \"<string>\",\n \"otlp_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nango.dev/environments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"staging\",\n \"is_production\": true,\n \"callback_url\": \"<string>\",\n \"hmac_key\": \"<string>\",\n \"hmac_enabled\": true,\n \"slack_notifications\": true,\n \"otlp_endpoint\": \"<string>\",\n \"otlp_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"name": "staging"
}
}
is_production: true.
The response includes an environment uuid. Use it 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.
{
"data": {
"id": 123,
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"name": "staging"
}
}
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.
HMAC key used by the legacy public-key authorization flow.
1000Whether HMAC verification is enabled for the legacy public-key authorization flow.
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
Response
Successfully created an environment
Show child attributes
Show child attributes
Was this page helpful?