Integrations
Connect a sandbox provider
Stores the settings CostGraph uses to start and stop sandboxes in the team’s account with a sandbox provider, for AutoPilot CI jobs and workflow code changes. provider is an id from /integrations/sandbox/providers and env holds a value for each of its fields by env name; required fields must be set. The key is not checked here: a provider that refuses it when a sandbox starts marks the connection as needing to be reconnected. A tenant has one connection per provider, so connecting the same provider again replaces its settings and reactivates it. Settings are never returned. The caller must be an organization owner, admin or billing admin.
POST
/
api
/
v1
/
integrations
/
sandbox
/
connect
Connect a sandbox provider
curl --request POST \
--url https://api.costgraph.ai/api/v1/integrations/sandbox/connect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"tenant_id": "<string>",
"display_name": "<string>",
"env": {}
}
'import requests
url = "https://api.costgraph.ai/api/v1/integrations/sandbox/connect"
payload = {
"provider": "<string>",
"tenant_id": "<string>",
"display_name": "<string>",
"env": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: '<string>', tenant_id: '<string>', display_name: '<string>', env: {}})
};
fetch('https://api.costgraph.ai/api/v1/integrations/sandbox/connect', 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.costgraph.ai/api/v1/integrations/sandbox/connect",
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([
'provider' => '<string>',
'tenant_id' => '<string>',
'display_name' => '<string>',
'env' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.costgraph.ai/api/v1/integrations/sandbox/connect"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"env\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.costgraph.ai/api/v1/integrations/sandbox/connect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"env\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/sandbox/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"env\": {}\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"ci_history": {
"days_loaded": 123,
"days_total": 123
},
"connection_id": "<string>",
"connection_modes": [
"cost"
],
"created_at": "<string>",
"display_name": "<string>",
"has_metrics_source": true,
"hosted": true,
"id": "<string>",
"in_jobs": 123,
"ingest_mode": "pull",
"last_sync_error": "<string>",
"last_synced_at": "<string>",
"needs_service_token": true,
"provider": "<string>",
"provider_account_id": "<string>",
"recommendations_checked_at": "<string>",
"recommendations_status": "<string>",
"sandbox_provider": "<string>",
"status": "<string>",
"tenant_id": "<string>",
"trialing_jobs": 123,
"updated_at": "<string>",
"warnings": [
"<string>"
]
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"code": "subscription_required",
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Body
application/json
Sandbox provider connection
Was this page helpful?
⌘I
Connect a sandbox provider
curl --request POST \
--url https://api.costgraph.ai/api/v1/integrations/sandbox/connect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"tenant_id": "<string>",
"display_name": "<string>",
"env": {}
}
'import requests
url = "https://api.costgraph.ai/api/v1/integrations/sandbox/connect"
payload = {
"provider": "<string>",
"tenant_id": "<string>",
"display_name": "<string>",
"env": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: '<string>', tenant_id: '<string>', display_name: '<string>', env: {}})
};
fetch('https://api.costgraph.ai/api/v1/integrations/sandbox/connect', 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.costgraph.ai/api/v1/integrations/sandbox/connect",
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([
'provider' => '<string>',
'tenant_id' => '<string>',
'display_name' => '<string>',
'env' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.costgraph.ai/api/v1/integrations/sandbox/connect"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"env\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.costgraph.ai/api/v1/integrations/sandbox/connect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"env\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/sandbox/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"env\": {}\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"ci_history": {
"days_loaded": 123,
"days_total": 123
},
"connection_id": "<string>",
"connection_modes": [
"cost"
],
"created_at": "<string>",
"display_name": "<string>",
"has_metrics_source": true,
"hosted": true,
"id": "<string>",
"in_jobs": 123,
"ingest_mode": "pull",
"last_sync_error": "<string>",
"last_synced_at": "<string>",
"needs_service_token": true,
"provider": "<string>",
"provider_account_id": "<string>",
"recommendations_checked_at": "<string>",
"recommendations_status": "<string>",
"sandbox_provider": "<string>",
"status": "<string>",
"tenant_id": "<string>",
"trialing_jobs": 123,
"updated_at": "<string>",
"warnings": [
"<string>"
]
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"code": "subscription_required",
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}