{
  "info": {
    "_postman_id": "c3d4e5f6-post-4a7b-8c0d-interpose2026",
    "name": "Interpose Post-Trade API",
    "description": "Post-trade clearing, settlement, reconciliation, and corporate actions. Processes orders from BaaS, records a transaction, and submits to NSCC for T+1 settlement via Continuous Net Settlement (CNS).\n\n**Submission latency target:** <500ms from order receipt to NSCC submission.\n\n**Base URL:** `{{baseUrl}}`\n\n**Environment variables required:**\n- `baseUrl` — e.g. `https://api.interposehq.com`\n- `apiKey` — Bearer token or API key\n- `hmacSecret` — (optional) for HMAC-SHA256 server-to-server signing\n- `accountId` — BaaS account ID\n- `orderId` — BaaS order ID (filled order)\n- `transactionId` — set after creating a transaction\n- `actionId` — corporate action ID",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      { "key": "token", "value": "{{apiKey}}", "type": "string" }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "const hmacSecret = pm.environment.get('hmacSecret');",
          "if (hmacSecret) {",
          "    const timestamp = Date.now().toString();",
          "    const method = pm.request.method;",
          "    const urlObj = pm.request.url;",
          "    const path = '/' + urlObj.path.join('/');",
          "    const body = pm.request.body && pm.request.body.raw ? pm.request.body.raw : '';",
          "    const bodyHash = CryptoJS.SHA256(body).toString(CryptoJS.enc.Hex);",
          "    const canonical = method + '\\n' + path + '\\n' + timestamp + '\\n' + bodyHash;",
          "    const signature = CryptoJS.HmacSHA256(canonical, hmacSecret).toString(CryptoJS.enc.Hex);",
          "    pm.request.headers.upsert({ key: 'X-VM-Key-Id', value: pm.environment.get('apiKey') });",
          "    pm.request.headers.upsert({ key: 'X-VM-Timestamp', value: timestamp });",
          "    pm.request.headers.upsert({ key: 'X-VM-Signature', value: signature });",
          "}"
        ]
      }
    }
  ],
  "variable": [
    { "key": "baseUrl", "value": "https://api.interposehq.com", "type": "string" },
    { "key": "apiKey", "value": "your-api-key-here", "type": "string" },
    { "key": "hmacSecret", "value": "", "type": "string" },
    { "key": "accountId", "value": "acct_01HV4Y2K3M5N8P9QR2ST4UVWXY", "type": "string" },
    { "key": "orderId", "value": "ord_01HV4Y2K3M5N8P9QR2ST4UVWXY", "type": "string" },
    { "key": "transactionId", "value": "txn_01HV4Y2K3M5N8P9QR2ST4UVWXY", "type": "string" },
    { "key": "actionId", "value": "ca_01HV4Y2K3M5N8P9QR2ST4UVWXY", "type": "string" }
  ],
  "item": [
    {
      "name": "Transactions",
      "item": [
        {
          "name": "Record Transaction (submit to NSCC)",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 201) {",
                  "    const body = pm.response.json();",
                  "    pm.environment.set('transactionId', body.transaction_id);",
                  "    pm.test('gross_amount is 4dp string', () => {",
                  "        pm.expect(body.gross_amount).to.match(/^-?\\d+\\.\\d{4}$/);",
                  "    });",
                  "    pm.test('quantity is 8dp string', () => {",
                  "        pm.expect(body.quantity).to.match(/^\\d+\\.\\d{8}$/);",
                  "    });",
                  "    pm.test('settlement_date present', () => {",
                  "        pm.expect(body.settlement_date).to.be.a('string');",
                  "    });",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_id\": \"{{orderId}}\",\n  \"account_id\": \"{{accountId}}\",\n  \"security\": {\n    \"type\": \"ticker\",\n    \"value\": \"AAPL\"\n  },\n  \"side\": \"BUY\",\n  \"quantity\": \"10.00000000\",\n  \"gross_amount\": \"1855.0000\",\n  \"currency\": \"USD\",\n  \"trade_date\": \"2026-06-27\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{baseUrl}}/v1/transactions",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "transactions"]
            },
            "description": "Record a trade transaction and submit to NSCC for CNS netting. Settlement date is T+1 for equities. Status will be SUBMITTED_TO_NSCC until EOD netting confirms."
          }
        },
        {
          "name": "List Transactions",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/transactions?account_id={{accountId}}&limit=50",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "transactions"],
              "query": [
                { "key": "account_id", "value": "{{accountId}}" },
                { "key": "status", "value": "SETTLED", "disabled": true },
                { "key": "trade_date", "value": "2026-06-27", "disabled": true },
                { "key": "limit", "value": "50" }
              ]
            },
            "description": "List trade transactions. Status: PENDING | SUBMITTED_TO_NSCC | SETTLED | FAILED | CANCELLED."
          }
        },
        {
          "name": "Get Transaction",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/transactions/{{transactionId}}",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "transactions", "{{transactionId}}"]
            },
            "description": "Get transaction by ID. Includes nscc_ref once the CNS netting output is received."
          }
        }
      ]
    },
    {
      "name": "Reconciliation",
      "item": [
        {
          "name": "Get Reconciliation Status",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/reconciliation/status",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "reconciliation", "status"]
            },
            "description": "Get today's reconciliation status. Status: IN_PROGRESS | COMPLETED | FAILED. Shows matched count and open breaks."
          }
        },
        {
          "name": "List Reconciliation Breaks",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/reconciliation/breaks?date=2026-06-27",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "reconciliation", "breaks"],
              "query": [
                { "key": "date", "value": "2026-06-27" }
              ]
            },
            "description": "List open reconciliation breaks for a given date. Each break shows expected vs actual amounts and variance."
          }
        },
        {
          "name": "Trigger Reconciliation Run",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{baseUrl}}/v1/reconciliation/runs",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "reconciliation", "runs"]
            },
            "description": "Trigger a reconciliation run against DTCC/NSCC position data. Returns 202 Accepted."
          }
        }
      ]
    },
    {
      "name": "Corporate Actions",
      "item": [
        {
          "name": "List Corporate Actions",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/corporate-actions?security_type=ticker&security_value=AAPL&from_date=2026-01-01&to_date=2026-12-31",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "corporate-actions"],
              "query": [
                { "key": "security_type", "value": "ticker", "description": "cusip | isin | ticker" },
                { "key": "security_value", "value": "AAPL" },
                { "key": "from_date", "value": "2026-01-01" },
                { "key": "to_date", "value": "2026-12-31" }
              ]
            },
            "description": "List corporate actions. Types: DIVIDEND | STOCK_SPLIT | REVERSE_SPLIT | MERGER | SPINOFF | RIGHTS_OFFERING."
          }
        },
        {
          "name": "Get Corporate Action",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/corporate-actions/{{actionId}}",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "corporate-actions", "{{actionId}}"]
            }
          }
        },
        {
          "name": "Process Corporate Action",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{baseUrl}}/v1/corporate-actions/{{actionId}}/process",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "corporate-actions", "{{actionId}}", "process"]
            },
            "description": "Process a corporate action across all affected accounts. Returns the number of accounts affected."
          }
        }
      ]
    },
    {
      "name": "Stream (WebSocket)",
      "item": [
        {
          "name": "Real-Time Transaction Event Stream",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/stream",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "stream"]
            },
            "description": "WebSocket upgrade. Use Postman WebSocket tab or wscat.\n\nServer pushes CloudEvents 1.0:\n- `com.interpose.post-trade.transaction.initiated`\n- `com.interpose.post-trade.transaction.submitted`\n- `com.interpose.post-trade.transaction.settled`\n- `com.interpose.post-trade.transaction.failed`"
          }
        }
      ]
    }
  ]
}
