{
  "info": {
    "name": "Blueport PDF2JSON",
    "description": "Semantic PDF-to-JSON extraction.\n\nQuick start:\n1. Set the `apiKey` collection variable to your organisation's key (app.blueport.io → PDF2JSON → API key).\n2. Open 'Extract PDF (raw binary)', pick any PDF under Body → binary, hit Send.\n3. Expect structured JSON in ~10–25 seconds (raise Settings → Request timeout if yours is lower).\n\nDocs: https://developer.blueport.io/pdf2json",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://pdf.blueport.io"
    },
    {
      "key": "apiKey",
      "value": ""
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "if (!pm.collectionVariables.get('apiKey')) {",
          "  console.warn('Set the apiKey collection variable first: app.blueport.io → PDF2JSON → API key');",
          "}"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "Extract PDF (raw binary)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('status is 200', () => pm.response.to.have.status(200));",
              "const body = pm.response.json();",
              "pm.test('extraction succeeded', () => pm.expect(body.ok).to.be.true);",
              "pm.test('has a documentType', () => pm.expect(body.data.documentType).to.be.a('string'));",
              "pm.test('has a request_id for support', () => pm.expect(body.meta.request_id).to.match(/^req_/));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-api-key",
            "value": "{{apiKey}}"
          },
          {
            "key": "content-type",
            "value": "application/pdf"
          },
          {
            "key": "x-model",
            "value": "hkm",
            "description": "Optional: hkm (default) or snm (premium accuracy)",
            "disabled": true
          }
        ],
        "body": {
          "mode": "file",
          "file": {
            "src": ""
          }
        },
        "url": {
          "raw": "{{baseUrl}}/pdf2json",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "pdf2json"
          ]
        },
        "description": "Select your PDF under Body → binary, then Send. Max 8 MB."
      },
      "response": [
        {
          "name": "200 — extracted",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}"
              },
              {
                "key": "content-type",
                "value": "application/pdf"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pdf2json",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pdf2json"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "content-type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"ok\": true,\n  \"data\": {\n    \"documentType\": \"TAX INVOICE\",\n    \"pages\": 2,\n    \"currency\": \"AUD\",\n    \"dealer\": {\n      \"name\": \"Example Motors Pty Ltd\",\n      \"abn\": \"12 345 678 901\",\n      \"address\": \"1 Sample Street, Newcastle NSW 2300\",\n      \"phone\": \"02 4000 0000\"\n    },\n    \"invoiceTo\": {\n      \"name\": \"Alex Sample\",\n      \"address\": \"42 Demo Avenue, Charlestown NSW 2290\"\n    },\n    \"invoice\": {\n      \"invoiceNo\": \"10023456\",\n      \"date\": \"2026-08-01\",\n      \"salesperson\": \"Jamie Citizen\"\n    },\n    \"vehicle\": {\n      \"condition\": \"New\",\n      \"make\": \"EXAMPLE\",\n      \"modelName\": \"Sample 300\",\n      \"vin\": \"6XY12345678900123\",\n      \"odometer\": 1\n    },\n    \"pricing\": {\n      \"vehicle\": { \"basePrice\": 8990.00 },\n      \"totals\": { \"subTotal\": 8990.00, \"gst\": 899.00, \"total\": 9889.00 }\n    }\n  },\n  \"meta\": { \"request_id\": \"req_a1b2c3\", \"duration_ms\": 17000 }\n}"
        },
        {
          "name": "401 — bad key",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "wrong-key"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pdf2json",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pdf2json"
              ]
            }
          },
          "status": "Unauthorized",
          "code": 401,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "content-type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"ok\": false,\n  \"error\": \"invalid or missing api_key\",\n  \"request_id\": \"req_d4e5f6\"\n}"
        },
        {
          "name": "400 — body is not a PDF",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "x-api-key",
                "value": "{{apiKey}}"
              },
              {
                "key": "content-type",
                "value": "application/pdf"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/pdf2json",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pdf2json"
              ]
            }
          },
          "status": "Bad Request",
          "code": 400,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "content-type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"ok\": false,\n  \"error\": \"body is not a PDF\",\n  \"request_id\": \"req_g7h8i9\"\n}"
        }
      ]
    },
    {
      "name": "Extract PDF (JSON base64)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('status is 200', () => pm.response.to.have.status(200));",
              "pm.test('extraction succeeded', () => pm.expect(pm.response.json().ok).to.be.true);"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-api-key",
            "value": "{{apiKey}}"
          },
          {
            "key": "content-type",
            "value": "application/json"
          },
          {
            "key": "x-model",
            "value": "hkm",
            "description": "Optional: hkm (default) or snm (premium accuracy)",
            "disabled": true
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"pdf\": \"<base64-encoded PDF bytes>\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/pdf2json",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "pdf2json"
          ]
        },
        "description": "Replace the placeholder with your base64-encoded PDF (no data: prefix, no line breaks)."
      }
    },
    {
      "name": "Health",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('service is up', () => pm.response.to.have.status(200));"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{baseUrl}}/health",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "health"
          ]
        },
        "description": "No auth needed - a quick reachability check."
      },
      "response": [
        {
          "name": "200 — up",
          "originalRequest": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "content-type",
              "value": "application/json"
            }
          ],
          "body": "{ \"ok\": true, \"service\": \"bp-pdf\" }"
        }
      ]
    }
  ]
}