Aira

SSO (Single Sign-On)

Configure SAML and OIDC single sign-on for your organization.

Admin endpoints require owner role and a Business plan or higher. Public auth endpoints are rate-limited but require no authentication. Base URL: https://api.airaproof.com/api/v1

Overview

Aira supports both SAML 2.0 and OIDC single sign-on. The flow works as follows:

  1. The frontend calls SSO Check with the user's email to detect if SSO is enabled for their domain.
  2. If enabled, the user is redirected to the SSO Login endpoint, which sends them to the identity provider (IdP).
  3. After authentication, the IdP posts back to the ACS (SAML) or OIDC Callback endpoint.
  4. Aira generates a one-time exchange code and redirects to the frontend.
  5. The frontend calls SSO Exchange to swap the code for a JWT token.

Owners configure SSO via the admin endpoints at the bottom of this page.


SSO Check

GET /api/v1/auth/sso/check?email={email}

Check if an email address belongs to a domain with SSO configured.

Query Parameters

FieldTypeRequiredDescription
emailstringYesFull email address to check

Response (200)

{
  "sso_enabled": true,
  "enforced": false,
  "org_slug": "acme-abc123"
}
FieldTypeDescription
sso_enabledbooleanWhether SSO is configured for this email domain
enforcedbooleanWhether SSO is the only allowed login method
org_slugstring or nullOrganization slug (only present when sso_enabled is true)

cURL

curl "https://api.airaproof.com/api/v1/auth/sso/check?email=jane@acme.com"

SSO Login

GET /api/v1/auth/sso/login/{org_slug}

Auto-detects the configured protocol (SAML or OIDC) and redirects the user to the identity provider. Returns a 302 redirect.

Path Parameters

FieldTypeRequiredDescription
org_slugstringYesOrganization slug

cURL

curl -L "https://api.airaproof.com/api/v1/auth/sso/login/acme-abc123"

Error Redirects

Query ParameterDescription
error=org_not_foundOrganization does not exist
error=sso_not_configuredSSO is not configured for this organization

SAML ACS (Assertion Consumer Service)

POST /api/v1/auth/sso/acs
Content-Type: application/x-www-form-urlencoded

Receives the SAML response from the IdP. Validates the assertion, finds or creates the user, generates an exchange code, and redirects to the frontend at /sso/callback?code={code}.

This endpoint is called by the identity provider, not by your application directly.

Form Fields

FieldTypeRequiredDescription
SAMLResponsestringYesBase64-encoded SAML response from IdP
RelayStatestringNoOrganization slug (used to identify the org)

Error Redirects

Query ParameterDescription
error=sso_validation_failedSAML response validation failed
error=sso_failedOrganization not found or no valid assertion

OIDC Login

GET /api/v1/auth/sso/oidc/login/{org_slug}

Redirects to the OIDC authorization URL. Only works for organizations with OIDC configured. Returns a 302 redirect.

Path Parameters

FieldTypeRequiredDescription
org_slugstringYesOrganization slug

cURL

curl -L "https://api.airaproof.com/api/v1/auth/sso/oidc/login/acme-abc123"

Error Redirects

Query ParameterDescription
error=org_not_foundOrganization does not exist
error=sso_not_configuredOIDC is not configured for this organization

OIDC Callback

GET /api/v1/auth/sso/oidc/callback?code={code}&state={state}

Handles the OIDC provider callback. Exchanges the authorization code for tokens, finds or creates the user, generates an exchange code, and redirects to the frontend at /sso/callback?code={code}.

This endpoint is called by the identity provider, not by your application directly.

Query Parameters

FieldTypeRequiredDescription
codestringYesAuthorization code from the OIDC provider
statestringYesState parameter for CSRF protection

Error Redirects

Query ParameterDescription
error=sso_failedOIDC token exchange or user creation failed

SSO Exchange

POST /api/v1/auth/sso/exchange
Content-Type: application/json

Exchange a one-time SSO code for a JWT token. The code is generated after successful SAML or OIDC authentication and is valid for a single use.

Request Body

FieldTypeRequiredDescription
codestringYesOne-time exchange code from the SSO callback

Response (200)

{
  "token": "eyJ...",
  "expires_in": 86400,
  "org_uuid": "uuid",
  "user_uuid": "uuid"
}
FieldTypeDescription
tokenstringJWT access token
expires_inintegerToken lifetime in seconds
org_uuidstringOrganization UUID
user_uuidstringUser UUID

cURL

curl -X POST https://api.airaproof.com/api/v1/auth/sso/exchange \
  -H "Content-Type: application/json" \
  -d '{"code": "abc123..."}'

Errors

StatusCodeDescription
400SSO_EXCHANGE_ERRORInvalid, expired, or already-used code

SP Metadata

GET /api/v1/auth/sso/metadata/{org_slug}

Returns the SAML Service Provider metadata XML. Use this URL when configuring your identity provider.

Path Parameters

FieldTypeRequiredDescription
org_slugstringYesOrganization slug

Response (200)

Returns application/xml content with the SP entity ID, ACS URL, and certificate.

cURL

curl "https://api.airaproof.com/api/v1/auth/sso/metadata/acme-abc123"

