Connect a provider that CostGraph pulls billing data from
Verifies the credentials by reading a day of billing data, then stores them encrypted and schedules a daily pull. Send exactly one of env with the provider’s settings, credential_source_connection_id naming an existing connection in the same tenant whose credential this one reuses (the provider’s credential_from lists which providers qualify), or, for providers marked github_app, github_app_installation_id naming an installation of the CostGraph GitHub App connected to the same tenant, through which CostGraph mints a read-only token on every sync. GitHub connects only through the GitHub App, and connecting it also connects GitHub Actions jobs for the same organization; providers with managed_by set cannot be connected on their own. Blacksmith connects only when GitHub is connected for the same organization in the tenant. enable_recommendations (default true) turns savings recommendations off for providers that have them. Credentials are never returned.
curl --request POST \
--url https://api.costgraph.ai/api/v1/integrations/focus/connect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"tenant_id": "<string>",
"credential_source_connection_id": "<string>",
"display_name": "<string>",
"enable_recommendations": true,
"env": {},
"github_app_installation_id": 123,
"provider_account_id": "<string>"
}
'import requests
url = "https://api.costgraph.ai/api/v1/integrations/focus/connect"
payload = {
"provider": "<string>",
"tenant_id": "<string>",
"credential_source_connection_id": "<string>",
"display_name": "<string>",
"enable_recommendations": True,
"env": {},
"github_app_installation_id": 123,
"provider_account_id": "<string>"
}
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>',
credential_source_connection_id: '<string>',
display_name: '<string>',
enable_recommendations: true,
env: {},
github_app_installation_id: 123,
provider_account_id: '<string>'
})
};
fetch('https://api.costgraph.ai/api/v1/integrations/focus/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/focus/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>',
'credential_source_connection_id' => '<string>',
'display_name' => '<string>',
'enable_recommendations' => true,
'env' => [
],
'github_app_installation_id' => 123,
'provider_account_id' => '<string>'
]),
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/focus/connect"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"credential_source_connection_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"enable_recommendations\": true,\n \"env\": {},\n \"github_app_installation_id\": 123,\n \"provider_account_id\": \"<string>\"\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/focus/connect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"credential_source_connection_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"enable_recommendations\": true,\n \"env\": {},\n \"github_app_installation_id\": 123,\n \"provider_account_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/focus/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 \"credential_source_connection_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"enable_recommendations\": true,\n \"env\": {},\n \"github_app_installation_id\": 123,\n \"provider_account_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": "<unknown>"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Body
Provider connection
Was this page helpful?
curl --request POST \
--url https://api.costgraph.ai/api/v1/integrations/focus/connect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"tenant_id": "<string>",
"credential_source_connection_id": "<string>",
"display_name": "<string>",
"enable_recommendations": true,
"env": {},
"github_app_installation_id": 123,
"provider_account_id": "<string>"
}
'import requests
url = "https://api.costgraph.ai/api/v1/integrations/focus/connect"
payload = {
"provider": "<string>",
"tenant_id": "<string>",
"credential_source_connection_id": "<string>",
"display_name": "<string>",
"enable_recommendations": True,
"env": {},
"github_app_installation_id": 123,
"provider_account_id": "<string>"
}
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>',
credential_source_connection_id: '<string>',
display_name: '<string>',
enable_recommendations: true,
env: {},
github_app_installation_id: 123,
provider_account_id: '<string>'
})
};
fetch('https://api.costgraph.ai/api/v1/integrations/focus/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/focus/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>',
'credential_source_connection_id' => '<string>',
'display_name' => '<string>',
'enable_recommendations' => true,
'env' => [
],
'github_app_installation_id' => 123,
'provider_account_id' => '<string>'
]),
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/focus/connect"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"credential_source_connection_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"enable_recommendations\": true,\n \"env\": {},\n \"github_app_installation_id\": 123,\n \"provider_account_id\": \"<string>\"\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/focus/connect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"credential_source_connection_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"enable_recommendations\": true,\n \"env\": {},\n \"github_app_installation_id\": 123,\n \"provider_account_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/focus/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 \"credential_source_connection_id\": \"<string>\",\n \"display_name\": \"<string>\",\n \"enable_recommendations\": true,\n \"env\": {},\n \"github_app_installation_id\": 123,\n \"provider_account_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": "<unknown>"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}