Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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-id header 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:

Key
Value
Required

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:

Parameter
Type
Description

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

Last updated