{
  "info": {
    "name": "FX-Port Account API",
    "_postman_id": "fxport-account-v1",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Account endpoints: balances, financial ledger, and booking history. Auth: Bearer token in Authorization header."
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{api_key}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.fx-port.com",
      "type": "string"
    },
    {
      "key": "api_key",
      "value": "",
      "type": "string",
      "description": "Your FX-Port API key (fxp_live_... or fxp_test_...). Get it at https://fx-port.com/dashboard/api"
    },
    {
      "key": "balance_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "booking_id",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Get Balances",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/api/v1/balances",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "balances"
          ]
        },
        "description": "Returns current balance for each currency. Capture the uid=502(mez) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),703(com.apple.sharepoint.group.3),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae),702(com.apple.sharepoint.group.2),701(com.apple.sharepoint.group.1) field as  for the history endpoint. Sandbox returns empty array."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "try { const d=pm.response.json(); const b=(d.data||[])[0]; if(b&&b.id) pm.collectionVariables.set(\"balance_id\",b.id); } catch(e){}"
            ]
          }
        }
      ]
    },
    {
      "name": "Get Balance History",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/api/v1/balances/{{balance_id}}/history?from=2026-01-01&limit=50",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "balances",
            "{{balance_id}}",
            "history"
          ],
          "query": [
            {
              "key": "from",
              "value": "2026-01-01"
            },
            {
              "key": "limit",
              "value": "50"
            }
          ]
        },
        "description": "Full financial ledger for a specific currency balance. Use transactions rows for reconciliation totals; use *_balance_operations rows to trace individual booking history."
      }
    },
    {
      "name": "Get Booking History",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/api/v1/history?product=all&limit=20",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "history"
          ],
          "query": [
            {
              "key": "product",
              "value": "all"
            },
            {
              "key": "limit",
              "value": "20"
            }
          ]
        },
        "description": "Booking summaries across all products, sorted newest first."
      }
    },
    {
      "name": "Get Single Booking",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{base_url}}/api/v1/bookings/{{booking_id}}?product=flights",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "bookings",
            "{{booking_id}}"
          ],
          "query": [
            {
              "key": "product",
              "value": "flights"
            }
          ]
        },
        "description": "Detail record for a single booking. For flights: includes pricing breakdown, traveler pricing, and balance operations."
      }
    }
  ]
}