Skip to main content
View as Markdown

Document analysis via API — from upload to verdict

This guide describes the end-to-end flow for having a supporting document analyzed from your system, with no mobile app and no human intervention:

  1. Once — in the Certificall admin, you configure a template containing an Upload document step, and you choose how the file is handled: certified and retained (digital vault) or deleted after analysis (GDPR data minimization).
  2. For each document received — your backend creates a case, uploads the document to it, then closes the case. Three calls.
  3. A few moments later — Certificall notifies your webhook with the trust score and the analysis details: tampering detection, document type compliance, data cross-checking.

All of this without ever exposing a value extracted from the document: you receive verdicts and scores, not personal data.

Required option

Document analysis is an option in your contract, enabled by your Certificall contact. See Document analysis — administration.


Flow overview​

Two distinct moments, hence two webhooks: the case content is sent at closing, the verdict is sent when the analysis is complete. This is the point not to confuse.


Prerequisites​

PrerequisiteHow to obtain it
Document analysis optionEnabled on your company by your Certificall contact. Without it, no result is produced and no analysis webhook is sent.
Active API accountAsk your Certificall administrator for an API-type user. The API > Case > Create permission is enough for this whole flow.
Configured templateA template with at least one Upload document step, with document analysis enabled. See step 1 below, and Template and Steps.
Webhook URLAn HTTPS URL on your side, able to receive a POST and authenticate the caller. Literal IP addresses are rejected. Accepted authentication modes: Webhook after certificate validation.
Webhook credentialsThe token Certificall will present to your endpoint (Authorization: Bearer … or security-token header).

Step 1 — Prepare the template (in the admin, once)​

This step does not go through the API

The API exposes GET /frames as read-only: there is no template creation endpoint. The template, its steps and the analysis configuration are set up in the admin interface. This is a one-time setup task, not an operation to repeat for each case.

1.1 — Add an Upload document step​

In the template editor, add a step of type Upload document. The role of a template and its steps is described in Template and Steps. This step type is what opens the simplest upload endpoint (API > Case > Create permission, with no additional media permission).

Document analysis also works on a Photo step — for a photographed rather than uploaded document — but the upload then goes through POST /v2/certificall/api/items/:caseId, which requires the API > Item > Create permission. If your flow is a file upload, stick with Upload document.

1.2 — Enable analysis in the "Config +" tab​

Select the step, open Config +, then:

  • enable "Enable document analysis";
  • check the accepted document types (invoice, KBIS, tax notice, ID document…). An alert is raised if the detected document does not match any checked type. If the expected type is not in the list, check "Other document": the document then benefits from the general forensic analysis, without the type-specific content checks;
  • leave "Enable cross-check of entered data" disabled for a first flow (see Going further).

1.3 — The key choice: certify or delete​

Two settings, in two different places in the editor, decide what happens to the file:

SettingWhereEffect
"Timestamp the document (timestamp + signature)"on the step, right-hand panelThe source file is timestamped (eIDAS) and signed. It is retained and its integrity remains verifiable over time: digital vault use. Enabled by default.
"Delete the document after analysis (GDPR)"Config + tabThe source file is purged from storage as soon as the analysis is complete. Only the result is kept: data minimization use.
The two cannot be combined

Checking deletion cancels timestamping, even if it is enabled on the step: you cannot seal a file you are about to destroy. The admin also displays a warning to that effect. Choose according to your main requirement — evidential value on one side, non-retention on the other.

1.4 — Have the webhooks configured​

Send your Certificall contact the URL and token of your two webhooks. The analysis result webhook cannot be configured through the API: it is set by Certificall in your company settings.

The case reception webhook, on the other hand, can be changed from your backend:

curl -X POST https://admin.certificall.app/certificall/api/company-options/api-settings \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"endpoint": "https://votre-domaine.fr/webhooks/certificall/dossier",
"authToken": "<the token we will present to you>",
"authorizationHeader": "authorization"
}'

Step 2 — Authentication​

curl -X POST https://admin.certificall.app/certificall/api/auth/token \
-H "Content-Type: application/json" \
-d '{ "username": "votre_compte_api", "password": "votre_mot_de_passe" }'
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }

Put this token in Authorization: Bearer <token> for all subsequent calls.

Best practices

