{
  "info": {
    "name": "A8PRO QRScan API v2 — manual integration checks",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Use separate agreed test access. Keep credentials private. Run individual requests manually, not Collection Runner. Set stable point and node UUIDs; generate request_id for each new document and reuse it for retries. Copy mobile_url to a QR code. Poll receive=false until the operator finishes. Receive=true returns the result and receipt_token: copy the token manually, validate and durably save the result, then set ack_confirmed=yes to ACK. Reset ack_confirmed=no before each new session. No v1 fallback. See https://a8pro.kz/solutions/qrscan/api?lang=en"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{api_key}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://a8pro.kz/qrscan/api/v2",
      "type": "string"
    },
    {
      "key": "api_key",
      "value": "",
      "type": "string"
    },
    {
      "key": "request_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "exchange_point_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "node_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "receipt_token",
      "value": "",
      "type": "string"
    },
    {
      "key": "ack_confirmed",
      "value": "no",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "1 Create session",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{base_url}}/sessions",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"request_id\": \"{{request_id}}\",\n  \"exchange_point_id\": \"{{exchange_point_id}}\",\n  \"node_id\": \"{{node_id}}\",\n  \"photo_quality\": \"medium\",\n  \"scan_mode\": \"digital\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "2 Poll only",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{base_url}}/sessions/{{request_id}}/result",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"exchange_point_id\": \"{{exchange_point_id}}\",\n  \"node_id\": \"{{node_id}}\",\n  \"receive\": false\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "3 Receive when operator is finished",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{base_url}}/sessions/{{request_id}}/result",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"exchange_point_id\": \"{{exchange_point_id}}\",\n  \"node_id\": \"{{node_id}}\",\n  \"receive\": true\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "4 ACK only after durable save",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{base_url}}/sessions/{{request_id}}/ack",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"exchange_point_id\": \"{{exchange_point_id}}\",\n  \"node_id\": \"{{node_id}}\",\n  \"receipt_token\": \"{{receipt_token}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get('ack_confirmed') !== 'yes' || !/^[a-zA-Z0-9]{64}$/.test(pm.variables.get('receipt_token') || '')) { pm.execution.skipRequest(); throw new Error('Save the result durably, set receipt_token, then ack_confirmed=yes before ACK.'); }"
            ]
          }
        }
      ]
    }
  ]
}