Skip to content
POST /sso-connection

Create a new SSO connection for a team. The client_secret (OIDC relying-party secret) is write-only — it is encrypted at rest and never returned.

You can create a connection as an inactive draft (is_active: false) with an incomplete config. This is the recommended first step: create the connection, read back the generated SP values (SAML ACS URL / SP Entity ID at /auth/saml/{id}/acs and /auth/saml/{id}/metadata, or the OIDC callback at /auth/oidc/{id}/callback), configure those in your identity provider, then update the connection with the IdP details and activate it.

Activation is guarded: setting is_active: true requires a complete config — SAML needs idp_sso_url, idp_entity_id, and idp_x509_cert (or idp_metadata_xml); OIDC needs issuer, client_id, and a client_secret. Activating without them returns 400.

An OIDC identity provider must assert email_verified: true for the user's email, in the ID token or from its userinfo endpoint, or the sign-in is refused. Microsoft Entra ID never sends that claim, so an xms_edov: true claim in the ID token counts instead: add xms_edov as an optional ID token claim in the Entra app registration, or connect Entra ID with SAML.

is_active, enforced and is_default each accept true/false or 1/0, as JSON or as the strings "true", "false", "1" and "0"; any other value returns 400.

Request Body

client_secretstring

The OIDC relying-party client secret. Write-only — encrypted at rest and never returned.

Example: rp-secret-value
configobject

Non-secret protocol settings.

allow_idp_initiatedboolean

SAML only — accept unsolicited (IdP-initiated) responses at the ACS. Defaults to false (unsolicited responses rejected) when omitted.

Example: false
client_idstring

OIDC relying-party client ID.

Example: truto-client
discovery_urlstring

OIDC discovery document URL.

Example: https://accounts.example.com/.well-known/openid-configuration
idp_entity_idstring

SAML IdP entity ID.

Example: https://idp.example.com/metadata
idp_metadata_xmlstring

SAML only — IdP metadata XML. When provided, the server parses it to populate idp_entity_id, idp_sso_url, and idp_x509_cert, then discards the raw XML (never stored or returned).

idp_sso_urlstring

SAML IdP single sign-on URL.

Example: https://idp.example.com/sso
idp_x509_certstring

SAML IdP X.509 signing certificate (PEM).

issuerstring

OIDC issuer URL.

Example: https://accounts.example.com
sign_authn_requestsboolean

SAML only — sign SP-initiated AuthnRequests with the SP key (HTTP-Redirect binding).

Example: false
default_environment_idsstring[]

Environment IDs that provisioned users are granted access to by default. Each item must be the ID of one of the connection's team's environments; another team's environment, one that doesn't exist, a nested array or any other value is a 400.

default_rolestring

The role assigned to users provisioned through this connection.

Example: member
enforcedboolean

Whether SSO login is enforced for the connection's verified domains.

Example: false
is_activeboolean

Whether the connection is active.

Example: true
is_defaultboolean

Whether this is the team's default SSO connection.

Example: false
protocolstring

The SSO protocol for this connection.

Example: saml
Possible values:
samloidc
team_idstring · uuid

The ID of the team this connection belongs to.

Example: 05daecaf-4365-42e8-8370-8127de5dd717

Response Body

configobject

Non-secret protocol settings. Secret values (the OIDC client secret and SAML SP keys) are never returned.

allow_idp_initiatedboolean

SAML only — accept unsolicited (IdP-initiated) responses at the ACS. Defaults to false (unsolicited responses rejected) when omitted.

Example: false
client_idstring

OIDC relying-party client ID.

Example: truto-client
discovery_urlstring

OIDC discovery document URL.

Example: https://accounts.example.com/.well-known/openid-configuration
idp_entity_idstring

SAML IdP entity ID.

Example: https://idp.example.com/metadata
idp_sso_urlstring

SAML IdP single sign-on URL.

Example: https://idp.example.com/sso
idp_x509_certstring

SAML IdP X.509 signing certificate (PEM).

issuerstring

OIDC issuer URL.

Example: https://accounts.example.com
sign_authn_requestsboolean

SAML only — sign SP-initiated AuthnRequests with the SP key (HTTP-Redirect binding).

Example: false
created_atstring · date-time

The date and time when the SSO connection was created.

Example: 2021-08-10T10:00:00.000Z
default_environment_idsstring[]

Environment IDs that provisioned users are granted access to by default.

default_rolestring

The role assigned to users provisioned through this connection.

Example: member
enforcedboolean

Whether SSO login is enforced for users on the connection's verified domains.

Example: false
idstring · uuid

The ID of the SSO connection.

Example: 1ba1f401-7183-47c5-9e39-e8e257e3c795
is_activeboolean

Whether this SSO connection is active.

Example: true
is_defaultboolean

Whether this is the team's default SSO connection.

Example: false
protocolstring

The SSO protocol used by this connection.

Example: saml
Possible values:
samloidc
team_idstring · uuid

The ID of the team that owns this SSO connection.

Example: 05daecaf-4365-42e8-8370-8127de5dd717
updated_atstring · date-time

The date and time when the SSO connection was last updated.

Example: 2021-08-10T10:30:00.000Z

Errors

StatusDescription
400Bad request if required fields are missing
403Forbidden if the user is not an admin of the specified team. API tokens are never team admins, so they always get 403.
curl -X POST 'https://api.truto.one/sso-connection' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "team_id": "05daecaf-4365-42e8-8370-8127de5dd717",
  "protocol": "saml",
  "is_active": true,
  "enforced": false,
  "is_default": false,
  "config": {},
  "client_secret": "rp-secret-value",
  "default_role": "member",
  "default_environment_ids": []
}'
const body = {
  "team_id": "05daecaf-4365-42e8-8370-8127de5dd717",
  "protocol": "saml",
  "is_active": true,
  "enforced": false,
  "is_default": false,
  "config": {},
  "client_secret": "rp-secret-value",
  "default_role": "member",
  "default_environment_ids": []
};

const response = await fetch('https://api.truto.one/sso-connection', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.truto.one/sso-connection"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "team_id": "05daecaf-4365-42e8-8370-8127de5dd717",
    "protocol": "saml",
    "is_active": True,
    "enforced": False,
    "is_default": False,
    "config": {},
    "client_secret": "rp-secret-value",
    "default_role": "member",
    "default_environment_ids": []
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())