curl --request PATCH \
--url https://api.env0.com/cloud-compass/credentials/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"organizationId": "<string>",
"roleArn": "<string>",
"externalId": "<string>",
"organizationUnitIds": [
"<string>"
],
"skipAccountIds": [
"<string>"
]
}
'import requests
url = "https://api.env0.com/cloud-compass/credentials/{id}"
payload = {
"organizationId": "<string>",
"roleArn": "<string>",
"externalId": "<string>",
"organizationUnitIds": ["<string>"],
"skipAccountIds": ["<string>"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organizationId: '<string>',
roleArn: '<string>',
externalId: '<string>',
organizationUnitIds: ['<string>'],
skipAccountIds: ['<string>']
})
};
fetch('https://api.env0.com/cloud-compass/credentials/{id}', 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.env0.com/cloud-compass/credentials/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'organizationId' => '<string>',
'roleArn' => '<string>',
'externalId' => '<string>',
'organizationUnitIds' => [
'<string>'
],
'skipAccountIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.env0.com/cloud-compass/credentials/{id}"
payload := strings.NewReader("{\n \"organizationId\": \"<string>\",\n \"roleArn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"organizationUnitIds\": [\n \"<string>\"\n ],\n \"skipAccountIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api.env0.com/cloud-compass/credentials/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"<string>\",\n \"roleArn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"organizationUnitIds\": [\n \"<string>\"\n ],\n \"skipAccountIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.env0.com/cloud-compass/credentials/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organizationId\": \"<string>\",\n \"roleArn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"organizationUnitIds\": [\n \"<string>\"\n ],\n \"skipAccountIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "testing",
"startedAt": "2023-11-07T05:31:56Z",
"roleArn": "<string>",
"externalIdChanged": true,
"organizationUnitIds": [
"<string>"
],
"skipAccountIds": [
"<string>"
],
"testResults": [
{
"feature": "asset_inventory",
"status": "created",
"failureReason": "<string>",
"failureCode": "<string>"
}
],
"failureReason": "test_connection_failed"
}Edit the role ARN, External ID or OUs of a Cloud Compass credential
Returns 202 at once with the pending edit. Poll GET cloud-compass/credentials/: when every CloudQuery test passes, env0 updates the same 4 syncs and the credential; when one fails, nothing changes. Answers 400 for a role in another AWS account, and 409 while a create or an earlier edit is still being applied.
curl --request PATCH \
--url https://api.env0.com/cloud-compass/credentials/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"organizationId": "<string>",
"roleArn": "<string>",
"externalId": "<string>",
"organizationUnitIds": [
"<string>"
],
"skipAccountIds": [
"<string>"
]
}
'import requests
url = "https://api.env0.com/cloud-compass/credentials/{id}"
payload = {
"organizationId": "<string>",
"roleArn": "<string>",
"externalId": "<string>",
"organizationUnitIds": ["<string>"],
"skipAccountIds": ["<string>"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organizationId: '<string>',
roleArn: '<string>',
externalId: '<string>',
organizationUnitIds: ['<string>'],
skipAccountIds: ['<string>']
})
};
fetch('https://api.env0.com/cloud-compass/credentials/{id}', 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.env0.com/cloud-compass/credentials/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'organizationId' => '<string>',
'roleArn' => '<string>',
'externalId' => '<string>',
'organizationUnitIds' => [
'<string>'
],
'skipAccountIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.env0.com/cloud-compass/credentials/{id}"
payload := strings.NewReader("{\n \"organizationId\": \"<string>\",\n \"roleArn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"organizationUnitIds\": [\n \"<string>\"\n ],\n \"skipAccountIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api.env0.com/cloud-compass/credentials/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"<string>\",\n \"roleArn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"organizationUnitIds\": [\n \"<string>\"\n ],\n \"skipAccountIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.env0.com/cloud-compass/credentials/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organizationId\": \"<string>\",\n \"roleArn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"organizationUnitIds\": [\n \"<string>\"\n ],\n \"skipAccountIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "testing",
"startedAt": "2023-11-07T05:31:56Z",
"roleArn": "<string>",
"externalIdChanged": true,
"organizationUnitIds": [
"<string>"
],
"skipAccountIds": [
"<string>"
],
"testResults": [
{
"feature": "asset_inventory",
"status": "created",
"failureReason": "<string>",
"failureCode": "<string>"
}
],
"failureReason": "test_connection_failed"
}Authorizations
env zero API authentication is done via API keys. An API Key can either be created by an organization administrator, in which case it will not be connected to any specific user, or via Personal API Keys to authenticate as a user.
Creating an API Key with a Specific Role
- Once you've created your organization, you can set up and manage API Keys.
- Navigate to the Organization Settings page and click the API Keys tab.
- Click Add API Key and enter a name for your key in the Name field. This name is for reference purposes only and isn't used directly in authentication.
❗️Save Your API Key ID and secret The secret will not be available after you close this window.
Creating a Personal API Key
- Click on your avatar (located on the top right of the screen)
- Click on Personal Settings
- Select the API Keys tab
- Click Add API Key, and enter a name for your key in the Name field. This name is for reference purposes and isn't used directly in authentication.
❗️Save your API Key ID & secret The secret will not be available after you close this window.
Using an API Key to Authenticate
Authentication of the env zero API is done using the Basic Authentication method. Each request made should include the API Key ID as the username, and the API Key secret as the password. For example, when using curl, we can include these parameters via flag --user {API Key ID}:{API Key Secret}.
API Key Permissions
When creating an API key through the organization settings, you will need to choose if you’d like to grant it Organization Admin or User permissions. In case of the latter, you can assign fine-grained permissions per project. Personal API Keys can be created through the user’s profile page and will have the same permissions as the user has.
Rate Limits
env zero API allows up to 1K requests per 60 seconds, requests are aggregated by IP, HTTP Method and URI. If you exceed this limit, you will receive a 429 status code.
Path Parameters
Body
Send at least one field besides organizationId. A field left out keeps its value.
The new role ARN, or management account role ARN in Organization mode. Must be in the credential's AWS account.
^arn:aws[a-z-]*:iam::\d{12}:role/.+$The sts:ExternalId characters, without a comma. Update the role's trust policy first.
2 - 1224^[\w+=.@:\/-]+$Organization mode only. The OUs Cloud Compass reads. Empty reads the whole Organization.
1000^(ou-[0-9a-z]{4,32}-[a-z0-9]{8,32}|r-[0-9a-z]{4,32})$Organization mode only. Member accounts Cloud Compass skips.
1000^\d{12}$Response
An edit the syncs do not have yet. testing: CloudQuery tests the new settings. applying: env0 updates the same 4 syncs and the credential. failed: a test failed or timed out and nothing changed, or the apply kept failing. Each read of the credential moves an open edit on, so it waits while nobody reads it.
testing, applying, failed Set when the edit changes the role ARN.
True when the edit changes the External ID.
Set when the edit changes the OUs.
^(ou-[0-9a-z]{4,32}-[a-z0-9]{8,32}|r-[0-9a-z]{4,32})$Set when the edit changes the skipped accounts.
^\d{12}$The CloudQuery test connection result per feature.
Show child attributes
Show child attributes
apply_failed: env0 could not update the syncs after the tests passed; some syncs may have the new settings.
test_connection_failed, test_connection_timeout, apply_failed Was this page helpful?