{
  "info": {
    "name": "Hive R3Pv + Protected Flow — Receipts, Proof Vectors, and Signed Decisions",
    "description": "Runnable collection for the R3Pv primitive AND the new Hive Protected Flow decision layer. Every request hits a real, live Hive endpoint. R3Pv turns receipt groups into signed proof vectors; Hive Protected Flow (LIVE 2026-07-06) takes those vectors, applies a declared policy pack and declared exposure, and returns a signed decision + three-part meter quote (platform fee + R3Pv/Healing premium + optional bps on protected exposure). Evidence export bundles the signed vector, the signed decision, referenced receipts, and the signer's pubkey material for offline audit. Signed vectors AND signed assessments round-trip POST /v1/receipt/verify. Free self-attested tier is 30 R3Pv writes/hour and 20 Protected Flow assessments/hour per IP. No funds move in these calls, and this service never calls Circle APIs.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://receipts.thehiveryiq.com", "type": "string" }
  ],
  "item": [
    {
      "name": "1 · R3Pv health / smoke (primitive up?)",
      "request": {
        "method": "GET",
        "header": [],
        "url": { "raw": "{{baseUrl}}/v1/r3pv/health", "host": ["{{baseUrl}}"], "path": ["v1", "r3pv", "health"] },
        "description": "GET the R3Pv health. Expect HTTP 200: engine r3pv, schema r3pv-v1.0.0, signer did:hive:hivemorph (Ed25519), 11 healing states, and the vector dimensions."
      }
    },
    {
      "name": "2 · Protected Flow health (decision layer up?)",
      "request": {
        "method": "GET",
        "header": [],
        "url": { "raw": "{{baseUrl}}/v1/protected-flow/health", "host": ["{{baseUrl}}"], "path": ["v1", "protected-flow", "health"] },
        "description": "GET the Protected Flow health. Expect HTTP 200: engine protected-flow, schema protected-flow-v1.0.0, 8 decision classes (permit → block), 3 named policy packs (default / strict_bank / high_risk_agent), the meter schema (platform_fee_usd + protection_premium_usd_by_band + default_exposure_bps), and the signer did:hive:hivemorph (Ed25519)."
      }
    },
    {
      "name": "3 · Sign a receipt — stablecoin transfer (no funds move)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// stash the signed receipt object so later requests can group + assess + verify it",
              "var body = pm.response.json();",
              "if (body && body.receipt) {",
              "  pm.collectionVariables.set('lastReceipt', JSON.stringify(body.receipt));",
              "}",
              "pm.test('signed receipt returned', function () {",
              "  pm.expect(pm.response.code).to.eql(200);",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"stablecoin_transfer\",\n  \"external_system\": \"circle\",\n  \"actor\": { \"did\": \"did:example:agent\" },\n  \"payload\": {\n    \"asset\": \"USDC\",\n    \"amount\": \"25.00\",\n    \"from\": \"0xSender\",\n    \"to\": \"0xRecipient\",\n    \"network\": \"base\",\n    \"net_moved\": \"0.00\"\n  },\n  \"healing_state\": \"pre_broadcast_stoppable\"\n}"
        },
        "url": { "raw": "{{baseUrl}}/v1/receipt-relay/event", "host": ["{{baseUrl}}"], "path": ["v1", "receipt-relay", "event"] },
        "description": "Self-attested signed receipt over a described stablecoin transfer. NEVER calls Circle APIs — the receipt attests only that these exact bytes were received and signed. The optional healing_state declares the recovery window; Protected Flow (request 6) honors it. Returns receipt.receipt_id, payload_sha256, sig_b64u, key_id=did:hive:hivemorph, algorithm=Ed25519, and verification.ok=true."
      }
    },
    {
      "name": "4 · Sign a receipt — agentic API call (x402 shape)",
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"api_call\",\n  \"external_system\": \"postman\",\n  \"actor\": { \"did\": \"did:example:postman-agent\" },\n  \"payload\": {\n    \"method\": \"POST\",\n    \"url\": \"https://api.example.com/pay\",\n    \"x402\": true\n  }\n}"
        },
        "url": { "raw": "{{baseUrl}}/v1/receipt-relay/event", "host": ["{{baseUrl}}"], "path": ["v1", "receipt-relay", "event"] },
        "description": "Receipt an agentic API execution. Any action name is accepted; the receipt records intent, actor, and payload hashes at the self_attested tier."
      }
    },
    {
      "name": "5 · Create a receipt group (LIVE — POST /v1/r3pv/groups)",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// wrap the receipt captured by request 3 into a group body",
              "var r = pm.collectionVariables.get('lastReceipt');",
              "if (r) { pm.variables.set('groupBody', '{\"label\":\"agentic-payment-flow\",\"receipts\":[' + r + ']}'); }",
              "else { pm.variables.set('groupBody', '{\"label\":\"agentic-payment-flow\",\"receipt_ids\":[\"run request 3 first\"]}'); }"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "var body = pm.response.json();",
              "if (body && body.group_id) { pm.collectionVariables.set('groupId', body.group_id); }",
              "pm.test('group created', function () { pm.expect(pm.response.code).to.eql(200); });"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "body": { "mode": "raw", "raw": "{{groupBody}}" },
        "url": { "raw": "{{baseUrl}}/v1/r3pv/groups", "host": ["{{baseUrl}}"], "path": ["v1", "r3pv", "groups"] },
        "description": "Team signed receipts into a group. Accepts inline receipt objects and/or bare receipt_ids, optional graph edges and metadata. Returns group_id, receipt_count, resolved_receipts, unresolved_receipts. Free up to 30/IP/hour, then X-Hive-Activation-Key or X-Hive-Access."
      }
    },
    {
      "name": "6 · Generate the signed proof vector (LIVE — GET /v1/r3pv/vector)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// capture the signed vector so a later verify request can round-trip it",
              "var body = pm.response.json();",
              "if (body && body.signed_vector) {",
              "  var v = body.signed_vector;",
              "  pm.collectionVariables.set('vectorVerifyBody', JSON.stringify({ receipt_id: v.vector_id, payload_sha256: v.payload_sha256, sig_b64u: v.sig_b64u, ts: v.ts }));",
              "}",
              "pm.test('signed vector returned', function () {",
              "  pm.expect(pm.response.code).to.eql(200);",
              "  pm.expect(body.verification.ok).to.eql(true);",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": { "raw": "{{baseUrl}}/v1/r3pv/vector?group_id={{groupId}}", "host": ["{{baseUrl}}"], "path": ["v1", "r3pv", "vector"], "query": [ { "key": "group_id", "value": "{{groupId}}" } ] },
        "description": "Compute and Ed25519-sign the proof vector for the group from request 5. Returns signed_vector { vector_id, payload_sha256, sig_b64u, key_id=did:hive:hivemorph, algorithm=Ed25519, vector { verification_depth, weakest_proof_boundary, healing_state, recoverability_window, economic_exposure, policy_state, routing_recommendation, permitted_next_actions } } and verification.ok=true. POST /v1/r3pv/vector does group + vector in one call."
      }
    },
    {
      "name": "7 · Protected Flow — assess the group (LIVE — POST /v1/protected-flow/assess)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "var body = pm.response.json();",
              "if (body && body.signed_assessment) {",
              "  var a = body.signed_assessment;",
              "  pm.collectionVariables.set('assessmentVerifyBody', JSON.stringify({ receipt_id: a.assessment_id, payload_sha256: a.payload_sha256, sig_b64u: a.sig_b64u, ts: a.ts }));",
              "}",
              "pm.test('signed assessment returned', function () {",
              "  pm.expect(pm.response.code).to.eql(200);",
              "  pm.expect(body.verification.ok).to.eql(true);",
              "  pm.expect(body.signed_assessment.assessment.decision).to.be.oneOf(['permit','permit_with_evidence','require_approval','hold','recover','reroute','escalate','block']);",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"group_id\": \"{{groupId}}\",\n  \"policy_pack\": \"default\",\n  \"declared_exposure_usd\": 500.0,\n  \"exposure_bps\": 2.0\n}"
        },
        "url": { "raw": "{{baseUrl}}/v1/protected-flow/assess", "host": ["{{baseUrl}}"], "path": ["v1", "protected-flow", "assess"] },
        "description": "Assess an R3Pv group under a declared policy pack and declared exposure. Returns a signed_assessment { decision, rationale, risk_factors, permitted_next_actions, policy_pack, meter_quote { platform_fee_usd, protection_premium_usd, exposure_premium_usd, total_usd } } and verification.ok=true. Meter is a QUOTE — no funds move. Try policy_pack='strict_bank' or 'high_risk_agent' to see how the decision tightens. Free up to 20/IP/hour then X-Hive-Activation-Key or X-Hive-Access (else 402)."
      }
    },
    {
      "name": "8 · Protected Flow — evidence export (LIVE — GET /v1/protected-flow/evidence/{group_id}/export)",
      "request": {
        "method": "GET",
        "header": [],
        "url": { "raw": "{{baseUrl}}/v1/protected-flow/evidence/{{groupId}}/export", "host": ["{{baseUrl}}"], "path": ["v1", "protected-flow", "evidence", "{{groupId}}", "export"] },
        "description": "Bundle the signed R3Pv vector, the latest signed Protected Flow assessment, the referenced signed receipts, and the signer's pubkey material into a single Ed25519-signed evidence bundle for offline audit. The bundle round-trips /v1/receipt/verify like any Hive receipt. Free."
      }
    },
    {
      "name": "9 · Verify the R3Pv vector itself (round-trip /v1/receipt/verify)",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "var b = pm.collectionVariables.get('vectorVerifyBody');",
              "if (b) { pm.variables.set('verifyBody', b); }"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "body": { "mode": "raw", "raw": "{{verifyBody}}" },
        "url": { "raw": "{{baseUrl}}/v1/receipt/verify", "host": ["{{baseUrl}}"], "path": ["v1", "receipt", "verify"] },
        "description": "POST the signed vector's verifier fields (from request 6) back to the public verifier. Returns verified=true, proof_status=signature-verified — proving the R3Pv proof vector is itself a first-class verifiable object, not just JSON. If {{verifyBody}} is empty, run request 6 first."
      }
    },
    {
      "name": "10 · Verify the Protected Flow assessment itself (round-trip /v1/receipt/verify)",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "var b = pm.collectionVariables.get('assessmentVerifyBody');",
              "if (b) { pm.variables.set('verifyBody2', b); }"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "body": { "mode": "raw", "raw": "{{verifyBody2}}" },
        "url": { "raw": "{{baseUrl}}/v1/receipt/verify", "host": ["{{baseUrl}}"], "path": ["v1", "receipt", "verify"] },
        "description": "POST the signed assessment's verifier fields (from request 7) back to the public verifier. Returns verified=true, proof_status=signature-verified — the Protected Flow decision is a first-class Hive receipt: an auditor can re-verify it offline against the pubkey at /v1/prov/pubkey without any Hive-side call. If {{verifyBody2}} is empty, run request 7 first."
      }
    }
  ]
}
