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

Authentication

MIDAPI v2 endpoints are authenticated with a consumer JWT token sent in the Authorization: Bearer <token> header. The token is issued based on the two concepts introduced in MIDAPI v2: the client platform issues tokens for its consumers, and each operational request is made on behalf of a consumer.

Identification headers

Header
Description

platform-id

Identifies the client platform. Required only when issuing a consumer token (POST /consumer/token).

platform-api-key

Client platform API key. Required only when issuing a consumer token (POST /consumer/token).

consumer-id

Identifies the channel/consumer. Required for all operational endpoints.

Operational endpoint requirements

All MIDAPI v2 operational endpoints require:

  • OAuth2 authentication: header Authorization: Bearer <token>, obtained via POST /consumer/token (RS256-signed JWT, see below).

  • Header consumer-id: consumer identifier. Required and must not be empty.

  • Header operation-id: identifier of the operation to which the referenced assets belong, as returned by POST /operation. Required for any endpoint whose request references stored assets, and always for Document Validation, which only accepts references.

MIDAPI v2 does not use x-api-key authentication. The scheme is OAuth2 Bearer + consumer-id (and operation-id in requests that reference stored assets).

Obtain a consumer token

Before calling any operational endpoint, the consumer must obtain a JWT token and send it in the header Authorization: Bearer <token>. The token is issued by Facephi and includes the consumer-id and the scopes corresponding to the services enabled for that consumer.

Endpoint

POST /consumer/token

Headers

Name
Type
Required
Description

platform-id

string

Yes

Client platform identifier.

platform-api-key

string

Yes

Client platform API Key.

Request body

Content-Type: application/json

Parameters

Parameter
Type
Required
Description

consumerId

string

Yes

Identifier of the consumer (channel or vertical) for which the token is requested.

Request example

Responses

200 Success

Response parameters

Parameter
Type
Description

consumerId

string

Consumer for which the token was issued.

token

string

JWT Token to send in the header Authorization: Bearer <token>.

expiresAt

string

Token expiration date and time in ISO 8601.

Response example

The token has a validity period of 1 hour from the time it is issued (the exact expiration time is returned in the expiresAt). Once it expires, simply request a new one using the same endpoint. For each request, the signature, issuer, consumer-id, expiration, and token scopes are validated.

Last updated