Exchange Carrier OIDC Token for Hiya JWT
POST/v1/auth/token
Exchanges a carrier-issued OIDC access token for a Hiya-scoped JWT bearer token.
Overview
This endpoint implements a federated token exchange flow:
- The client obtains an OIDC access token from the carrier's identity provider
- The client presents this token to Hiya's backend
- Hiya validates the token (issuer, audience, signature, and claims)
- Upon successful validation, Hiya mints a short-lived JWT for API authorization
Token Validation
Hiya validates the following claims from the carrier OIDC token:
- iss (issuer): Must match the configured carrier identity provider
- aud (audience): Must include Hiya's registered client ID
- exp (expiration): Token must not be expired
- sub (subject): Used to identify the user account
Response
On success, returns a Hiya JWT token with:
- Short expiration time (configurable, typically 1 hour)
- Scoped claims for least-privilege API access
- Refresh token for obtaining new access tokens
Header Parameters
Product version. The standard "major.minor.patch" format is highly encouraged without any leading characters; "2.1.3" or "3.0.0" for example.
Body
requiredOIDC ID token issued by the carrier's identity provider. This token must be valid, unexpired, and contain the required claims for user identification.
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0...Responses
- 200
- 400
- 500
OK
Response Body
Unique user ID used to identify this particular user (used for all subsequent API calls)
550e8400-e29b-41d4-a716-446655440000JWT token which must be passed in Bearer authentication to subsequent API requests
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1NTBlODQwMC1lMjliLTQxZDQtYTcxNi00NDY2NTU0NDAwMDAiLCJpYXQiOjE3MDAwMDAwMDAsImV4cCI6MTcwMDAzNjAwMH0...The UTC timestamp when the jwt token will expire in ISO 8601 format (including milliseconds).
string<date-time>2024-12-21T12:00:00.000ZExample from Schema
{
"userId": "550e8400-e29b-41d4-a716-446655440000",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1NTBlODQwMC1lMjliLTQxZDQtYTcxNi00NDY2NTU0NDAwMDAiLCJpYXQiOjE3MDAwMDAwMDAsImV4cCI6MTcwMDAzNjAwMH0...",
"jwtExpiresAt": "2024-12-21T12:00:00.000Z"
}
Bad Request
Response Body
A unique error ID for tracking and support purposes. Include this ID when contacting support.
err_7f3b9c2a-1234-5678-9abc-def012345678HTTP status code mirrored in the response body for convenience.
400A developer-friendly error message with technical details for debugging.
Invalid phone number format. Expected E.164 format (e.g., +14155551234)A user-friendly error message safe to display in the UI. Localized based on the Accept-Language header when available.
The phone number you entered is not valid. Please check and try again.Example from Schema
{
"errorId": "err_7f3b9c2a-1234-5678-9abc-def012345678",
"status": 400,
"errorDescription": "Invalid phone number format. Expected E.164 format (e.g., +14155551234)",
"displayError": "The phone number you entered is not valid. Please check and try again."
}
Internal Server Error
Response Body
A unique error ID for tracking and support purposes. Include this ID when contacting support.
err_7f3b9c2a-1234-5678-9abc-def012345678HTTP status code mirrored in the response body for convenience.
400A developer-friendly error message with technical details for debugging.
Invalid phone number format. Expected E.164 format (e.g., +14155551234)A user-friendly error message safe to display in the UI. Localized based on the Accept-Language header when available.
The phone number you entered is not valid. Please check and try again.Example from Schema
{
"errorId": "err_7f3b9c2a-1234-5678-9abc-def012345678",
"status": 400,
"errorDescription": "Invalid phone number format. Expected E.164 format (e.g., +14155551234)",
"displayError": "The phone number you entered is not valid. Please check and try again."
}