Skip to main content

API Reference

Complete reference for the Identivia Backend API.

Base URL

https://api.<your-domain>

Authentication

All endpoints require authentication via bearer JWT.

Authorization: Bearer your_jwt

JWTs are validated with HS256 against the backend's JWT_SECRET and should include the appropriate route scopes.

Token Issuance

Use the machine-token endpoint to obtain a JWT for Postman or server-to-server access.

POST /api/auth/token

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json

Request Body

FieldTypeRequiredDescription
client_idstringYesConfigured token client ID
client_secretstringYesConfigured token client secret
scopestringNoOptional requested scope subset

Example Request

curl -X POST https://api.identivia.com/api/auth/token \
-H "Content-Type: application/json" \
-d '{
"client_id": "postman",
"client_secret": "replace-me",
"scope": "profiles:read health:read"
}'

Success Response (200 OK)

{
"access_token": "eyJ...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "profiles:read health:read"
}

Endpoints

MethodEndpointAuthDescription
POST/api/auth/tokenNoIssue a machine JWT
GET/YesHealth check
POST/api/profiles/createYesCreate a verification profile
GET/api/profiles/:idYesRetrieve a profile by ID
PATCH/api/profiles/:idYesUpdate a profile (status, files)
POST/api/face-liveness/sessionYesCreate an AWS Face Liveness session
GET/api/face-liveness/results/:sessionIdYesGet Face Liveness session results
POST/api/ollama/document-analysisYesAnalyze a document image with AI
GET/api/aws/credentialsYesGet temporary AWS credentials
GET/api/settingsYesFetch application settings
POST/api/status_history/:idYesCreate a status history record
POST/api/verification_history/:idYesCreate a verification history record

Health Check

Check if the API is running and view service status.

GET /

Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT

Response

{
"status": "OK",
"service": "Identivia Integration API with AWS Face Liveness",
"timestamp": "2026-03-21T00:00:00.000Z",
"uptime": 12345.67,
"memory": {
"rss": "120 MB",
"heapTotal": "60 MB",
"heapUsed": "45 MB"
},
"pocketbase_status": "authenticated",
"pocketbase_url": "https://pocketbase.identivia.com",
"pocketbase_user_email": "admin@example.com",
"aws_faceliveness_status": "configured",
"openai_model": "o4-mini",
"openai_status": "configured",
"faceliveness_threshold": 75,
"fingerprint_status": "configured"
}

Create Profile

Create a new verification profile. If a profile with the same userID already exists, the existing profile is returned instead.

POST /api/profiles/create

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
AuthorizationYesBearer JWT

Request Body

FieldTypeRequiredDescription
userIDstringYesUnique identifier for the user (used to deduplicate profiles)
namestringNoFull name of the individual
documentTypestringNoType of document (e.g., passport, national_id, driving_license)
documentNumberstringNoDocument number
countrystringNoCountry of origin or document issuance
phoneNumberstringNoPhone number
emailstringNoEmail address
securityLevelstringNoSecurity level for the verification
genderstringNoGender (male, female, unknown)
ipAddressstringNoIP address of the user
languagestringNoPreferred language
teamstringNoTeam ID to associate the profile with. Defaults to the authenticated user's team if omitted.

Example Request

curl -X POST https://api.identivia.com/api/profiles/create \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_jwt" \
-d '{
"userID": "user-12345",
"name": "John Doe",
"documentType": "passport",
"documentNumber": "A12345678",
"country": "US",
"email": "john@example.com",
"securityLevel": "high"
}'

Success Response (201 Created)

Returned when a new profile is created.

{
"success": true,
"url": "https://app.identivia.com/abc123def456?token=FLOW_TOKEN",
"id": "abc123def456",
"flow_token": "FLOW_TOKEN"
}

Success Response (200 OK)

Returned when a profile with the given userID already exists.

{
"success": true,
"url": "https://app.identivia.com/abc123def456?token=FLOW_TOKEN",
"id": "abc123def456",
"flow_token": "FLOW_TOKEN",
"message": "Existing record found"
}

The returned url is browser-ready and includes a short-lived verification flow token scoped to that single profile.

Error Response (400 Bad Request)

{
"error": "Missing required fields",
"required": ["userID"]
}

Error Response (401 Unauthorized)

{
"error": "Missing bearer token"
}

Get Profile

Retrieve a profile by its ID.

GET /api/profiles/:id

Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT

Path Parameters

