Skip to main content

CPR API Reference

[POST] /v2/auth/token

Overview

The /v2/auth/token API generates authentication tokens for cross-platform resume (CPR) workflows. It creates a uniqueId based on user credentials (mobileNumber or email) and returns a JWT token for subsequent authentication.

Endpoint

MethodPOST
URLhttps://ind-state.idv.hyperverge.co/v2/auth/token
AuthenticationRequired

Authentication

warning

This API requires:

  • appId and appKey passed in the body must be valid credentials
  • IP whitelisting required — a valid IP must be whitelisted for the appId

The API also supports signature validation.

Request Parameters

ParameterTypeRequiredDefaultDescription
appIdStringYes-appId shared by HV
appKeyStringYes-appKey shared by HV
transactionIdStringYes-Unique identifier for a transaction/user
workflowIdStringYes-Identifier for the workflow
authenticateOnResumeStringNonoMust be 'yes' or 'no'. Controls authentication on workflow resumption
expiryNumberNo43200 (12 hours)Token expiry in seconds. Between 1 and 86400 (24 hours)
mobileNumberStringNo-User's mobile number — mutually exclusive with email
emailStringNo-User's email — mutually exclusive with mobileNumber
caution

You must provide either mobileNumber OR email, but not both.

More info about mobileNumber/email

Success Response (200 OK)

{
"statusCode": 200,
"status": "success",
"result": {
"authToken": "Bearer <token>",
"metadata": {
"appId": "<appId>",
"transactionId": "<transactionId>",
"workflowId": "<workflowId>",
"journeyId": "<journeyId>"
}
}
}

Error Responses

Generic error response structure:

{
"statusCode": "<statusCode>",
"status": "failure",
"error": "<error>",
"errorCode": "<errorCode>"
}
Status CodeError CodeDescription
400invalid_request_bodyRequest body validation failed
401unauthorized_accessIP not whitelisted or authorization failed
404workflow_not_foundWorkflow not found (incorrect workflowId)
409unique_id_conflictConflict in unique ID stored in DB vs generated
500internal_server_errorServer error
Detailed error messages for invalid_request_body
Error MessageCondition
"appId" is requiredappId field missing
"appKey" is requiredappKey field missing
"transactionId" is requiredtransactionId field missing
"workflowId" is requiredworkflowId field missing
"authenticateOnResume" must be one of [yes, no]Invalid value
"mobileNumber" must be a stringWrong type
"email" must be a stringWrong type
Only one of mobileNumber or email should be sentBoth provided
"expiry" must be greater than or equal to 1Below minimum
"expiry" must be less than or equal to 86400Above maximum
"expiry" must be a numberWrong type

Token Generation Logic

authObject (mobileNumber/email)authenticateOnResumeCreate uniqueId?Embed uniqueId in Token?
Provided"yes"YesNo
Provided"no"YesYes
Not Provided"yes"NoNo
Not Provided"no"NoNo

Key takeaways:

  • authenticateOnResume = "yes" + authObject provided: uniqueId created but NOT in token → client must re-authenticate on resume
  • authenticateOnResume = "no" + authObject provided: uniqueId created AND in token → client resumes without extra auth
  • No authObject → no uniqueId regardless of authenticateOnResume

Flowchart

flowchart TD
A[Start] --> B[Validate Request Parameters]
B --> C[Check IP Whitelisting]
C --> D{Transaction State Exists?}
D -->|Yes| E{Has Expired?}
D -->|No| F[Create Empty State]
E -->|Yes| G[Continue with Expired State]
E -->|No| H{Create uniqueId?}
G --> H
F --> I[Generate uniqueId from auth credentials]
H -->|Yes| I
H -->|No| J[Skip uniqueId Creation]
I --> K{Should Embed uniqueId in Token?}
J --> K
K -->|Yes| L[Generate Token with uniqueId]
K -->|No| M[Generate Token without uniqueId]
L --> N[Return Token and Metadata]
M --> N

Sample cURL

curl --location 'https://ind-state.idv.hyperverge.co/v2/auth/token' \
--header 'Content-Type: application/json' \
--data '{
"appId": "<appId>",
"appKey": "<appKey>",
"transactionId": "<transactionId>",
"workflowId": "<workflowId>",
"authenticateOnResume": "yes",
"mobileNumber": "<mobileNumber>"
}'

[POST] /v2/generate-auth-token [OLD]

warning

This endpoint is being replaced by /v2/auth/token above. Use the new endpoint for all new integrations.

Legacy endpoint details

Endpoint: POST https://ind-state.idv.hyperverge.co/v2/generate-auth-token

Same parameters as the new endpoint. Key differences:

  • Uses userAuthRequired instead of authenticateOnResume
  • Uses authObject instead of top-level mobileNumber/email
  • Response uses token instead of authToken

[POST] /v2/generate-unique-id (Deprecated)

danger

This endpoint is deprecated. Use /v2/auth/token instead.

Deprecated endpoint details

Endpoint: POST https://ind-state.idv.hyperverge.co/v2/generate-unique-id

This API generates a uniqueId for an appId, transactionId & workflowId, and creates a new state if state is not present in the backend.

Authentication is via appId/appKey headers or authorization header, plus IP whitelisting.

OwnerUnknown
Last reviewed onNever
Last updated onApr 10, 2026
Last updated bySrinija
Was this helpful?
Ask AI

Ask anything about the internal documentation

AI answers are based on internal documentation. Verify critical information.