Errors

StatusDescription
404Organization not found

Configure SAML SSO

POST /api/v1/sso/configure
Authorization: Bearer <token>
Content-Type: application/json

Upload IdP metadata XML to configure SAML SSO. Requires owner role and Business plan or higher.

Request Body

FieldTypeRequiredDescription
idp_metadata_xmlstringYesFull IdP metadata XML string

Response (200)

{
  "enabled": true,
  "enforced": false,
  "protocol": "saml",
  "idp_entity_id": "https://idp.example.com/metadata",
  "sp_entity_id": "https://api.airaproof.com/api/v1/auth/sso/metadata/acme-abc123",
  "sp_acs_url": "https://api.airaproof.com/api/v1/auth/sso/acs",
  "sp_metadata_url": "https://api.airaproof.com/api/v1/auth/sso/metadata/acme-abc123",
  "oidc_issuer_url": null,
  "oidc_client_id": null
}

cURL

curl -X POST https://api.airaproof.com/api/v1/sso/configure \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"idp_metadata_xml": "<?xml version=\"1.0\"?>..."}'

Errors

StatusCodeDescription
400SSO_CONFIG_ERRORInvalid metadata XML
403PLAN_REQUIREDOrganization is not on Business plan or higher

Configure OIDC SSO

POST /api/v1/sso/configure-oidc
Authorization: Bearer <token>
Content-Type: application/json

Configure OIDC SSO with client credentials and issuer URL. Requires owner role and Business plan or higher.

Request Body

FieldTypeRequiredDescription
client_idstringYesOIDC client ID from your identity provider
client_secretstringYesOIDC client secret
issuer_urlstringYesOIDC issuer URL (e.g. https://accounts.google.com)

Response (200)

{
  "enabled": true,
  "enforced": false,
  "protocol": "oidc",
  "idp_entity_id": null,
  "sp_entity_id": "https://api.airaproof.com/api/v1/auth/sso/metadata/acme-abc123",
  "sp_acs_url": null,
  "sp_metadata_url": null,
  "oidc_issuer_url": "https://accounts.google.com",
  "oidc_client_id": "123456.apps.googleusercontent.com"
}

cURL

curl -X POST https://api.airaproof.com/api/v1/sso/configure-oidc \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "123456.apps.googleusercontent.com",
    "client_secret": "GOCSPX-...",
    "issuer_url": "https://accounts.google.com"
  }'

Errors

StatusCodeDescription
400SSO_CONFIG_ERRORInvalid credentials or unreachable issuer
403PLAN_REQUIREDOrganization is not on Business plan or higher

Enforce SSO

POST /api/v1/sso/enforce
Authorization: Bearer <token>
Content-Type: application/json

Enable or disable SSO enforcement. When enforced, users with matching email domains must use SSO to log in. Requires owner role.

Request Body

FieldTypeRequiredDescription
enforcebooleanYestrue to require SSO, false to make it optional

Response (200)

{
  "message": "SSO enforcement enabled"
}

cURL

curl -X POST https://api.airaproof.com/api/v1/sso/enforce \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"enforce": true}'

Errors

StatusCodeDescription
400SSO_ENFORCE_ERRORSSO is not configured yet

Get SSO Config

GET /api/v1/sso
Authorization: Bearer <token>

Returns the current SSO configuration for your organization. Requires owner role.

Response (200) -- SSO configured

{
  "enabled": true,
  "enforced": false,
  "protocol": "saml",
  "idp_entity_id": "https://idp.example.com/metadata",
  "sp_entity_id": "https://api.airaproof.com/api/v1/auth/sso/metadata/acme-abc123",
  "sp_acs_url": "https://api.airaproof.com/api/v1/auth/sso/acs",
  "sp_metadata_url": "https://api.airaproof.com/api/v1/auth/sso/metadata/acme-abc123",
  "oidc_issuer_url": null,
  "oidc_client_id": null
}

Response (200) -- SSO not configured

{
  "enabled": false,
  "enforced": false,
  "protocol": null,
  "idp_entity_id": null,
  "sp_entity_id": null,
  "sp_acs_url": null,
  "sp_metadata_url": null,
  "oidc_issuer_url": null,
  "oidc_client_id": null
}

Response Fields

FieldTypeDescription
enabledbooleanWhether SSO is configured
enforcedbooleanWhether SSO login is mandatory
protocolstring or null"saml" or "oidc"
idp_entity_idstring or nullSAML IdP entity ID
sp_entity_idstring or nullService Provider entity ID
sp_acs_urlstring or nullSAML Assertion Consumer Service URL
sp_metadata_urlstring or nullSP metadata XML URL
oidc_issuer_urlstring or nullOIDC issuer URL
oidc_client_idstring or nullOIDC client ID

cURL

curl https://api.airaproof.com/api/v1/sso \
  -H "Authorization: Bearer <token>"

Delete SSO Config

DELETE /api/v1/sso
Authorization: Bearer <token>

Remove SSO configuration from the organization. This also disables enforcement. Requires owner role. Returns 204 No Content.

cURL

curl -X DELETE https://api.airaproof.com/api/v1/sso \
  -H "Authorization: Bearer <token>"

On this page