SSO
SSO provider configuration (SAML 2.0 & OIDC), domain discovery, and authentication flows.
/api/v1/organizations/:orgId/sso/providersCreate SSO ProviderBearer Token▾Create a new SSO provider (SAML 2.0 or OIDC) for an organization. Provide the protocol-specific fields that match the chosen protocol.
Parameters
Request Body
Response Fields
Response Example
{
"id": "sso_01hx9k2m4p",
"orgId": "org_01hx9k2m4p",
"name": "Okta Production",
"type": "OKTA",
"protocol": "SAML2",
"samlEntityId": "http://www.okta.com/exk1abc2defGHIJK",
"samlSsoUrl": "https://acme.okta.com/app/acme_sutraid/exk1abc/sso/saml",
"samlMetadataUrl": "https://acme.okta.com/app/exk1abc/sso/saml/metadata",
"attributeMapping": {
"email": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
},
"enabled": true,
"autoProvision": true,
"allowedDomains": [
"acme.com"
],
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
}Code Examples
/api/v1/organizations/:orgId/sso/providersList SSO ProvidersBearer Token▾Retrieve all SSO providers configured for an organization.
Parameters
Response Fields
Response Example
{
"data": [
{
"id": "sso_01hx9k2m4p",
"orgId": "org_01hx9k2m4p",
"name": "Okta Production",
"type": "OKTA",
"protocol": "SAML2",
"enabled": true,
"autoProvision": true,
"allowedDomains": [
"acme.com"
],
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
},
{
"id": "sso_02hy0l3n5q",
"orgId": "org_01hx9k2m4p",
"name": "Azure AD",
"type": "AZURE_AD",
"protocol": "OIDC",
"enabled": true,
"autoProvision": false,
"allowedDomains": [
"acme.io"
],
"createdAt": "2024-02-01T08:30:00.000Z",
"updatedAt": "2024-02-01T08:30:00.000Z"
}
]
}Code Examples
/api/v1/organizations/:orgId/sso/providers/:providerIdGet SSO ProviderBearer Token▾Retrieve a single SSO provider by ID.
Parameters
Response Fields
Response Example
{
"id": "sso_01hx9k2m4p",
"orgId": "org_01hx9k2m4p",
"name": "Okta Production",
"type": "OKTA",
"protocol": "SAML2",
"samlEntityId": "http://www.okta.com/exk1abc2defGHIJK",
"samlSsoUrl": "https://acme.okta.com/app/acme_sutraid/exk1abc/sso/saml",
"samlMetadataUrl": "https://acme.okta.com/app/exk1abc/sso/saml/metadata",
"attributeMapping": {
"email": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
},
"enabled": true,
"autoProvision": true,
"allowedDomains": [
"acme.com"
],
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
}Code Examples
/api/v1/organizations/:orgId/sso/providers/:providerIdUpdate SSO ProviderBearer Token▾Update an existing SSO provider. All fields from CreateSsoProviderDto are accepted; only provided fields are updated.
Parameters
Request Body
Response Fields
Response Example
{
"id": "sso_01hx9k2m4p",
"orgId": "org_01hx9k2m4p",
"name": "Okta Production v2",
"type": "OKTA",
"protocol": "SAML2",
"samlEntityId": "http://www.okta.com/exk1abc2defGHIJK",
"samlSsoUrl": "https://acme.okta.com/app/acme_sutraid/exk1abc/sso/saml",
"enabled": false,
"autoProvision": true,
"allowedDomains": [
"acme.com",
"acme.io"
],
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-03-10T12:00:00.000Z"
}Code Examples
/api/v1/organizations/:orgId/sso/providers/:providerIdDelete SSO ProviderBearer Token▾Permanently delete an SSO provider from an organization.
Parameters
Response Fields
Response Example
{
"success": true,
"message": "SSO provider deleted successfully."
}Code Examples
/api/v1/organizations/:orgId/sso/providers/:providerId/testTest SSO ConnectionBearer Token▾Validate the connectivity and configuration of an SSO provider without initiating an actual login flow.
Parameters
Response Fields
Response Example
{
"success": true,
"message": "Connection successful. IdP metadata is reachable."
}Code Examples
/api/v1/sso/discoverDiscover SSO Providers▾Discover which SSO providers are available for a given email domain. Used on the login page to determine whether to offer SSO options.
Parameters
Response Fields
Response Example
{
"providers": [
{
"id": "sso_01hx9k2m4p",
"orgId": "org_01hx9k2m4p",
"name": "Okta Production",
"type": "OKTA",
"protocol": "SAML2"
}
]
}Code Examples
/api/v1/sso/saml/:orgId/loginInitiate SAML Login▾Begin a SAML 2.0 SP-initiated login flow. The server constructs a SAML AuthnRequest and returns an HTTP 302 redirect to the IdP SSO URL.
Parameters
Response Fields
Response Example
{
"status": 302,
"headers": {
"Location": "https://acme.okta.com/app/acme_sutraid/exk1abc/sso/saml?SAMLRequest=PHNhbWxwOk..."
}
}Code Examples
/api/v1/sso/saml/:orgId/acsSAML Assertion Consumer Service (ACS)▾Receives the SAML response posted by the IdP after the user authenticates. The server validates the assertion, provisions or resolves the user, issues a JWT, and redirects to the frontend callback URL.
Parameters
Request Body
Response Fields
Response Example
{
"status": 302,
"headers": {
"Location": "https://app.sutraid.com/auth/sso/callback?token=eyJhbGciOiJSUzI1NiJ9..."
}
}Code Examples
/api/v1/sso/saml/:orgId/metadataGet SAML SP Metadata▾Returns the SAML Service Provider (SP) metadata XML for the given organization. Provide this URL or its content to your IdP during configuration.
Parameters
Response Fields
Response Example
{
"contentType": "application/xml",
"body": "<?xml version=\"1.0\"?><EntityDescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" entityID=\"https://api.sutraid.com/api/v1/sso/saml/org_01hx9k2m4p/metadata\">...</EntityDescriptor>"
}Code Examples
/api/v1/sso/oidc/:providerId/loginInitiate OIDC Login▾Begin an OIDC authorization code flow with PKCE. The server generates a code verifier/challenge pair, stores state, and returns an HTTP 302 redirect to the OIDC authorization endpoint.
Parameters
Response Fields
Response Example
{
"status": 302,
"headers": {
"Location": "https://acme.okta.com/oauth2/v1/authorize?response_type=code&client_id=0oa1abc&scope=openid+email+profile&redirect_uri=https%3A%2F%2Fapi.sutraid.com%2Fapi%2Fv1%2Fsso%2Foidc%2Fsso_02hy0l3n5q%2Fcallback&state=abc123&code_challenge=xyzPKCE&code_challenge_method=S256"
}
}Code Examples
/api/v1/sso/oidc/:providerId/callbackOIDC Callback▾Handles the authorization code callback from the OIDC provider. The server exchanges the code for tokens using PKCE, retrieves the user profile, provisions or resolves the user, issues a JWT, and redirects to the frontend callback URL.
Parameters
Response Fields
Response Example
{
"status": 302,
"headers": {
"Location": "https://app.sutraid.com/auth/sso/callback?token=eyJhbGciOiJSUzI1NiJ9..."
}
}