Cache the token on the backend side and refresh it before it expires. Never expose it to the browser: all the calls described here are made from your server.


Step 3 — Retrieve the frameId and stepId​

  • Endpoint: GET /certificall/api/frames
  • Reference: List frames
curl https://admin.certificall.app/certificall/api/frames \
-H "Authorization: Bearer <your_token>"
[
{
"id": 42,
"name": "Vérification de justificatif",
"steps": [
{
"id": 305,
"title": "Justificatif de domicile",
"description": "PDF ou photo lisible",
"stepAction": "DOCUMENT_UPLOAD",
"isMandatory": true
}
]
}
]

The stepAction field identifies the upload step: look for DOCUMENT_UPLOAD.

Only once

frameId and stepId are stable. Retrieve them when your integration starts up, store them on your side, and do not call this endpoint again for each document.


Step 4 — Create the case​

Only frameId is required. Without userId, userMail or Certilink, the case is attached to your API account: this is the expected mode for a fully server-side flow.

curl -X POST https://admin.certificall.app/certificall/api/cases/create \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"frameId": 42,
"title": "Justificatif — dossier 2026-000871",
"metadata": {
"dossierInterne": "2026-000871",
"typeAttendu": "justificatif_domicile"
}
}'
{
"id": 12345,
"cfRef": "CAS-12345_CMP-1",
"frameId": 42,
"title": "Justificatif — dossier 2026-000871",
"createdAt": "2026-09-01T10:30:00Z",
"closed": false
}
Store the caseId — it is your only matching key

The analysis result webhook carries caseId and cfRef, but neither your metadata nor your reportToken. Without a caseId → your case mapping table written now, you will not know what to attach the verdict to.

About the reportToken

The reportToken is used to group several cases under a single report (several documents from the same customer, several visits to the same property). It is not a case identifier: generating one per case defeats its purpose. To carry your internal reference, use the case's metadata field. See Report identifier.


Step 5 — Upload the document​

  • Endpoint: POST /v2/certificall/api/items/:caseId/document
  • Required permission: API > Case > Create — the same as for creating the case
  • Reference: Item Management

A single call creates the item, carries the file and triggers the analysis. There is no item to create beforehand.

curl -X POST https://admin.certificall.app/v2/certificall/api/items/12345/document \
-H "Authorization: Bearer <your_token>" \
-F "file=@/path/to/justificatif.pdf" \
-F 'createItemDto={
"companyId": 1,
"stepId": 305,
"data": "justificatif.pdf",
"clientAppName": "Portail Souscription",
"clientAppVersion": "4.2.0",
"frontCreatedAt": "2026-09-01T10:31:12+02:00",
"userDeviceManufacturer": "Serveur",
"userDeviceModel": "API",
"userDeviceName": "integration-souscription",
"userDevicePlatform": "Server",
"userDeviceOs": "Linux",
"userDeviceOsVersion": "1.0"
}'
{
"companyId": 1,
"caseId": 12345,
"itemId": 98765,
"documentUrl": "https://admin.certificall.app/certificall/documents/company-1/..."
}

What these fields become on the certificate​

clientAppName, clientAppVersion and frontCreatedAt are required in v2. When a file is captured by your application and then uploaded via the API, Certificall sees neither the device nor the actual moment of capture: the certificate therefore carries a "Capture origin" box that names your application and splits the responsibilities. A missing field returns a 400 that names it.

File constraints​

ConstraintValue
Analyzed formatsPDF, JPEG, PNG
Maximum size~10 MB
Type checkThe actual type is checked (binary signature), not the extension

Error responses​

CodeCause
400Missing v2 contract field, malformed frontCreatedAt, file too large, unsupported type, malformed createItemDto
403The targeted step is not of type Upload document, or the case does not belong to your company
404No step matches this stepId
The analysis does not respond here

This response confirms the upload, not the analysis. The analysis starts asynchronously upon receipt: its result arrives by webhook (step 7).


Step 6 — Close the case​

  • Endpoint: GET /certificall/api/cases/close/:caseId
  • Reference: Closing a Case

Closing seals the case, produces the certified PDF and arms the delivery of the analysis result. Without it, no analysis webhook is sent.

