Create SAML configuration
curl --request POST \
--url https://accounts.livechat.com/v2/organizations/my/saml \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entrypoint": "https://accounts.example.com/saml2/idp/SSOService.php",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n-----END CERTIFICATE-----",
"idp_entity_id": "https://accounts.example.com/saml2/idp/metadata.php",
"sp_entity_id": "https://accounts.livechat.com/saml/metadata"
}
'import requests
url = "https://accounts.livechat.com/v2/organizations/my/saml"
payload = {
"entrypoint": "https://accounts.example.com/saml2/idp/SSOService.php",
"certificate": "-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
-----END CERTIFICATE-----",
"idp_entity_id": "https://accounts.example.com/saml2/idp/metadata.php",
"sp_entity_id": "https://accounts.livechat.com/saml/metadata"
}
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({
entrypoint: 'https://accounts.example.com/saml2/idp/SSOService.php',
certificate: '-----BEGIN CERTIFICATE-----\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n-----END CERTIFICATE-----',
idp_entity_id: 'https://accounts.example.com/saml2/idp/metadata.php',
sp_entity_id: 'https://accounts.livechat.com/saml/metadata'
})
};
fetch('https://accounts.livechat.com/v2/organizations/my/saml', 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://accounts.livechat.com/v2/organizations/my/saml",
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([
'entrypoint' => 'https://accounts.example.com/saml2/idp/SSOService.php',
'certificate' => '-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
-----END CERTIFICATE-----',
'idp_entity_id' => 'https://accounts.example.com/saml2/idp/metadata.php',
'sp_entity_id' => 'https://accounts.livechat.com/saml/metadata'
]),
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://accounts.livechat.com/v2/organizations/my/saml"
payload := strings.NewReader("{\n \"entrypoint\": \"https://accounts.example.com/saml2/idp/SSOService.php\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\\n-----END CERTIFICATE-----\",\n \"idp_entity_id\": \"https://accounts.example.com/saml2/idp/metadata.php\",\n \"sp_entity_id\": \"https://accounts.livechat.com/saml/metadata\"\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://accounts.livechat.com/v2/organizations/my/saml")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entrypoint\": \"https://accounts.example.com/saml2/idp/SSOService.php\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\\n-----END CERTIFICATE-----\",\n \"idp_entity_id\": \"https://accounts.example.com/saml2/idp/metadata.php\",\n \"sp_entity_id\": \"https://accounts.livechat.com/saml/metadata\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/organizations/my/saml")
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 \"entrypoint\": \"https://accounts.example.com/saml2/idp/SSOService.php\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\\n-----END CERTIFICATE-----\",\n \"idp_entity_id\": \"https://accounts.example.com/saml2/idp/metadata.php\",\n \"sp_entity_id\": \"https://accounts.livechat.com/saml/metadata\"\n}"
response = http.request(request)
puts response.read_body{
"error": "bad_request",
"error_description": "The server cannot or will not process the request due to an apparent client error (for example, malformed request syntax, size too large).",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "conflict",
"error_description": "The request couldn't be processed because of conflict in the current state of the resource.",
"resource_name": "account",
"resource_id": "5903c51b-89f0-41a9-a25d-4f39af100353",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"invalid_fields": {
"email": "invalid email address"
},
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}SAML
Create SAML configuration
Creates SAML configuration for the organization. To create a SAML configuration, the organization needs to have at least one product with an enterprise subscription.
POST
/
organizations
/
my
/
saml
Create SAML configuration
curl --request POST \
--url https://accounts.livechat.com/v2/organizations/my/saml \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entrypoint": "https://accounts.example.com/saml2/idp/SSOService.php",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n-----END CERTIFICATE-----",
"idp_entity_id": "https://accounts.example.com/saml2/idp/metadata.php",
"sp_entity_id": "https://accounts.livechat.com/saml/metadata"
}
'import requests
url = "https://accounts.livechat.com/v2/organizations/my/saml"
payload = {
"entrypoint": "https://accounts.example.com/saml2/idp/SSOService.php",
"certificate": "-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
-----END CERTIFICATE-----",
"idp_entity_id": "https://accounts.example.com/saml2/idp/metadata.php",
"sp_entity_id": "https://accounts.livechat.com/saml/metadata"
}
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({
entrypoint: 'https://accounts.example.com/saml2/idp/SSOService.php',
certificate: '-----BEGIN CERTIFICATE-----\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n-----END CERTIFICATE-----',
idp_entity_id: 'https://accounts.example.com/saml2/idp/metadata.php',
sp_entity_id: 'https://accounts.livechat.com/saml/metadata'
})
};
fetch('https://accounts.livechat.com/v2/organizations/my/saml', 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://accounts.livechat.com/v2/organizations/my/saml",
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([
'entrypoint' => 'https://accounts.example.com/saml2/idp/SSOService.php',
'certificate' => '-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
-----END CERTIFICATE-----',
'idp_entity_id' => 'https://accounts.example.com/saml2/idp/metadata.php',
'sp_entity_id' => 'https://accounts.livechat.com/saml/metadata'
]),
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://accounts.livechat.com/v2/organizations/my/saml"
payload := strings.NewReader("{\n \"entrypoint\": \"https://accounts.example.com/saml2/idp/SSOService.php\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\\n-----END CERTIFICATE-----\",\n \"idp_entity_id\": \"https://accounts.example.com/saml2/idp/metadata.php\",\n \"sp_entity_id\": \"https://accounts.livechat.com/saml/metadata\"\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://accounts.livechat.com/v2/organizations/my/saml")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entrypoint\": \"https://accounts.example.com/saml2/idp/SSOService.php\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\\n-----END CERTIFICATE-----\",\n \"idp_entity_id\": \"https://accounts.example.com/saml2/idp/metadata.php\",\n \"sp_entity_id\": \"https://accounts.livechat.com/saml/metadata\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/organizations/my/saml")
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 \"entrypoint\": \"https://accounts.example.com/saml2/idp/SSOService.php\",\n \"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\\n-----END CERTIFICATE-----\",\n \"idp_entity_id\": \"https://accounts.example.com/saml2/idp/metadata.php\",\n \"sp_entity_id\": \"https://accounts.livechat.com/saml/metadata\"\n}"
response = http.request(request)
puts response.read_body{
"error": "bad_request",
"error_description": "The server cannot or will not process the request due to an apparent client error (for example, malformed request syntax, size too large).",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "conflict",
"error_description": "The request couldn't be processed because of conflict in the current state of the resource.",
"resource_name": "account",
"resource_id": "5903c51b-89f0-41a9-a25d-4f39af100353",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"invalid_fields": {
"email": "invalid email address"
},
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}Authorizations
This API uses OAuth2 with the implicit grant flow. Learn about the implicit grant flow.
Body
application/json
The entrypoint URL of the identity provider; SSO redirects the AuthnRequest there.
The SAML certificate configured on the IDP side in PEM format.
The entity ID of the external identity provider; usually a URL.
The entity ID of Text Accounts; it has a default value that can be changed.
Response
Created: SAML configuration was created.
Was this page helpful?
⌘I