ParameterDescription
idThe profile record ID

Example Request

curl https://api.identivia.com/api/profiles/abc123def456 \
-H "Authorization: Bearer your_jwt"

Success Response (200 OK)

{
"success": true,
"data": {
"name": "John Doe",
"document_type": "passport",
"document_number": "A12345678",
"country": "US",
"language": "en",
"verification_status": "unverified",
"status": "pending",
"security_level": "high",
"createdAt": "2026-03-21 00:00:00.000Z",
"verification_history": {
"id": "vh_record_id",
"profile": "abc123def456",
"status": "pending",
"liveness_session_id": "session-xyz",
"liveness_confidence": 95.5,
"liveness_status": "live",
"document_type": "passport",
"name": "John Doe",
"document_number": "A12345678",
"country": "US",
"created": "2026-03-21 00:00:00.000Z",
"updated": "2026-03-21 00:00:00.000Z"
}
}
}
info

The status field reflects the latest status from status_history, while verification_status reflects the profile's own status field. These may differ if a status change has been recorded.

Error Response (404 Not Found)

{
"error": "Identivia record not found",
"message": "Invalid or expired ID"
}

Update Profile

Update an existing profile's verification status and upload files.

PATCH /api/profiles/:id

Headers

HeaderRequiredDescription
Content-TypeYesmultipart/form-data
AuthorizationYesBearer JWT

Path Parameters

ParameterDescription
idThe profile record ID

Request Body (multipart/form-data)

FieldTypeRequiredDescription
verification_statusstringNoOne of: unverified, pending, verified, rejected
document_typestringNoDocument type
document_numberstringNoDocument number
document_namestringNoDocument name
countrystringNoCountry
face_liveness_session_idstringNoAWS Face Liveness session ID
face_liveness_confidencenumberNoFace liveness confidence score
face_liveness_statusstringNoFace liveness status
face_liveness_resultstring/objectNoFull face liveness result
document_frontfileNoFront of the identity document
document_backfileNoBack of the identity document
facial_photofileNoFacial photo for liveness/verification
facial_videofileNoFacial video for liveness/verification

Success Response (200 OK)

{
"success": true,
"message": "Record updated successfully",
"data": {
"id": "abc123def456",
"status": "pending",
"document_type": "passport",
"document_number": "A12345678",
"document_name": "John Doe",
"country": "US",
"document_front": "filename.jpg",
"document_back": "filename.jpg",
"facial_photo": "photo.jpg",
"facial_video": "video.webm",
"updated": "2026-03-21 00:00:00.000Z"
}
}

Create Face Liveness Session

Create a new AWS Rekognition Face Liveness session.

POST /api/face-liveness/session

Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT

Success Response (200 OK)

{
"success": true,
"sessionId": "session-uuid-here",
"message": "Face Liveness session created successfully",
"challengeType": "FaceMovementAndLightChallenge"
}

Error Response (501 Not Implemented)

{
"error": "AWS credentials not configured",
"message": "AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set in environment variables"
}

Get Face Liveness Results

Retrieve the results of a completed Face Liveness session.

GET /api/face-liveness/results/:sessionId

Path Parameters

ParameterDescription
sessionIdThe Face Liveness session ID

Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT

Success Response (200 OK)

{
"success": true,
"data": {
"sessionId": "session-uuid-here",
"confidenceScore": 95.5,
"isLive": true,
"referenceImage": {
"bytes": "base64-encoded-image",
"boundingBox": { "Width": 0.5, "Height": 0.6, "Left": 0.2, "Top": 0.1 }
},
"auditImages": []
},
"message": "Face Liveness results retrieved successfully"
}

Error Response (404 Not Found)

{
"error": "Session not found",
"message": "Face Liveness session ID is invalid or expired"
}

Document Analysis

Analyze an identity document image using OpenAI Vision to extract structured data.

POST /api/ollama/document-analysis

Headers

HeaderRequiredDescription
Content-TypeYesmultipart/form-data
AuthorizationYesBearer JWT

Request Body (multipart/form-data)

FieldTypeRequiredDescription
document_frontfileYesImage of the document to analyze
document_type_hintstringNoHint for the document type
document_number_hintstringNoHint for the document number
full_name_hintstringNoHint for the full name on the document

Success Response (200 OK)

