Skip to main content

Passive Liveness Detection API in cURL: Send a Selfie, Read the JSON

Send a selfie to Didit's standalone Passive Liveness API using cURL and multipart form data. Read the request ID, liveness verdict, score, warnings and capture quality in the JSON response.

Passive Liveness Detection API in cURL: Send a Selfie, Read the JSON

Contents

In this guide

Jump to the part you need.

This guide is for developers who hold a selfie and want a liveness verdict from one server-to-server call, no hosted flow, no SDK. One cURL multipart request returns a status, a score, warnings and capture quality. Passive Liveness is published at $0.10 per completed check, read November 26, 2026. The caveat: one image checks for printed photos, screen replays, masks and deepfakes, but the user never has to move.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

Passive Liveness API at a glance
ItemValue
EndpointPOST https://verification.didit.me/v3/passive-liveness/
Authenticationx-api-key header, key taken from Developers then API keys in the Business Console
Request bodymultipart/form-data
Required fielduser_image, one front-facing face image such as a selfie
Accepted formatstiff, jpg, jpeg, png, webp. PDFs are not accepted
Maximum size5 MB, then compressed to about 0.5 MB before processing
Optional fieldssave_api_request (default true) and vendor_data
Returnsrequest_id plus liveness.status, liveness.method, liveness.score, liveness.warnings, liveness.face_quality, liveness.face_luminance, and a liveness.user_image object with liveness.user_image.entities and liveness.user_image.best_angle
Price$0.10 per completed check at list price, the published Passive Liveness price
Rate limit300 write requests per minute per API key, shared across POST, PATCH and DELETE
SandboxFree, never billed, returns a static Approved payload after input validation

Start free in the sandbox at https://business.didit.me/, with no sales call. For developers who want Didit reachable from an AI assistant, the MCP server setup is at https://didit.me/developers/mcp/. The product behind this endpoint is Didit Liveness Detection, and the endpoint reference lists every response field, warning code and severity. For plans, module prices and the cost estimator, see the Didit pricing page.

The minimum working request

Keep the key in the environment variable DIDIT_API_KEY, server side, and this is the whole call:

curl -X POST 'https://verification.didit.me/v3/passive-liveness/' \
-H "x-api-key: $DIDIT_API_KEY" \
-F 'user_image=@./selfie.jpg'

The two optional form fields go on separate lines when you need them:

-F 'save_api_request=false' \
-F 'vendor_data=user-123'

With the defaults, save_api_request is true, so the call is persisted as an API session and the detected face is enrolled in your face search index. Add save_api_request=false for a one-shot check in which Didit creates no API session, stores neither the reference image nor the face crop, and does not enroll the face. Blocklist and duplicate screening run on every live call either way, and prior faces carrying the same vendor_data are excluded from that screening.

Prerequisites before the first call

What you need in place
WhatDetail
PlanThe sandbox is free on every plan. On Free, Growth and Scale, live usage draws from available plan credit first and then from top-ups. Enterprise usage beyond invoiced credit is billed as overage. Every live 200 response consumes one Passive Liveness API credit, even when liveness.status is Declined, and an insufficient balance returns 403 before any image processing
ClientcURL with multipart form support. The -F flag builds the multipart body and its boundary for you
PermissionsAn API key that can reach the endpoint. The Primary key of an application has full access. A scoped key needs access to this resource and action, and has to be called from an address inside its IP list when one is set
Key formatsk_test_ for a sandbox application, sk_live_ for a live one, then 43 URL-safe characters. Keys created before this format have no prefix and keep working
ImageOne front-facing face, jpg, jpeg, png, tiff or webp, 5 MB or less
Secret handlingThe key stays server side. Never ship it to a browser, a mobile bundle or a public repository

Step by step: send a selfie and read the JSON

Step 1: Get an API key

Log in to the Didit Business Console, choose your Application in the dropdown at the top, open Developers, then API keys. Copy the Primary key, or create a separate key for this service so it only carries the access it needs.

You can also get a key without the console. The register call emails a six-character code, and the verify call returns both applications with their keys inline, as described in API authentication:

