Create an SSO connection
curl --request POST \
--url https://api.onecli.sh/v1/org/sso/connections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "saml",
"displayName": "<string>",
"metadataUrl": "<string>",
"metadataXml": "<string>"
}
'import requests
url = "https://api.onecli.sh/v1/org/sso/connections"
payload = {
"type": "saml",
"displayName": "<string>",
"metadataUrl": "<string>",
"metadataXml": "<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({
type: 'saml',
displayName: '<string>',
metadataUrl: '<string>',
metadataXml: '<string>'
})
};
fetch('https://api.onecli.sh/v1/org/sso/connections', 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.onecli.sh/v1/org/sso/connections",
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([
'type' => 'saml',
'displayName' => '<string>',
'metadataUrl' => '<string>',
'metadataXml' => '<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.onecli.sh/v1/org/sso/connections"
payload := strings.NewReader("{\n \"type\": \"saml\",\n \"displayName\": \"<string>\",\n \"metadataUrl\": \"<string>\",\n \"metadataXml\": \"<string>\"\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.onecli.sh/v1/org/sso/connections")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"saml\",\n \"displayName\": \"<string>\",\n \"metadataUrl\": \"<string>\",\n \"metadataXml\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/org/sso/connections")
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 \"type\": \"saml\",\n \"displayName\": \"<string>\",\n \"metadataUrl\": \"<string>\",\n \"metadataXml\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "saml",
"status": "<string>",
"displayName": "<string>",
"cognitoProviderName": "<string>",
"config": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}SSO
Create a SAML or OIDC SSO connection
Creates the organization’s single SSO connection. SAML takes a metadata URL or XML, and OIDC takes issuer and client credentials. Cloud needs Scale or above.
POST
/
org
/
sso
/
connections
Create an SSO connection
curl --request POST \
--url https://api.onecli.sh/v1/org/sso/connections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "saml",
"displayName": "<string>",
"metadataUrl": "<string>",
"metadataXml": "<string>"
}
'import requests
url = "https://api.onecli.sh/v1/org/sso/connections"
payload = {
"type": "saml",
"displayName": "<string>",
"metadataUrl": "<string>",
"metadataXml": "<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({
type: 'saml',
displayName: '<string>',
metadataUrl: '<string>',
metadataXml: '<string>'
})
};
fetch('https://api.onecli.sh/v1/org/sso/connections', 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.onecli.sh/v1/org/sso/connections",
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([
'type' => 'saml',
'displayName' => '<string>',
'metadataUrl' => '<string>',
'metadataXml' => '<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.onecli.sh/v1/org/sso/connections"
payload := strings.NewReader("{\n \"type\": \"saml\",\n \"displayName\": \"<string>\",\n \"metadataUrl\": \"<string>\",\n \"metadataXml\": \"<string>\"\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.onecli.sh/v1/org/sso/connections")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"saml\",\n \"displayName\": \"<string>\",\n \"metadataUrl\": \"<string>\",\n \"metadataXml\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/org/sso/connections")
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 \"type\": \"saml\",\n \"displayName\": \"<string>\",\n \"metadataUrl\": \"<string>\",\n \"metadataXml\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "saml",
"status": "<string>",
"displayName": "<string>",
"cognitoProviderName": "<string>",
"config": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Adds your organization’s single SSO connection. For SAML, send exactly one of
metadataUrl or metadataXml. For OIDC, send the issuer and client credentials. See Editions for plan requirements.
One connection per organization. SAML takes exactly one of metadataUrl or metadataXml; OIDC takes the issuer and client credentials. On Cloud this needs the Scale plan or above.
Availability: Cloud · Enterprise (self-hosted). Not available on the Community edition: a self-hosted deployment needs
ENTERPRISE_ENABLED=true, otherwise the endpoint answers 403 with error.type: "enterprise_license_required".Authorizations
A workspace API key (oc_…) or organization API key (oc_org_…). Workspace-scoped endpoints called with an organization key also need X-Workspace-Id.
Body
application/json
Response
The connection, pending until the first sign-in
Credentials never leave the server; config carries only the non-secret parts.
Available options:
saml, oidc pending until the first successful sign-in, then active; disabled when turned off.
The identity-provider name the login page sends users to.