{
"success": true,
"data": {
"model": "o4-mini",
"analysis": "{ ... raw JSON string ... }",
"analysis_json": {
"name": "John Doe",
"document_number": "A12345678",
"country": "US",
"document_type": "passport",
"address": "",
"gender": "male",
"date_of_birth": "1990-01-15 00:00:00.000Z",
"authenticity": "authentic"
},
"verification_history_fields": {
"name": "John Doe",
"document_number": "A12345678",
"country": "US",
"address": null,
"gender": "male",
"date_of_birth": "1990-01-15"
},
"document": {
"name": "passport.jpg",
"mimetype": "image/jpeg",
"size": 102400
},
"usage": {
"prompt_tokens": 500,
"completion_tokens": 120,
"total_tokens": 620
}
}
}

Get Temporary AWS Credentials

Retrieve temporary AWS credentials scoped to Rekognition Face Liveness operations for direct client-side usage.

GET /api/aws/credentials

Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT

Success Response (200 OK)

{
"success": true,
"data": {
"accessKeyId": "ASIA...",
"secretAccessKey": "...",
"sessionToken": "...",
"expiration": "2026-03-21T00:15:00.000Z"
}
}
note

Credentials expire after 15 minutes and are scoped only to rekognition:StartFaceLivenessSession and rekognition:GetFaceLivenessSessionResults.


Get Settings

Fetch application settings stored in the PocketBase settings collection.

GET /api/settings

Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT

Success Response (200 OK)

{
"success": true,
"data": {
"setting_key_1": "value_1",
"setting_key_2": "value_2"
}
}

Create Status History

Record a status change for a profile.

POST /api/status_history/:id

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
AuthorizationYesBearer JWT

Path Parameters

ParameterDescription
idThe profile record ID

Request Body

FieldTypeRequiredDescription
previous_statusstringYesThe previous status value
new_statusstringYesThe new status value
notesstringYesNotes about the status change
verificationstringNoAssociated verification record ID

Success Response (201 Created)

{
"success": true,
"message": "Status history record created",
"data": {
"id": "sh_record_id",
"profile": "abc123def456",
"updated_by": "user_record_id",
"previous_status": "unverified",
"new_status": "pending",
"notes": "Verification submitted",
"created": "2026-03-21 00:00:00.000Z"
}
}

Create Verification History

Create a detailed verification history record for a profile, including liveness data, document images, and Fingerprint device data.

POST /api/verification_history/:id

Headers

HeaderRequiredDescription
Content-TypeYesmultipart/form-data
AuthorizationYesBearer JWT

Path Parameters

ParameterDescription
idThe profile record ID

Request Body (multipart/form-data)

FieldTypeRequiredDescription
liveness_session_idstringYesAWS Face Liveness session ID
liveness_confidencenumberYesLiveness confidence score
document_typestringYesDocument type
liveness_statusstringYesLiveness status (e.g., live, not_live)
document_numberstringNoDocument number
countrystringNoCountry
namestringNoFull name extracted from document
addressstringNoAddress extracted from document
genderstringNoGender extracted from document
date_of_birthstringNoDate of birth (ISO format)
fingerprintstring/objectNoFingerprintJS visitor data (JSON)
ip_addressstringNoClient IP address
facial_photofileNo*Facial photo (falls back to profile's file)
document_frontfileNo*Document front (falls back to profile's file)
document_backfileNo*Document back (required for non-passport documents, falls back to profile's file)
info

Files (facial_photo, document_front, document_back) are required for the verification record. If not uploaded in this request, the API will attempt to copy them from the parent profile record. The request will fail if required files are unavailable from either source.

Success Response (201 Created)

{
"success": true,
"message": "Verification history record created",
"data": {
"id": "vh_record_id",
"profile": "abc123def456",
"liveness_session_id": "session-xyz",
"liveness_confidence": 95.5,
"document_type": "passport",
"document_number": "A12345678",
"facial_photo": "photo.jpg",
"document_front": "front.jpg",
"document_back": "",
"country": "US",
"liveness_status": "live",
"name": "John Doe",
"address": "",
"created": "2026-03-21 00:00:00.000Z",
"updated": "2026-03-21 00:00:00.000Z"
}
}

Error Codes

Common error responses across all endpoints:

Status CodeDescription
400Bad Request — Missing or invalid fields
401Unauthorized — Missing or invalid API key
403Forbidden — AWS access denied
404Not Found — Resource not found
500Internal Server Error
501Not Implemented — Required service not configured (e.g., AWS credentials)
502Bad Gateway — External service request failed (e.g., OpenAI)