curl https://admin.certificall.app/certificall/api/cases/close/12345 \
-H "Authorization: Bearer <your_token>"
{
"status": "Success",
"message": "Case closed successfully",
"caseId": 12345,
"pdfUrl": "https://admin.certificall.app/certificall/share/..."
}
Closing does not wait for the analysis

This call responds immediately, as soon as the PDF is sealed. Document analysis continues in the background. Do not wait for anything here: your interface can hand control back to the user right away, the verdict will arrive by webhook.


Step 7 — Receive the result​

7.1 — The two webhooks, not to be confused​

Case reception webhookAnalysis result webhook
Triggeredat closing, immediatelywhen the analysis is complete
Contentuploaded items, documentUrl, caseUrl (PDF), your metadatacaseId, cfRef, trustScore, analyzeStatus, detailed analysis
Configurable by youyes, POST /company-options/api-settingsno — set by Certificall
Useful forarchiving the document and the certificatedeciding: automatic validation or manual review

For a document analysis flow, the second one is the one that carries the value. The first remains useful if you archive the PDF or the document on your side: its content and authentication modes are detailed in Webhook after certificate validation.

7.2 — Analysis result webhook payload​

{
"caseId": 12345,
"cfRef": "CAS-12345_CMP-1",
"progress": "completed",
"trustScore": 86,
"analyzeStatus": "GOOD",
"analysis": {
"caseId": 12345,
"trustScore": 86,
"trustLevel": "GOOD",
"itemsAnalyzed": 1,
"signals": [
{ "key": "document", "score": 88, "trustLevel": "GOOD" }
],
"documentAnalyses": [
{
"itemId": 98765,
"expectedDocumentTypes": ["DOT-JUST_DOMICILE"],
"detectedDocumentType": "DOT-JUST_DOMICILE",
"typeMatchScore": 100,
"crossCheckResults": null,
"crossCheckScore": null,
"suspicionScore": 96,
"suspicionLevel": "NONE",
"evaluation": 96,
"progressStatusLevel": "ANALYSIS_COMPLETED",
"trustScore": 96,
"analysisDetails": [
{
"code": "FONT_CONSISTENCY",
"label": "Cohérence des polices",
"status": "VALID",
"evaluation": 95,
"suspicionLevel": "NONE",
"weight": 2
}
]
}
]
}
}

Two fields drive your decision:

  • progress — "completed": full analysis. "failed": finalized in degraded mode, an analysis did not come back in time. The scores present remain usable, but they are partial: do not validate automatically on a failed.
  • analyzeStatus — GOOD (70-100), SUSPICIOUS (30-69), CRITICAL (0-29).

The content of analysis is identical to the one returned by GET /cases/:caseId/analysis, whose full model is detailed in API — Document analysis.

7.3 — Partner-side processing​

// POST /webhooks/certificall/analyse (your route)
app.post('/webhooks/certificall/analyse', verifySignature, async (req, res) => {
const { caseId, progress, trustScore, analyzeStatus, analysis } = req.body;

// 1) Find your case — via the caseId stored in step 4
const dossier = await db.findByCaseId(caseId);
if (!dossier) return res.status(200).end(); // never return an error for an unknown case

// 2) Route according to the verdict
const documentaire = analysis?.documentAnalyses?.[0];
const decision =
progress !== 'completed' ? 'revue_manuelle' :
analyzeStatus === 'GOOD' ? 'valide' :
'revue_manuelle';

await db.update(dossier.id, {
decision,
trustScore,
typeDetecte: documentaire?.detectedDocumentType ?? null,
scoreFalsification: documentaire?.suspicionScore ?? null,
});

res.status(200).end();
});
Idempotency

The webhook may be re-sent: a late analysis may correct a verdict already delivered. Treat each receipt as an update of case caseId, never as an insert.

7.4 — Fallback: query the result yourself​

If you cannot expose a public URL, the same content is available for reading:

  • Endpoint: GET /certificall/api/cases/:caseId/analysis
curl https://admin.certificall.app/certificall/api/cases/12345/analysis \
-H "Authorization: Bearer <your_token>"

As long as the analysis is not complete, the documentAnalyses block may be partial: rely on progressStatusLevel — ANALYSIS_COMPLETED signals the end.

Polling has a cost