curl -X POST https://apx.didit.me/auth/v2/programmatic/register/ \
-H 'Content-Type: application/json' \
-d '{"email": "you@yourdomain.com", "password": "StrongP@ss1"}'

curl -X POST https://apx.didit.me/auth/v2/programmatic/verify-email/ \
-H 'Content-Type: application/json' \
-d '{"email": "you@yourdomain.com", "code": "A3K9F2"}'

Keep sandbox_application.api_key as the environment variable DIDIT_API_KEY while you build, and keep application.api_key aside for live traffic.

Step 2: Prepare one selfie that passes validation

The endpoint takes a single image. The model evaluates the largest detected face and works out a liveness score from 0 to 100. Capture diagnostics come back next to the verdict. Files are compressed to about 0.5 MB before processing, so a very high resolution does not improve accuracy; a well lit, well framed face does.

What the user_image field accepts
RuleDetail
Extensionstiff, jpg, jpeg, png, webp. A PDF is rejected
Size5 MB maximum. A larger file is rejected with 400
CompressionImages are compressed to roughly 0.5 MB before the model runs
ContentA front-facing face. One subject is the intended input
Several facesMULTIPLE_FACES_DETECTED is a warning severity signal and does not cause a decline on its own. The largest detected face is the one evaluated
A user's face being captured on camera for a liveness check
A single front-facing selfie is all the passive liveness endpoint needs.

Step 3: Send the multipart request

Point cURL at the file. cURL sets the multipart boundary itself, so do not add a Content-Type header of your own.

curl -X POST 'https://verification.didit.me/v3/passive-liveness/' \
-H "x-api-key: $DIDIT_API_KEY" \
-F 'user_image=@./selfie.jpg' \
-F 'save_api_request=true' \
-F 'vendor_data=user-123'

vendor_data is your own identifier for the person. It changes what the blocklist and duplicate screening return, which step 6 covers in detail.

Step 4: Read the response body

The field names below come from the endpoint schema; the values are illustrative, and this JSON is an excerpt of the response.

{
  "request_id": "3f6c1a92-58d4-4b0e-9a17-2c8d5e7b4411",
  "liveness": {
    "status": "Approved",
    "method": "PASSIVE",
    "score": 97,
    "warnings": [],
    "face_quality": 88,
    "face_luminance": 74
  }
}

The response also carries liveness.user_image.entities and liveness.user_image.best_angle. Read their shape and types from the endpoint reference before you parse them.

Read two results, not one. A live HTTP 200 consumes one Passive Liveness API credit even when liveness.status is Declined. A sandbox HTTP 200 returns a static Approved response without model processing or billing. The liveness.status field tells you the verdict, and a 200 can still carry Declined.

For a live call saved as an API session, the returned request_id is the handle you keep: it works with GET /v3/session/{sessionId}/decision/, and the same persisted session drives the status.updated webhook. Sandbox calls and calls made with persistence disabled create no retrievable session.

Step 5: Branch on status and warnings

liveness.status is Declined when any error severity warning fires. Warnings are signals that each carry a documented code and a severity, so branch on the code rather than on the score alone.

How to read the verdict
StatusWarning that firedWhat to do
ApprovedNo error severity warningContinue. Keep request_id for reference and, when the request was persisted, to fetch the decision later
DeclinedLIVENESS_FACE_ATTACKTreat this as a suspected presentation attack. Do not approve
DeclinedLOW_LIVENESS_SCOREThe score was at or below face_liveness_score_decline_threshold, which defaults to 30. Ask for a new selfie, or have a person look at the result
DeclinedNO_FACE_DETECTEDAsk the user to retry with a front-facing face in the frame
DeclinedFACE_IN_BLOCKLIST or POSSIBLE_FACE_IN_BLOCKLISTApply your blocklist policy. The call does not decide the business outcome for you
Does not cause a decline on its ownMULTIPLE_FACES_DETECTEDA warning severity signal. The largest detected face was scored, and you can still ask for a retake with one subject
Does not cause a decline on its ownDUPLICATED_FACE or POSSIBLE_DUPLICATED_FACEInformation severity: the face matches, or possibly matches, a face from another approved session. Apply your duplicate policy
A liveness result shown on a session in the Didit Business Console
The liveness result of a session in the Business Console, the same verdict you receive as JSON.

