Rialto

Getting Started

Walk through receiving your Rialto credentials and making your first token exchange.

This guide walks you from receiving your Rialto credentials to a working token exchange.

Prerequisites

  • Credentials from Rialto -- you have received an org_id and api_key
  • An OIDC-compliant identity provider (Cognito, Auth0, Okta, Azure AD, etc.)
  • Your IdP issues JWT ID tokens containing sub and email claims

Important: You need ID tokens, not access tokens. ID tokens contain user identity claims like email. Access tokens (e.g., Cognito tokens with token_use: "access") typically do not include email and will be rejected.

Step 1: Store Your API Key

Your API key was provided when Rialto registered your organization. It follows this format:

rialto_ak_<org_id>_<random>

Store it securely -- in a vault, secrets manager, or encrypted environment variable. The API key is shown only once during registration and cannot be retrieved later.

Step 2: Exchange Your First Token

Obtain an ID token from your IdP for one of your users, then exchange it for Rialto tokens:

curl -X POST https://api.rialto.com/identity/auth/exchange \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rialto_ak_550e8400-e29b-41d4-a716-446655440000_K7j9nQ2mP_xYz1aB" \
  -d '{
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
  }'

Successful response (200):

{
  "access_token": "eyJhbGciOiJSUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 300,
  "refresh_token": "eyJhbGciOiJIUzI1NiIs...",
  "refresh_expires_in": 1800,
  "scope": "openid email profile aud:identity aud:primary-issuance"
}

On the first exchange for a given user, Rialto automatically creates a user record linked to your organization. Subsequent exchanges for the same email reuse the existing user.

Step 3: Use Rialto Tokens

Use the access_token as a Bearer token on all other Rialto API calls:

curl https://api.rialto.com/identity/users/<user_id> \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."

The access token contains custom claims your application can use:

ClaimDescription
org_idYour organization ID
org_nameYour organization name
user_idRialto user ID
emailUser's email address
kyc_completedWhether the user has passed KYC
accreditedWhether the user is accredited
accreditation_verifiedWhether accreditation has been verified

Token lifetimes:

  • Access token: ~5 minutes
  • Refresh token: ~30 minutes

When the refresh token expires, exchange a fresh ID token from your IdP.

Step 4: Set Up Webhooks (Optional)

Receive real-time notifications when events occur (KYC approved, subscription funded, etc.) by registering a webhook endpoint:

curl -X POST https://api.rialto.com/notifications/webhooks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <rialto_access_token>" \
  -d '{
    "url": "https://yourapp.com/webhooks/rialto",
    "eventTypes": ["kyc.session.approved", "subscription.created"]
  }'

The response includes a signing_secret for verifying webhook signatures. See the Webhooks Guide for full details.

What's Next

Troubleshooting

ErrorStatusCauseFix
missing_api_key401X-API-Key header not sentAdd the header to your request
invalid_api_key401Key is wrong, revoked, or has extra whitespaceVerify the key value; contact Rialto if lost
invalid_token (token must be a JWT)400Token is not a valid JWT (not 3 dot-separated parts)Ensure you're sending a properly formatted JWT
invalid_token (must contain email)400Token is missing email, preferred_username, and upn claimsUse an ID token, not an access token
invalid_token (must contain sub)400Token is missing the sub claimEnsure your IdP includes sub in the ID token
invalid_signature401JWT signature verification failed against your IdP's JWKSEnsure the token is freshly issued and not tampered with
token_expired401The ID token has expiredExchange a fresh token from your IdP
discovery_failed502Could not reach your IdP's /.well-known/openid-configurationVerify your IdP URL is publicly accessible
issuer_not_registered403The token's issuer URL is not registered with RialtoContact Rialto to register your IdP
org_mismatch403API key belongs to a different org than the token's issuerVerify you're using the correct API key for your IdP

On this page