API ReferenceDocument

Analyze a document

Upload a PDF document for tampering, consistency, and anomaly analysis and receive the full verdict in the same response. The document is submitted and the request is held open while the pipeline runs — verdicts typically take 90 to 120 seconds — so call this from a background job with a long timeout, not in a user-facing request. If the verdict is not ready within the server's wait budget (150 seconds by default) the response is 202 with the record still processing; see the 202 response for the fallback. Limits: up to 25 MB and a host-configured page cap (20 pages by default) per document, PDF only. Requires an API key with the document scope.

POST
/api/app/document-forensics/analyze

Authorization

BearerAuth
AuthorizationBearer <token>

Send your secret API token as a bearer token in the Authorization header: Authorization: Bearer <token>. Keep it server-side and never expose it in client code.

In: header

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

cURL
curl -X POST "https://example.com/api/app/document-forensics/analyze" \  -F file="string"
{
  "id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
  "docId": "t-8ebd286c2f7940a1b2c3-9f1c2ad4be7f",
  "docType": "bank_statement",
  "docTypeConfidence": 0.98,
  "fusedVerdict": "reject",
  "fusedProbability": 0.91,
  "fusionRationale": "Font substitution and an inconsistent numeric total indicate the amount field was altered.",
  "processingTimeMs": 94120,
  "isSuccessful": true,
  "processedAt": "2026-06-07T12:31:34Z",
  "channel": "forensics-upload",
  "status": "completed",
  "fileName": "statement.pdf",
  "hasOriginal": true,
  "creditsUsed": 1,
  "pipelineVersionsJson": "{\"f1\":\"1.4.0\",\"f2\":\"1.2.1\",\"f3\":\"0.9.0\"}",
  "resultsJson": "{ \"...\": \"raw orchestrator payload\" }",
  "verdict": {
    "docId": "t-8ebd286c2f7940a1b2c3-9f1c2ad4be7f",
    "docType": "bank_statement",
    "docTypeConfidence": 0.98,
    "fusedVerdict": "reject",
    "fusedProbability": 0.91,
    "fusionRationale": "Font substitution and an inconsistent numeric total indicate the amount field was altered.",
    "processedAt": "2026-06-07T12:31:34Z",
    "latencyMs": 94120,
    "pipelineVersions": {
      "f1": "1.4.0",
      "f2": "1.2.1",
      "f3": "0.9.0"
    },
    "tampering": {
      "score": 0.92,
      "calibratedProbability": 0.9,
      "reliability": 0.88,
      "softScoreCalibrated": true,
      "evidenceUris": [
        "gs://raid-ai-evidence/t-8ebd.../page-2.png"
      ],
      "findings": [
        {
          "type": "font_substitution",
          "page": 2,
          "confidence": 0.94,
          "bbox": [
            120.5,
            402.1,
            240,
            418.6
          ],
          "note": "hidden:12,500"
        }
      ]
    },
    "consistency": {
      "score": 0.61,
      "calibratedProbability": 0.58,
      "reliability": 0.8,
      "softScoreCalibrated": true,
      "evidenceUris": [],
      "findings": []
    },
    "anomaly": {
      "score": 0.3,
      "calibratedProbability": 0.28,
      "reliability": 0.75,
      "softScoreCalibrated": true,
      "evidenceUris": [],
      "findings": []
    }
  }
}
{
  "id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
  "docId": "t-8ebd286c2f7940a1b2c3-9f1c2ad4be7f",
  "docType": "bank_statement",
  "docTypeConfidence": 0,
  "fusedVerdict": "",
  "fusedProbability": 0,
  "fusionRationale": "",
  "processingTimeMs": 0,
  "isSuccessful": false,
  "processedAt": "2026-06-07T12:30:00Z",
  "channel": "forensics-upload",
  "status": "processing",
  "fileName": "statement.pdf",
  "hasOriginal": true,
  "creditsUsed": 1,
  "pipelineVersionsJson": null,
  "resultsJson": "",
  "verdict": null
}
File too large
{
  "error": {
    "code": "IMAGE_FORENSICS:FILE_TOO_LARGE",
    "message": "File photo.jpg exceeds the maximum size of 50 MB."
  }
}
Unsupported format
{
  "error": {
    "code": "IMAGE_FORENSICS:UNSUPPORTED_FORMAT",
    "message": "Unsupported file format. Allowed — jpg, jpeg, png, webp, heic, heif, tiff."
  }
}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API token."
  }
}
{
  "error": {
    "code": "api_key.scope_missing",
    "message": "This API key is not authorized for the document-image scope."
  }
}