{
  "info": {
    "name": "PowerCred Document Intelligence",
    "_postman_id": "powercred-document-intelligence",
    "description": "End-to-end document intelligence APIs covering three workflows:\n\n1. **OCR (IDP)** — extract structured data from identity, employment, and financial documents.\n2. **Document Tamper Detection** — register PDF templates and verify incoming PDFs against them.\n3. **Fraud Signals** — derive fraud, credibility, and statutory-compliance signals from extracted document data.\n\n## Authentication\n\n| Workflow | Mechanism | How to set |\n| --- | --- | --- |\n| OCR | `apikey` query parameter | Set `idp_apikey` collection variable |\n| Fraud Signals | `apikey` query parameter | Set `triangulation_apikey` collection variable |\n| Document Tamper Detection | `Authorization: Bearer <token>` | Set `fraud_preproc_apikey` collection variable |\n\n## Environments\n\nUse the included environment files to switch hosts:\n- **Staging** — `mock.powercred.io`\n- **Production** — `dev.powercred.io`\n- **Sandbox (Tamper Detection)** — `fraud-sandbox.powercred.io` (no production environment yet)\n\n## End-to-end usage\n\nA typical run looks like:\n1. Call **OCR → Read Document** to upload a payslip/identity document. Capture the returned `id`.\n2. Poll **OCR → Get Document Data** with the `id` until status `200` is returned.\n3. Pass the JSON payload to **Fraud Signals → Run Fraud Detection** to receive fraud verdicts and lender-ready signals.\n4. In parallel, call **Tamper Detection → Check Document** on the original PDF to confirm the file matches your registered templates.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "idp_base_url",
      "value": "https://mock.powercred.io/idp/v1",
      "type": "string",
      "description": "OCR (IDP) base URL. Staging = mock.powercred.io, Production = dev.powercred.io"
    },
    {
      "key": "triangulation_base_url",
      "value": "https://mock.powercred.io/cms/v1",
      "type": "string",
      "description": "Fraud Signals base URL. Staging = mock.powercred.io, Production = dev.powercred.io"
    },
    {
      "key": "fraud_preproc_base_url",
      "value": "https://fraud-sandbox.powercred.io",
      "type": "string",
      "description": "Document Tamper Detection base URL. Sandbox only — no production endpoint yet."
    },
    {
      "key": "idp_apikey",
      "value": "",
      "type": "string",
      "description": "API key for the IDP (OCR) service. Passed as ?apikey= query parameter."
    },
    {
      "key": "triangulation_apikey",
      "value": "",
      "type": "string",
      "description": "API key for the Triangulation (Fraud Signals) service. Passed as ?apikey= query parameter."
    },
    {
      "key": "fraud_preproc_apikey",
      "value": "",
      "type": "string",
      "description": "Bearer token for the Tamper Detection service. Sent as Authorization: Bearer <token>."
    },
    {
      "key": "reference_id",
      "value": "ref-12345",
      "type": "string",
      "description": "Your own correlation ID for an end-user / loan application."
    },
    {
      "key": "document_type_ocr",
      "value": "payslip",
      "type": "string",
      "description": "Document type for OCR (e.g. payslip, employment_certificate, bank_statement, national_id)."
    },
    {
      "key": "document_id",
      "value": "payslip",
      "type": "string",
      "description": "Document type identifier for Tamper Detection (e.g. payslip, passport, bank_statement)."
    },
    {
      "key": "version_id",
      "value": "v1",
      "type": "string"
    },
    {
      "key": "filename",
      "value": "template.pdf",
      "type": "string"
    },
    {
      "key": "ocr_run_id",
      "value": "",
      "type": "string",
      "description": "ID returned by POST /read. Used to poll GET /get."
    },
    {
      "key": "fraud_document_type",
      "value": "payslip",
      "type": "string",
      "description": "Document type for fraud detection — payslip or employment_certificate."
    },
    {
      "key": "fraud_run_id",
      "value": "",
      "type": "string",
      "description": "Run ID returned by a fraud detection call. Used to fetch the run later."
    }
  ],
  "item": [
    {
      "name": "1. OCR (Document Read)",
      "description": "Asynchronously read a document and retrieve structured JSON. Two-step workflow: submit with POST /read, then poll GET /get with the returned id until ready.",
      "item": [
        {
          "name": "Read Document",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": [],
                  "description": "PDF, JPEG, or PNG file to extract from. Either `file` or `file_url` is required."
                },
                {
                  "key": "file_url",
                  "value": "",
                  "type": "text",
                  "description": "Public URL of the document. Use instead of `file` for hosted files.",
                  "disabled": true
                }
              ]
            },
            "url": {
              "raw": "{{idp_base_url}}/read?reference_id={{reference_id}}&document_type={{document_type_ocr}}&apikey={{idp_apikey}}",
              "host": ["{{idp_base_url}}"],
              "path": ["read"],
              "query": [
                {
                  "key": "reference_id",
                  "value": "{{reference_id}}",
                  "description": "Your correlation ID for the end-user / application."
                },
                {
                  "key": "document_type",
                  "value": "{{document_type_ocr}}",
                  "description": "Document type, e.g. payslip, employment_certificate, bank_statement, national_id."
                },
                {
                  "key": "apikey",
                  "value": "{{idp_apikey}}",
                  "description": "API key (query parameter, NOT Bearer)."
                },
                {
                  "key": "callback_url",
                  "value": "",
                  "description": "Optional. Receives a POST with the parsed payload when extraction completes.",
                  "disabled": true
                },
                {
                  "key": "tamper_check",
                  "value": "false",
                  "description": "Optional. Enable basic image/pdf tamper indicators inline.",
                  "disabled": true
                },
                {
                  "key": "get_image_quality",
                  "value": "true",
                  "description": "Optional. Run image quality assessment for camera-captured images.",
                  "disabled": true
                }
              ]
            },
            "description": "Submit a document for asynchronous extraction.\n\n**Request**\n- `reference_id` (query, required) — your end-user / application correlation ID.\n- `document_type` (query, required) — document type identifier configured for your account.\n- `apikey` (query, required) — your IDP API key.\n- `file` (form-data, required if no `file_url`) — PDF/JPEG/PNG. Max recommended size: per account quota.\n- `file_url` (query, optional) — alternative to `file` for hosted documents.\n- `callback_url` (query, optional) — webhook to receive the final payload when ready.\n- `tamper_check` (query, optional) — set to `true` for inline tamper signals.\n- `get_image_quality` (query, optional) — image quality flags for camera images.\n\n**Response (202 Accepted)**\n```json\n{\n  \"message\": \"Document parsing started\",\n  \"id\": \"3b41c2e0-…\"\n}\n```\nCapture `id` and poll `GET /get` until you receive a `200`."
          },
          "response": [
            {
              "name": "202 Accepted",
              "status": "Accepted",
              "code": 202,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"message\": \"Document parsing started\",\n  \"id\": \"3b41c2e0-9d2a-4e5e-bb37-2b8e0c0fbb12\"\n}"
            },
            {
              "name": "422 Invalid document type",
              "status": "Unprocessable Entity",
              "code": 422,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"detail\": \"Invalid document type selected; Please pass a valid document type\"\n}"
            },
            {
              "name": "400 Unsupported file type",
              "status": "Bad Request",
              "code": 400,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"detail\": \"Please upload a PDF, JPEG or PNG file\"\n}"
            }
          ]
        },
        {
          "name": "Get Document Data",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{idp_base_url}}/get?id={{ocr_run_id}}&apikey={{idp_apikey}}",
              "host": ["{{idp_base_url}}"],
              "path": ["get"],
              "query": [
                {
                  "key": "id",
                  "value": "{{ocr_run_id}}",
                  "description": "ID returned by POST /read."
                },
                {
                  "key": "apikey",
                  "value": "{{idp_apikey}}",
                  "description": "API key (query parameter)."
                },
                {
                  "key": "return_json",
                  "value": "false",
                  "description": "Optional. When true, returns the raw structured JSON instead of the formatted response.",
                  "disabled": true
                },
                {
                  "key": "image_quality",
                  "value": "false",
                  "description": "Optional. Include the image quality assessment block when available.",
                  "disabled": true
                }
              ]
            },
            "description": "Retrieve the parsed result for an in-flight or completed read.\n\n**Request**\n- `id` (query, required) — the ID returned by POST /read.\n- `apikey` (query, required) — your IDP API key.\n- `return_json` (query, optional) — return raw JSON view.\n- `image_quality` (query, optional) — include the image quality block.\n\n**Status codes**\n- `200` — extraction complete, payload returned.\n- `202` — extraction still in progress; retry after a short delay.\n- `404` — invalid / unreadable document.\n- `500` — extraction failed; retry."
          },
          "response": [
            {
              "name": "200 OK — Payslip example",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"id\": \"3b41c2e0-9d2a-4e5e-bb37-2b8e0c0fbb12\",\n  \"document_type\": \"payslip\",\n  \"status\": \"COMPLETED\",\n  \"data\": {\n    \"employee_name\": \"Juan Dela Cruz\",\n    \"employee_id\": \"EMP-00123\",\n    \"employer_name\": \"Acme Corporation\",\n    \"pay_period_start\": \"2026-05-01\",\n    \"pay_period_end\": \"2026-05-15\",\n    \"pay_date\": \"2026-05-20\",\n    \"gross_pay\": 35000.00,\n    \"basic_pay\": 30000.00,\n    \"allowances\": 5000.00,\n    \"total_deductions\": 4750.00,\n    \"net_pay\": 30250.00,\n    \"contributions\": {\n      \"sss\": 1125.00,\n      \"philhealth\": 875.00,\n      \"pagibig\": 100.00\n    },\n    \"withholding_tax\": 2650.00\n  }\n}"
            },
            {
              "name": "202 In progress",
              "status": "Accepted",
              "code": 202,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\"message\": \"Document parsing in progress\"}"
            },
            {
              "name": "404 Unreadable document",
              "status": "Not Found",
              "code": 404,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\"detail\": {\"error_code\": \"INVALID_DOCUMENT\", \"message\": \"Unreadable document.\"}}"
            }
          ]
        }
      ]
    },
    {
      "name": "2. Document Tamper Detection",
      "description": "Register PDF templates per document type and verify incoming PDFs against the stored metadata, font, and layout profile. Catches doctored or fabricated ePDFs before they reach downstream scoring.",
      "auth": {
        "type": "bearer",
        "bearer": [{"key": "token", "value": "{{fraud_preproc_apikey}}", "type": "string"}]
      },
      "item": [
        {
          "name": "List Documents",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{fraud_preproc_base_url}}/documents",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["documents"]
            },
            "description": "Returns all document IDs registered under the authenticated customer.\n\n**Response (200 OK)**\n```json\n{\n  \"documents\": [\"payslip\", \"national_id\"],\n  \"count\": 2\n}\n```"
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\"documents\": [\"payslip\", \"national_id\"], \"count\": 2}"
            }
          ]
        },
        {
          "name": "Create Template (Auto-Extract)",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {"key": "files", "type": "file", "src": [], "description": "One or more PDF template files (max 5 MB each)"},
                {"key": "similarity_threshold", "value": "0.85", "type": "text", "description": "Layout similarity threshold (0.0–1.0)."}
              ]
            },
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}/auto",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}", "auto"]
            },
            "description": "Upload reference PDFs and auto-derive metadata patterns and font lists.\n\nMetadata patterns (producer, title, author, creator, subject, keywords, creation_date) and fonts are extracted from the uploaded PDFs:\n- Single unique value across all files → exact-match regex\n- Multiple differing values → regex alternation\n- Field absent → omitted (not checked)\n\nOnly `similarity_threshold` is set manually (default 0.85). The new version becomes active automatically."
          },
          "response": [
            {
              "name": "201 Created",
              "status": "Created",
              "code": 201,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"version_id\": \"v1\",\n  \"document_id\": \"payslip\",\n  \"template_count\": 2,\n  \"extracted_config\": {\n    \"metadata_config\": {\n      \"producer\": \"Adobe\\\\ PDF\\\\ Library\\\\ 15\\\\.0\",\n      \"creator\": \"Microsoft\\\\ Word\"\n    },\n    \"fonts\": [\"Arial\", \"TimesNewRoman\"],\n    \"similarity_threshold\": 0.85\n  }\n}"
            }
          ]
        },
        {
          "name": "Create Template (Manual Config)",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {"key": "files", "type": "file", "src": [], "description": "One or more PDF template files (max 5 MB each)"},
                {"key": "producer_pattern", "value": "Adobe PDF Library", "type": "text", "description": "Regex matched against the PDF producer field"},
                {"key": "title_pattern", "value": "", "type": "text", "description": "Optional regex for PDF title"},
                {"key": "author_pattern", "value": "", "type": "text"},
                {"key": "creator_pattern", "value": "", "type": "text"},
                {"key": "subject_pattern", "value": "", "type": "text"},
                {"key": "keywords_pattern", "value": "", "type": "text"},
                {"key": "creation_date_pattern", "value": "", "type": "text"},
                {"key": "fonts", "value": "[\"Arial\",\"Helvetica\"]", "type": "text", "description": "JSON array of font family names"},
                {"key": "similarity_threshold", "value": "0.85", "type": "text"}
              ]
            },
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}"]
            },
            "description": "Upload PDF template files with explicit metadata and font rules. Creates a new version that becomes active."
          },
          "response": [
            {
              "name": "201 Created",
              "status": "Created",
              "code": 201,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\"version_id\": \"v1\", \"document_id\": \"payslip\", \"template_count\": 1}"
            }
          ]
        },
        {
          "name": "Update Template",
          "request": {
            "method": "PUT",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {"key": "files", "type": "file", "src": [], "description": "Additional PDF files (optional)"},
                {"key": "producer_pattern", "value": "", "type": "text", "description": "Omit to carry over existing"},
                {"key": "fonts", "value": "", "type": "text"},
                {"key": "similarity_threshold", "value": "", "type": "text"},
                {"key": "file_mode", "value": "append", "type": "text", "description": "append | overwrite"}
              ]
            },
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}"]
            },
            "description": "Update an existing template configuration. Any field omitted is carried over from the active version. A new version is always created and becomes active.\n\n- `file_mode=append` (default) — new PDFs are added to the existing set.\n- `file_mode=overwrite` — only the newly uploaded PDFs are kept."
          },
          "response": []
        },
        {
          "name": "Get Active Template",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}"]
            },
            "description": "Return the active version's configuration for a document type."
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"document_id\": \"payslip\",\n  \"active_version\": \"v1\",\n  \"metadata_config\": {\"producer\": \"Adobe PDF Library\"},\n  \"fonts\": [\"Arial\", \"Helvetica\"],\n  \"similarity_threshold\": 0.85,\n  \"template_count\": 2,\n  \"created_at\": \"2026-05-20T08:14:11Z\"\n}"
            }
          ]
        },
        {
          "name": "List Template Versions",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}/versions",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}", "versions"]
            },
            "description": "List all versions for a document type, ordered by version number."
          },
          "response": []
        },
        {
          "name": "Activate Template Version",
          "request": {
            "method": "PATCH",
            "header": [],
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}/versions/{{version_id}}/activate",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}", "versions", "{{version_id}}", "activate"]
            },
            "description": "Switch the active version for a document type."
          },
          "response": []
        },
        {
          "name": "Delete Template File",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{fraud_preproc_base_url}}/templates/{{document_id}}/files/{{filename}}",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["templates", "{{document_id}}", "files", "{{filename}}"]
            },
            "description": "Remove a single PDF template file from the active version. A new version is created without it and becomes active."
          },
          "response": []
        },
        {
          "name": "Check Document",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {"key": "file", "type": "file", "src": [], "description": "PDF file to authenticate (max 5 MB)"}
              ]
            },
            "url": {
              "raw": "{{fraud_preproc_base_url}}/check",
              "host": ["{{fraud_preproc_base_url}}"],
              "path": ["check"],
              "query": [
                {
                  "key": "document_id",
                  "value": "{{document_id}}",
                  "description": "Optional. Check against this document type only; omit to check against every registered template.",
                  "disabled": true
                }
              ]
            },
            "description": "Authenticate a PDF against registered templates.\n\n- **ePDF**: runs metadata, font, and layout checks against every document type's active version and returns per-document match results.\n- **Scanned PDF / image-based**: returns `is_epdf: false` with an informational message.\n\nIf `document_id` is supplied, only that document type is checked."
          },
          "response": [
            {
              "name": "200 OK — match",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"matched\": true,\n  \"is_epdf\": true,\n  \"results\": [\n    {\n      \"document_id\": \"payslip\",\n      \"matched\": true,\n      \"version_checked\": \"v1\",\n      \"reasons\": {\n        \"metadata\": {\n          \"matched\": true,\n          \"details\": [\n            {\"field\": \"producer\", \"pattern\": \"Adobe PDF Library\", \"extracted_value\": \"Adobe PDF Library 15.0\", \"matched\": true}\n          ]\n        },\n        \"fonts\": {\n          \"matched\": true,\n          \"details\": [\n            {\"required_font\": \"Arial\", \"found\": true, \"extracted_fonts\": [\"Arial\", \"Helvetica\"]}\n          ]\n        },\n        \"layout\": {\"matched\": true, \"score\": 0.94, \"threshold\": 0.85},\n        \"date_integrity\": {\"matched\": true, \"creation_date\": \"2026-05-15T10:22:01Z\", \"mod_date\": \"2026-05-15T10:22:01Z\"}\n      }\n    }\n  ]\n}"
            },
            {
              "name": "200 OK — scanned / image PDF",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"matched\": false,\n  \"is_epdf\": false,\n  \"message\": \"PDF appears to be scanned/image-based; tamper checks skipped.\",\n  \"results\": []\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "3. Fraud Signals",
      "description": "Run fraud, credibility, and statutory-compliance checks on already-extracted document JSON (e.g. the payload returned by the OCR endpoint).",
      "item": [
        {
          "name": "Run Fraud Detection (from JSON)",
          "request": {
            "method": "POST",
            "header": [{"key": "Content-Type", "value": "application/json"}],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"documents\": [\n    {\n      \"type\": \"payslip\",\n      \"document_id\": \"payslip_1\",\n      \"data\": {\n        \"employee_name\": \"Juan Dela Cruz\",\n        \"employer_name\": \"Acme Corporation\",\n        \"pay_period_start\": \"2026-05-01\",\n        \"pay_period_end\": \"2026-05-15\",\n        \"pay_date\": \"2026-05-20\",\n        \"gross_pay\": 35000.00,\n        \"basic_pay\": 30000.00,\n        \"allowances\": 5000.00,\n        \"total_deductions\": 4750.00,\n        \"net_pay\": 30250.00,\n        \"contributions\": {\"sss\": 1125.00, \"philhealth\": 875.00, \"pagibig\": 100.00},\n        \"withholding_tax\": 2650.00\n      }\n    }\n  ]\n}"
            },
            "url": {
              "raw": "{{triangulation_base_url}}/fraud-detection/{{fraud_document_type}}/run?region=ph&apikey={{triangulation_apikey}}",
              "host": ["{{triangulation_base_url}}"],
              "path": ["fraud-detection", "{{fraud_document_type}}", "run"],
              "query": [
                {"key": "region", "value": "ph", "description": "Region code for statutory rules (e.g. ph, my)."},
                {"key": "apikey", "value": "{{triangulation_apikey}}", "description": "API key (query parameter)."}
              ]
            },
            "description": "Evaluate a document (or set of documents of the same type) for fraud signals.\n\n**Path**\n- `{document_type}` — `payslip` or `employment_certificate`.\n\n**Body**\n- `documents[]` — at least one document. Each item:\n  - `type` (string, required) — must match the path `{document_type}`.\n  - `document_id` (string, optional) — your internal identifier; defaults to `doc_0`, `doc_1`, …\n  - `data` (object, required) — the extracted JSON, typically taken directly from the OCR response.\n\n**Categories evaluated**\n1. Arithmetic Integrity — net pay calculation, cross-field consistency, income stability.\n2. Document Credibility — trust score, format reliability, employer formality, pay frequency.\n3. Cross-Document Checks — employer match and pay period sequence across payslips.\n4. Statutory Compliance — region-specific contribution & tax checks.\n\n**Response (200 OK)** — returns categorised findings plus a flat `signals` block with a financial summary and lender-ready cards."
          },
          "response": [
            {
              "name": "200 OK — Payslip",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"run_id\": \"3f8c…\",\n  \"document_type\": \"payslip\",\n  \"timestamp\": \"2026-06-16T09:12:33Z\",\n  \"overall_status\": \"pass\",\n  \"categories\": [\n    {\n      \"name\": \"Arithmetic Integrity\",\n      \"description\": \"Net pay calculations, cross-field consistency, and income stability\",\n      \"status\": \"pass\",\n      \"checks\": [\n        {\n          \"name\": \"net_pay_reconciliation\",\n          \"description\": \"gross - deductions = net\",\n          \"status\": \"pass\",\n          \"checks_performed\": [\"sum_deductions\", \"net_pay_match\"],\n          \"findings\": []\n        }\n      ]\n    },\n    {\"name\": \"Document Credibility\", \"description\": \"…\", \"status\": \"pass\", \"checks\": []},\n    {\"name\": \"Cross-Document Checks\", \"description\": \"…\", \"status\": \"pass\", \"checks\": []},\n    {\"name\": \"Statutory Compliance\", \"description\": \"…\", \"status\": \"pass\", \"checks\": []}\n  ],\n  \"signals\": {\n    \"financial_summary\": {\n      \"gross_pay\": 35000.00,\n      \"net_pay\": 30250.00,\n      \"basic_pay\": 30000.00,\n      \"total_deductions\": 4750.00,\n      \"sss_contribution\": 1125.00,\n      \"philhealth_contribution\": 875.00,\n      \"pagibig_contribution\": 100.00,\n      \"withholding_tax\": 2650.00,\n      \"takehome_ratio\": 0.864\n    },\n    \"lender_signals\": [\n      {\"name\": \"income_stability\", \"value\": \"stable\", \"status\": \"pass\"},\n      {\"name\": \"statutory_coverage\", \"value\": \"complete\", \"status\": \"pass\"}\n    ]\n  },\n  \"metadata\": {\n    \"app_id\": \"app_xxx\",\n    \"developer_email\": \"dev@example.com\",\n    \"app_name\": \"my-app\",\n    \"document_type\": \"payslip\",\n    \"processing_time_ms\": 412.0\n  }\n}"
            },
            {
              "name": "422 Wrong document type in body",
              "status": "Unprocessable Entity",
              "code": 422,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\"detail\": \"All documents must be of type 'payslip'. Got: ['employment_certificate']\"}"
            }
          ]
        },
        {
          "name": "Run Fraud Detection (from session)",
          "request": {
            "method": "POST",
            "header": [{"key": "Content-Type", "value": "application/json"}],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"sessions\": [\n    {\"session_id\": \"3b41c2e0-9d2a-4e5e-bb37-2b8e0c0fbb12\", \"product\": \"idp\"}\n  ]\n}"
            },
            "url": {
              "raw": "{{triangulation_base_url}}/fraud-detection/{{fraud_document_type}}/run-from-session?region=ph&apikey={{triangulation_apikey}}",
              "host": ["{{triangulation_base_url}}"],
              "path": ["fraud-detection", "{{fraud_document_type}}", "run-from-session"],
              "query": [
                {"key": "region", "value": "ph"},
                {"key": "apikey", "value": "{{triangulation_apikey}}"}
              ]
            },
            "description": "Run fraud detection against documents already processed by an upstream PowerCred product (e.g. IDP/OCR).\n\n**Body**\n- `sessions[]` — at least one item:\n  - `session_id` (string, required) — typically the OCR `id` returned by POST /read.\n  - `product` (string, required) — source product. Supported values are returned in the error message for unknown inputs.\n\nThe service fetches the document JSON from the upstream product using your API key, validates that the document type matches the path, and runs the same fraud detection pipeline as the `from JSON` endpoint."
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\n  \"run_id\": \"3f8c…\",\n  \"document_type\": \"payslip\",\n  \"overall_status\": \"pass\",\n  \"session_data\": [\n    {\"session_id\": \"3b41c2e0-…\", \"product\": \"idp\", \"document_type\": \"payslip\"}\n  ],\n  \"categories\": [],\n  \"signals\": {\"financial_summary\": {}, \"lender_signals\": []},\n  \"metadata\": {\"app_id\": \"app_xxx\", \"developer_email\": \"dev@example.com\", \"app_name\": \"my-app\", \"document_type\": \"payslip\", \"processing_time_ms\": 612.0}\n}"
            }
          ]
        },
        {
          "name": "Get Fraud Detection Run",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{triangulation_base_url}}/fraud-detection/runs/{{fraud_run_id}}?apikey={{triangulation_apikey}}",
              "host": ["{{triangulation_base_url}}"],
              "path": ["fraud-detection", "runs", "{{fraud_run_id}}"],
              "query": [
                {"key": "apikey", "value": "{{triangulation_apikey}}"}
              ]
            },
            "description": "Retrieve a previously executed fraud detection run by `run_id`. The response shape matches the `run` endpoints."
          },
          "response": [
            {
              "name": "404 Run not found",
              "status": "Not Found",
              "code": 404,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "_postman_previewlanguage": "json",
              "body": "{\"detail\": \"Fraud detection run '3f8c…' not found\"}"
            }
          ]
        }
      ]
    }
  ]
}