Step 6: Choose save_api_request and vendor_data on purpose

With save_api_request=true, the default, the call is persisted as an API session you can find in the Business Console, the reference image and face crop are stored, and the detected face is enrolled in your face search index so later Face Search calls and duplicate checks can match it. Set it to false for a one-shot check: Didit creates no API session, stores neither the reference image nor the face crop, and does not enroll the face.

Blocklist and duplicate screening run on every live call, with or without save_api_request. Prior faces carrying the same vendor_data are excluded from the whole index search, so re-running liveness for the same user does not raise DUPLICATED_FACE, and a blocklisted face that came from a session with your own vendor_data is not flagged either. Sending a stable value per person therefore keeps that person's earlier faces out of both the duplicate and the blocklist results.

Step 7: Test in the sandbox, then switch to the live key

Sandbox API keys skip all processing and billing. After request validation, which still returns 400 on malformed input, the endpoint answers with a static Approved mock payload, persists no session and consumes no credits. The sandbox tests multipart validation, HTTP error handling and parsing of that static Approved response. It cannot produce a model-driven Declined result or a warning branch, so exercise those with fixtures built from the documented warning codes and severities. Swap DIDIT_API_KEY for the live key once the organization has credit.

Field and event mapping

From the JSON response to your decision
Field or eventTypeWhat it meansWhere it lands
request_idUUIDIdentifier of the persisted API session when save_api_request is trueYour records, the decision endpoint, the status webhook
liveness.methodPASSIVEWhich liveness method produced the verdictLog it next to the score for audit
liveness.statusEnumThe verdict, from the shared status enumYour approve, reject or retake branch
liveness.score0 to 100Liveness score for the evaluated faceThresholds and your own review rules
liveness.warningsSignals, each with a documented code and a severityRisk signals such as LIVENESS_FACE_ATTACK or MULTIPLE_FACES_DETECTEDYour branching table from step 5
liveness.face_quality0 to 100, nullableCapture diagnostic for the submitted imageDecide whether to ask for a retake before a resubmission
liveness.face_luminance0 to 100, nullableCapture diagnostic for the lighting of the imageSame retake decision, plus capture guidance in your UI
liveness.user_image.entitiesDocumented in the endpoint referencePart of the user_image object in the responseRead its shape from the reference before mapping it
liveness.user_image.best_angleDocumented in the endpoint referencePart of the user_image object in the responseRead its shape from the reference before mapping it
status.updated webhookEventSession status change for a persisted API requestSubscribe instead of polling
GET /v3/session/{sessionId}/decision/EndpointThe decision for the persisted session behind request_idFetch later, or from a back office tool

Check the JSON representation of warnings against a real response before you write a parser, because the endpoint reference documents the codes and severities rather than one fixed body shape for every entry.

Install routes: MCP connector and API recipe

There are two documented ways to put Didit in front of your team or your service, and they differ in who makes the call.

  • MCP connector. The Didit MCP server is hosted at https://mcp.didit.me/mcp and signs in with OAuth. It is included free with every plan, and the MCP setup instructions are at https://didit.me/developers/mcp/. The supplied docs do not identify an MCP tool for this selfie upload, so the documented route for this endpoint is the multipart API call in step 3.
  • API recipe. Your own service holds the key and sends the cURL call from step 3. Hand the whole integration to a coding agent with the integration prompt, which covers sessions, standalone APIs, webhooks and error handling in one file.

Use the standalone API when your service already has a captured selfie and needs to handle the liveness result itself. Reach for the MCP server when you want Didit checks reachable from an AI assistant conversation.

Cover of the Didit Academy lesson on using Didit with MCP
The MCP route, walked through in the Didit Academy lesson on using Didit with MCP.

Test in the sandbox: expected success, error cases and fixes

A valid multipart request with a sandbox key returns 200 and the static Approved payload. Didit persists no API session and consumes no credits, so a green run proves your request shape and your response parsing, not the accuracy of the model on a real image.

