Middleware API v2
Middleware API v2 is the synchronous REST API in the Facephi API ecosystem. It exposes identity verification and anti-fraud services through OAuth2-authenticated REST endpoints, designed for integrators and backend developers.
Concepts: customer platform and consumer
Before integrating any Middleware API v2 service, it is helpful to understand the two concepts that organize access:
Customer platform: represents the unique relationship between the customer and Facephi. It is identified by the
platform-idheader and has an API key associated with it. Each customer has a single platform.Consumer: represents a business channel or vertical for the customer (for example, the web channel and mobile app, or verticals such as insurance and investments). It is identified by the
consumer-idheader. Each consumer has only the services contracted for that channel enabled, with independent usage limits and traceability.
As part of service onboarding, the customer will be provided with the API base URL the platform credentials and at least one consumer (one for each channel or vertical to be integrated). All routes in this guide are relative to that base URL (for example, POST <URL base>/consumer/token). This model allows permissions, limits, and traceability to be managed independently for each channel, while maintaining a single platform per customer.
These two concepts are used to obtain an access token: the platform issues tokens for its consumers, and each operational call is made on behalf of a consumer. See Authentication.
Authorizations
All calls to operational endpoints must include the following keys in the request header:
Authorization
Consumer token in the format Bearer <token>
Yes
consumer-id
Consumer identifier
Yes
operation-id
Identifier of the operation for the referenced assets
Conditional
The operation-id header is required when the request references an asset by key. See Storage.
Error responses
All endpoints return errors using the same structure:
message
string
Error description.
statusCode
integer
HTTP response code.
The asset model
Middleware API v2 validation services work with assets: end-user captures. An asset can be provided with its contents inline in the call itself, or by referencing a previously stored asset.
Key-based reference is available in all identity validation services identity. The exceptions are explicit: Form OCR and voice services are online-only, and Document Validation is reference-only.
The reference-based flow is: create the operation, store each asset, and send the resulting keys to the validation service along with the operation-id. It is explained step by step, with its diagram, in Common Flow. Services that support both modes identify the reference with source: FILE_KEY; those that only support references do not include this field. The asset mode, available contexts, and key format are described in Storage.
Available services
Operations: operation lifecycle that groups a session's assets and sets their expiration.
Storage: storage for assets that validation services reference later, including the asset mode, contexts, and key format.
Document Services: identity document authenticity validation, identity OCR, and form OCR.
Biometric Services: liveness check and face matching.
Biometric User: user enrollment, authentication, maintenance, and deletion using their facial template.
Face Collections: face registration and 1:N search in collections.
Injection Attack Detection: injection attack detection on face capture.
Validation Services: IP, email, and phone fraud risk.
Voice Services: voice enrollment and authentication.
Last updated