Your API calls are subject to rate limits, and an analysis can take several minutes: a tight loop quickly hits these limits without speeding up the result. Space out your queries (30 s then 1 min, for example) and set a cap. The webhook remains the recommended mode.


How long it takes​

StepOrder of magnitude
Document uploadimmediate
Case closingimmediate
Document analysisfrom a few seconds to about ten minutes depending on the document
Analysis webhook sentas soon as all analyses of the case have come back
Maximum delay before degraded finalization15 minutes — beyond that, the webhook is sent with progress: "failed" and the partial analysis

Design your screens accordingly: a "verification in progress" status that updates when the webhook is received, never a blocking wait.


Step 8 — Retrieve the certified PDF​

In certification mode (deletion after analysis disabled), the uploaded document is timestamped and signed, and the case produces a certified PDF:

  • via the pdfUrl field returned by the closing call;
  • via caseUrl in the case reception webhook;
  • via a Share Token if you need to expose the PDF to a third party without passing on your token — see Certificate via a Share Token;
  • via reports, if you group several cases under the same reportToken.

In deletion after analysis mode, the source file no longer exists and is therefore not certified: only the analysis result remains.


Going further — enabling cross-check​

The document score is the lowest of three scores out of 100: tampering analysis, document type compliance, and cross-consistency — cross-checking what the document says against what the case declares elsewhere.

The minimal flow described above only uses the first two: with a single step in the template, there is nothing to cross-check, and crossCheckScore stays null.

To enable the third, add data entry steps to the template before the document step (name, address, amount…), then in Config +:

  1. enable "Enable cross-check of entered data";
  2. select the steps whose values must be cross-checked against the document.

On the API side, these entries are submitted before the document:

curl -X POST https://admin.certificall.app/v2/certificall/api/items/create \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"caseId": 12345,
"stepId": 303,
"data": "12 rue des Lilas, 75011 Paris",
"clientAppName": "Portail Souscription",
"clientAppVersion": "4.2.0",
"frontCreatedAt": "2026-09-01T10:30:45+02:00"
}'

The webhook then returns a verdict per cross-checked field, without ever delivering the compared values:

"crossCheckResults": [
{ "fieldCode": "address", "fieldLabel": "Adresse", "match": "MATCH" },
{ "fieldCode": "lastName", "fieldLabel": "Nom", "match": "MISMATCH" }
],
"crossCheckScore": 50

Privacy: zero personal data returned​

Neither the webhook nor the analysis API returns the values extracted from the document (names, amounts, addresses, dates). You only receive facts: MATCH / MISMATCH / MISSING verdicts, scores and control criteria.

Combined with the "Delete the document after analysis" option, this enables an integration where your system never stores or receives the document: only the result.


Endpoint summary​

StepMethodEndpointDocumentation
2. AuthenticationPOST/certificall/api/auth/token/docs/api/token
3. List templatesGET/certificall/api/frames/docs/api/frames
4. Create the casePOST/certificall/api/cases/create/docs/api/cases
5. Upload the documentPOST/v2/certificall/api/items/:caseId/document/docs/api/items
5 bis. Submit a data entryPOST/v2/certificall/api/items/create/docs/api/items
6. CloseGET/certificall/api/cases/close/:caseId/docs/api/cases
7. Analysis webhookPOST<your URL>/docs/api/webhook_analyse
7 bis. Read the resultGET/certificall/api/cases/:caseId/analysis/docs/api/analyse_documentaire
1.4. Configure the case webhookPOST/certificall/api/company-options/api-settings/docs/api/webhook

Full Swagger: admin.certificall.app/certificall/public/swagger


Go-live checklist​

  • Document analysis option enabled on your company.
  • Template created, Upload document step configured, document types checked.
  • File handling decided: timestamping (vault) or deletion after analysis (GDPR).
  • frameId and stepId retrieved once and stored on the partner side.
  • caseId → your case mapping table written when the case is created.
  • API token cached on the backend side, never exposed to the browser.
  • Analysis webhook sent to Certificall and tested end to end.
  • Webhook processing is idempotent (a re-send updates, it does not insert).
  • progress: "failed" case handled explicitly — never automatically validated.
  • Interface designed around an asynchronous status, with no blocking wait.
  • Full test: creation → upload → closing → verdict received.

Further reading​