Error cases and fixes
SymptomStatusBodyFix
Field missing or named wrong400Validation errorSend -F 'user_image=@./selfie.jpg' exactly
File larger than 5 MB400Upload rejectedResize or re-export below 5 MB
PDF or an unsupported extension400Unsupported extensionConvert to jpg, jpeg, png, tiff or webp
Image validation error, such as a corrupt or unreadable image400Read the returned body. This endpoint reference does not document a fixed body for this caseInspect the returned body, re-export the image and try again
No balance403{"error": "You don't have enough credits ..."}Top up at business.didit.me, then retry
Key missing, invalid, revoked or expired403{"detail": "You do not have permission to perform this action."}Check that x-api-key carries your application's key. This endpoint never returns 401
Key without access to this resource or action, or a call from outside the key's IP list403A detail that names the reasonInspect the returned detail, then use a key with that access, from an allowed address
Too many writes429JSON detailRead the Retry-After response header, wait at least that long, then retry with backoff and jitter
Unexpected server failure500May have no JSON bodyRetry with backoff, and parse the body defensively

Every refusal, fix and retry rule is listed on the API errors page, and the 429 headers and backoff guidance are on rate limiting.

To disconnect, delete the key you created in Developers then API keys, or delete the application if the whole workspace is going away. A deleted application answers with application_deleted for a few minutes and is then refused like any invalid key, so do not retry.

Detecting deepfakes from a single selfie

The passive model looks for artifacts and texture patterns that separate a real face from a spoof, across printed photos, screen replays, masks and deepfakes, and it reports a presentation attack as LIVENESS_FACE_ATTACK rather than in prose. Inference is documented as sub-two-second. 4,000+ companies use Didit.

Passive liveness fits a selfie you already captured: one frame, no user action, decided server side. When the user can go through a hosted flow instead, a workflow can run an interactive method such as 3D actions or flashing, priced at $0.15 per check against $0.10 for the passive liveness step inside a session. The product is Didit Liveness Detection, where the method comparison sits, and every risk code is catalogued in the liveness warnings reference.

Cost of both ends

On the Didit side the published unit price for this check is $0.10 per completed check, the Passive Liveness line of the live price feed, read November 26, 2026, and the full ID check that contains it is $0.33. Billing follows the response, so a live HTTP 200 consumes one Passive Liveness API credit and a 400 or a 403 does not. A 403 for an insufficient balance comes back before any image processing. The MCP server is included with every plan and adds nothing to the bill, whether you call the endpoint from your own service or reach Didit from an assistant.

Worked example at 25,000 completed live responses in a month, at the published rate:

  • Usage at list price: 25,000 x $0.10 = $2,500.00.
  • Growth: 4% off every price, so $0.096 x 25,000 = $2,400.00 of usage. The plan fee is $99 a month and includes $115.00 of credit, so that credit covers $115.00 and $2,285.00 remains payable from top-ups. Month total: $99.00 + $2,285.00 = $2,384.00.
  • Scale: 10% off every price, so $0.09 x 25,000 = $2,250.00 of usage. The plan fee is $299 a month and includes $350.00 of credit, so $350.00 is covered by credit and $1,900.00 remains payable from top-ups. Month total: $299.00 + $1,900.00 = $2,199.00.
  • Free: the $10.00 monthly credit buys 100 calls at $0.10 each ($10.00 / $0.10 = 100). The $10 monthly Free credit is available to the first organization created with an eligible work email for a company domain. An organization created through the API starts at $0. Top-ups beyond the credit start at $50.
  • For contrast, the same 25,000 people through a full ID check at $0.33 is 25,000 x $0.33 = $8,250.00. That bundle is ID document $0.15, passive liveness $0.10, Face Match 1:1 at $0.05 which is the workflow step rate, and device and IP analysis $0.03.

Plan fees, credits and every module price are on https://didit.me/pricing/, and the billing rules are in the pricing docs.

Sources

Our suggested next step: open https://business.didit.me/, create an application, and run the cURL request above with a sandbox key and a test selfie. No sales call, and the sandbox stays free while you build.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

