Single sign-on
Require single sign-on
Org owners only. When on, people with an email on the organization’s verified domains must sign in through its identity provider; other sign-ins are refused on every request. Turning it on ends their existing sessions and removes their app authorizations, and requires api_key_policy: keep leaves their personal API keys working, revoke deactivates them (agent install keys are never touched). Organization owners keep password sign-in with an authenticator app as break-glass access.
PUT
/
api
/
v1
/
organizations
/
{org_id}
/
sso
/
enforcement
Require single sign-on
curl --request PUT \
--url https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"enforce_sso": true
}
'import requests
url = "https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement"
payload = { "enforce_sso": True }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({enforce_sso: true})
};
fetch('https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement', 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/organizations/{org_id}/sso/enforcement",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enforce_sso' => true
]),
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/organizations/{org_id}/sso/enforcement"
payload := strings.NewReader("{\n \"enforce_sso\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"enforce_sso\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enforce_sso\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"created_at": "<string>",
"default_role": "<string>",
"enforce_sso": true,
"group_role_mappings": {},
"has_metadata_xml": true,
"id": "<string>",
"provider_name": "<string>",
"service_provider": {
"acs_url": "<string>",
"entity_id": "<string>",
"oidc_redirect_uri": "<string>",
"sign_in_client_id": "<string>"
},
"type": "saml",
"updated_at": "<string>",
"groups_attribute": "<string>",
"metadata_url": "<string>",
"oidc_client_id": "<string>",
"oidc_issuer": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Path Parameters
Organization ID
Body
application/json
Enforcement setting
Was this page helpful?
⌘I
Require single sign-on
curl --request PUT \
--url https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"enforce_sso": true
}
'import requests
url = "https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement"
payload = { "enforce_sso": True }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({enforce_sso: true})
};
fetch('https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement', 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/organizations/{org_id}/sso/enforcement",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enforce_sso' => true
]),
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/organizations/{org_id}/sso/enforcement"
payload := strings.NewReader("{\n \"enforce_sso\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"enforce_sso\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/organizations/{org_id}/sso/enforcement")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enforce_sso\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"created_at": "<string>",
"default_role": "<string>",
"enforce_sso": true,
"group_role_mappings": {},
"has_metadata_xml": true,
"id": "<string>",
"provider_name": "<string>",
"service_provider": {
"acs_url": "<string>",
"entity_id": "<string>",
"oidc_redirect_uri": "<string>",
"sign_in_client_id": "<string>"
},
"type": "saml",
"updated_at": "<string>",
"groups_attribute": "<string>",
"metadata_url": "<string>",
"oidc_client_id": "<string>",
"oidc_issuer": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}