How do I call the Didit passive liveness API with cURL?

Send a POST to https://verification.didit.me/v3/passive-liveness/ with your key in the x-api-key header and the selfie as a multipart field named user_image. The minimum command is cURL with -F 'user_image=@./selfie.jpg'. Add -F 'save_api_request=false' if you do not want the image stored or the face enrolled.

What does the passive liveness API cost?

Passive Liveness is published at $0.10 per completed check at list price, and a full ID check that includes it is $0.33. Growth takes 4% off every Didit price and Scale takes 10% off. Billing is per completed check from prepaid credit, so a request rejected before processing is not billed.

Which image formats and file sizes does the endpoint accept?

It accepts tiff, jpg, jpeg, png and webp, up to 5 MB, and rejects PDFs. Larger files fail with 400. The image is compressed to about 0.5 MB before the model runs, so a very high resolution does not improve accuracy.

What happens if the selfie contains more than one face?

The call still returns a verdict. MULTIPLE_FACES_DETECTED is a warning severity signal that does not cause a decline on its own, and the largest detected face is the one that gets scored. You can still ask the user for a retake with a single subject.

Can this API detect a deepfake from a single selfie?

Yes. The model looks for presentation attacks such as printed photos, screen replays, masks and deepfakes, and reports them as LIVENESS_FACE_ATTACK with a Declined status. Inference is documented as sub-two-second.

Does a wrong API key return 401 or 403?

This endpoint returns 403, never 401. A missing or invalid key answers 403 with the detail You do not have permission to perform this action. A key that has no access to this resource or action, or a call from outside the key's IP list, also returns 403 and the returned detail names the reason, so inspect it. An insufficient credit balance is a 403 as well, with an error body that says the balance cannot cover the call.

What does save_api_request do and when should I set it to false?

With the default value true, the call is persisted as an API session, the reference image and face crop are stored, and the face is enrolled in your face search index for later Face Search and duplicate checks. Set it to false for a one-shot check where Didit creates no API session, stores neither the reference image nor the face crop, and does not enroll the face. Blocklist and duplicate screening run on live calls with either setting. Sandbox calls skip screening.

Does setting save_api_request to false disable blocklist and duplicate screening?

No. Screening runs on every live call, with or without save_api_request, by matching the detected face against your application's face search index. A one-shot live call can still return blocklist or duplicate signals. It creates no API session, stores neither the reference image nor the face crop, and does not enroll the face.

How does vendor_data affect blocklist and duplicate results?

Prior faces carrying the same vendor_data are excluded from the whole index search. A repeat liveness check for the same person therefore does not raise DUPLICATED_FACE, and a blocklisted face that came from a session with your own vendor_data is not flagged either. Send a stable value per person and those self-matches stay out of the result.

Why does every valid sandbox request return Approved?

Sandbox keys skip all processing and billing, so after request validation the endpoint returns a static Approved mock payload. That is expected behaviour, not a model result. Malformed input still returns 400, so the sandbox is the right place to test request shape, error handling and parsing, and you test the decline and warning branches with your own fixtures.

Can I call this endpoint from a browser or a mobile app?

Call the Didit Passive Liveness API from your backend. Keep the x-api-key value out of browser and mobile bundles, and pass only the verdict to the client. If you need the capture screen on the device, run the hosted session flow or a Didit SDK instead.

Do I need a workflow or a session to use the standalone liveness API?

No. This is a server-to-server call that takes one image and answers immediately, with no workflow, no hosted screen and no SDK. Setting save_api_request=true does create an API type session you can inspect and query, but you never configure a workflow to use it.

How is passive liveness different from Face Match?

Passive liveness answers whether a live person is in the image, not who they are. Face Match 1:1 compares two faces, for example the selfie against the photo on an ID document, and is priced at $0.05 per check as a workflow step. A full Didit ID check runs both, plus document and device and IP analysis, for $0.33.

What do face_quality and face_luminance tell me?

Both are 0 to 100 values and both are nullable. They are capture diagnostics: how usable the submitted image is and how its lighting reads. Use them to decide whether to ask for a retake before a resubmission, not as an explanation of the liveness score.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.