{
  "openapi": "3.1.0",
  "info": {
    "title": "SwapEazi Decision Intelligence API",
    "version": "2.5.0",
    "summary": "Know what's possible before you pay.",
    "description": "SwapEazi compiles a cross-border payment obligation into a PaymentIntent and returns a signed Decision Brief: every rail and provider for the pair and size, with access facts, documented capacity, settlement window, all-in cost against an independent reference with its basis, FX exposure and timing scenarios where a due date is given, the evidence class of each fact and the unknowns, marked inside, outside or unknown against the principal's own constraints. A guide, not an adviser. SwapEazi does not execute payments: SwapEazi never touches the money, ranks no provider and takes no share of volume. Measure, release records and verification are alongside the map. Pricing: https://swapeazi.io/pricing\n\nMCP for agents: claude mcp add --transport http swapeazi https://swapeazi.io/api/mcp. Without a key, the server answers the handshake and tools/list, and get_corridor_capacity, get_payment_guide, corridor_cost, swapeazi_landed_cost and discover_payment with their free view (rate-limited per IP). A paid API key, or x402 at USD 0.25 per call on get_corridor_capacity and get_payment_guide, gives the full answer; every other tool needs a paid key. SwapEazi never touches the money.\n\nExample call (no key):\n\n    curl -s https://swapeazi.io/api/mcp -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"get_corridor_capacity\",\"arguments\":{\"text\":\"Pay EUR 100k to Botswana\"}}}' Paid calls: x402 exact, USD 0.25 in USDC on Base or Solana (pay.sh compatible), or a paid key.",
    "contact": {
      "name": "SwapEazi",
      "email": "hello@swapeazi.io",
      "url": "https://swapeazi.io/developers"
    },
    "license": {
      "name": "Commercial — see https://swapeazi.io/legal"
    },
    "x-logo": {
      "url": "https://swapeazi.io/logo.png",
      "altText": "SwapEazi"
    },
    "x-mcp": {
      "endpoint": "https://swapeazi.io/api/mcp",
      "install": "claude mcp add --transport http swapeazi https://swapeazi.io/api/mcp",
      "access": "Without a key, the server answers the handshake and tools/list, and get_corridor_capacity, get_payment_guide, corridor_cost, swapeazi_landed_cost and discover_payment with their free view (rate-limited per IP). A paid API key, or x402 at USD 0.25 per call on get_corridor_capacity and get_payment_guide, gives the full answer; every other tool needs a paid key. SwapEazi never touches the money.",
      "exampleCall": "curl -s https://swapeazi.io/api/mcp -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"get_corridor_capacity\",\"arguments\":{\"text\":\"Pay EUR 100k to Botswana\"}}}'",
      "manifest": "https://swapeazi.io/.well-known/mcp.json"
    }
  },
  "servers": [
    {
      "url": "https://swapeazi.io",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Developer portal — code examples, playground, key issuance",
    "url": "https://swapeazi.io/developers"
  },
  "tags": [
    {
      "name": "Discovery",
      "description": "Free endpoints for agents to learn what SwapEazi can route."
    },
    {
      "name": "Quote",
      "description": "Free pricing — best route, output, fees, timing."
    },
    {
      "name": "Swap",
      "description": "Paid — execute a routed swap. $0.02 per call via x402, or HMAC key."
    },
    {
      "name": "MCP",
      "description": "Model Context Protocol server — Claude Desktop / Cursor / Windsurf tool integration."
    },
    {
      "name": "B2B",
      "description": "Higher-volume HMAC-key routes for partners."
    }
  ],
  "paths": {
    "/api/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Model Context Protocol server (JSON-RPC 2.0 over Streamable HTTP)",
        "description": "MCP-compliant tool server. Every MCP request requires a paid API key. Add to an MCP-aware client:\n\n```\nclaude mcp add --transport http swapeazi https://swapeazi.io/api/mcp --header \"Authorization: Bearer <paid-api-key>\"\n```\n\nIntent tools: `compile_intent`, `map_options`, `check_constraints`, `reconcile_outcome`, `coverage`. Measurement tools: `swapeazi_landed_cost`, `swapeazi_route_compare`, `swapeazi_guardrail_check`, `swapeazi_guardrail_reconcile`, `swapeazi_verify_record` and others. The full list is at https://swapeazi.io/.well-known/mcp.json. No tool moves money.",
        "operationId": "mcp",
        "requestBody": {
          "required": true,
          "description": "JSON-RPC 2.0 request (single or batch). Methods: initialize, tools/list, tools/call, ping.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "const": "2.0"
                  },
                  "id": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response"
          },
          "202": {
            "description": "Notification accepted (no response body)"
          },
          "400": {
            "description": "Parse error or invalid JSON-RPC request"
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "tags": [
          "B2B"
        ],
        "summary": "Health + EUR/ZAR rate",
        "operationId": "health",
        "responses": {
          "200": {
            "description": "Health payload"
          }
        }
      }
    },
    "/api/v1/fx/landed-cost": {
      "post": {
        "summary": "Measure one payment",
        "description": "What a single payment or quote costs against an independent mid. Free: the cost, its margin of error, and where it sits against what companies of your size typically negotiate. With a paid or Founding Partner key, the same response adds the open-market price at your size, who else would move it (each price labelled published, reported or estimated), the rate to ask your bank to match, and data_confidence.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "computed_metrics": {
                      "type": "object"
                    },
                    "negotiated": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "alternatives": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "alternatives": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/RankedAlternative"
                          }
                        },
                        "business_rails": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/BusinessRailEstimate"
                          }
                        },
                        "data_confidence": {
                          "$ref": "#/components/schemas/DataConfidence"
                        },
                        "floor": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/OpenMarketFloor"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "market_locked": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "reference_freshness": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ReferenceFreshness"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, with the field named"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sourceCurrency",
                  "destinationCurrency",
                  "inputAmount",
                  "netLandedFiat"
                ],
                "properties": {
                  "sourceCurrency": {
                    "type": "string"
                  },
                  "destinationCurrency": {
                    "type": "string"
                  },
                  "inputAmount": {
                    "type": "number"
                  },
                  "netLandedFiat": {
                    "type": "number"
                  },
                  "appliedRate": {
                    "type": "number",
                    "description": "Optional. The rate the provider quoted or applied, destination per source (the other way round is recognised). Splits the all-in cost into the margin inside the rate and fees and deductions (response field rate_split)."
                  },
                  "settledOn": {
                    "type": "string",
                    "format": "date"
                  },
                  "midSpot": {
                    "type": "number"
                  },
                  "annualVolumeUsd": {
                    "type": "number",
                    "description": "Optional. Your company's annual cross-border volume in USD, for the negotiated-rate benchmark."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fx/audit": {
      "post": {
        "summary": "FX cost audit",
        "description": "Every payment priced against the reference for its own settlement date, with margin of error, timing exposure where invoice dates are given, bank, official and G20 lines, totalled per currency. JSON or CSV. Also reads MT300 FX deal confirmations: spot deals are measured against the mid on the trade date; forwards are listed as needing a forward reference rather than priced against spot. Pass ?negotiated_bps=N (or negotiatedBps in JSON) to get drift: every payment above your agreed margin beyond the margin of error, and the excess cost.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "guarantee": {
                      "$ref": "#/components/schemas/AuditGuarantee"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, with the field named"
          },
          "401": {
            "description": "A paid key is required; the body names the product and its price"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payments"
                ],
                "properties": {
                  "payments": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Payment"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/fx/shortlist": {
      "get": {
        "summary": "Provider shortlist by size",
        "description": "Which providers can carry a payment of this size on this corridor, which are ruled out and by which documented limit, and which have published none. Each fact cites the provider's own page and the date it was checked.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input, with the field named"
          },
          "401": {
            "description": "A paid key is required; the body names the product and its price"
          }
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "curveAt",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated amounts for the shrink curve"
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/guardrail/check": {
      "post": {
        "summary": "Pre-trade guardrail",
        "description": "Every eligible route scored against the caller's own limits (maximum LDI, maximum settlement hours, regulated provider required), the caller's quote measured if given, beside bank, official and G20 lines. Evidence against your policy, never a recommendation. Every response carries decision.attestation, a signed record of the check; send it to /api/v1/guardrail/reconcile after settlement.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input, with the field named"
          },
          "401": {
            "description": "A paid key is required; the body names the product and its price"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "origin_currency",
                  "destination_currency",
                  "source_amount"
                ],
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "origin_currency": {
                    "type": "string"
                  },
                  "destination_currency": {
                    "type": "string"
                  },
                  "source_amount": {
                    "type": "number"
                  },
                  "origin_jurisdiction": {
                    "type": "string"
                  },
                  "destination_jurisdiction": {
                    "type": "string"
                  },
                  "max_acceptable_ldi_bps": {
                    "type": "number"
                  },
                  "max_settlement_hours": {
                    "type": "number"
                  },
                  "require_regulated_lp": {
                    "type": "boolean"
                  },
                  "quote": {
                    "type": "object",
                    "properties": {
                      "provider": {
                        "type": "string"
                      },
                      "landed_amount": {
                        "type": "number"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/guardrail/reconcile": {
      "post": {
        "summary": "Match a settled payment against its check",
        "description": "The signed record from /api/v1/guardrail/check, plus what landed (figures, or the bank's MT103 text or pacs.008 XML). Returns a signed matching record: HONOURED, SHORTFALL, BREACHED_POLICY, WITHIN_POLICY, MEASURED or MISMATCH, with the realised cost against the reference the check used, the market move between approval and value date, and, from a bank message, the cost split by who took it. Only amounts, dates, rates and charges are read from a message.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "attestation"
                ],
                "properties": {
                  "attestation": {
                    "type": "string",
                    "description": "decision.attestation from the guardrail check"
                  },
                  "settlement": {
                    "type": "object",
                    "required": [
                      "landed_amount"
                    ],
                    "properties": {
                      "landed_amount": {
                        "type": "number"
                      },
                      "source_amount": {
                        "type": "number"
                      },
                      "settled_on": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  },
                  "message": {
                    "type": "string",
                    "description": "MT103 text or pacs.008 XML for this payment"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed matching record"
          },
          "400": {
            "description": "Invalid input or a record that does not verify"
          },
          "401": {
            "description": "A paid key is required"
          },
          "503": {
            "description": "Signing is not configured on this deployment"
          }
        }
      }
    },
    "/api/v1/attestations/verify": {
      "get": {
        "summary": "Verify a decision or matching record",
        "description": "Free and keyless. Says whether a record was issued by SwapEazi unaltered, and returns what it says.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{ valid, record | reason }"
          }
        }
      },
      "post": {
        "summary": "Verify a decision or matching record",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "attestation"
                ],
                "properties": {
                  "attestation": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "{ valid, record | reason }"
          }
        }
      }
    },
    "/api/v1/attestations/keys": {
      "get": {
        "summary": "Signing keys",
        "description": "The Ed25519 public keys records are signed with, as a JWK set, for offline verification.",
        "responses": {
          "200": {
            "description": "JWK set"
          }
        }
      }
    },
    "/api/v1/verification": {
      "post": {
        "summary": "Provider verification",
        "description": "For payment and stablecoin providers: real receipts measured against the independent mid, corridor by corridor (median, p90, best, worst, margin of error), with the provider's claim tested (max_cost_bps, quote_honoured). Every corridor submitted appears; one with fewer than five priced receipts has no figure. Returns a signed record (typ provider.verification) that anyone can verify at /api/v1/attestations/verify. The provider pays for the measurement, never the result.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "provider",
                  "receipts"
                ],
                "properties": {
                  "provider": {
                    "type": "string"
                  },
                  "claim": {
                    "type": "object",
                    "properties": {
                      "max_cost_bps": {
                        "type": "number"
                      },
                      "quote_honoured": {
                        "type": "boolean"
                      }
                    }
                  },
                  "receipts": {
                    "type": "array",
                    "maxItems": 10000,
                    "items": {
                      "type": "object",
                      "required": [
                        "settledOn",
                        "from",
                        "to",
                        "sourceAmount",
                        "landedAmount"
                      ],
                      "properties": {
                        "settledOn": {
                          "type": "string",
                          "format": "date"
                        },
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        },
                        "sourceAmount": {
                          "type": "number"
                        },
                        "landedAmount": {
                          "type": "number"
                        },
                        "quotedLanded": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed verification record"
          },
          "400": {
            "description": "Invalid input, with the field named"
          },
          "401": {
            "description": "A paid key is required"
          },
          "503": {
            "description": "Signing is not configured"
          }
        }
      }
    },
    "/api/v1/market/status": {
      "get": {
        "summary": "Market data status",
        "description": "Per order-book venue: when a real response last passed every check (venue_confirmed_at), pairs passing, and failures. Only confirmed venues feed the open-market floor. Also the age of stored advertised prices and the last published-limits check. Free.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/register/outcomes": {
      "get": {
        "summary": "Recorded payment outcomes",
        "description": "Plain counts of real payment outcomes per provider and corridor, shown once a pair has at least five. No score is computed. Sources are kept apart: partner submissions, our own tests, public reports. Free.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Submit a payment outcome",
        "description": "A Founding Partner or paid customer reports how one of its own payments went through a provider. Economics only.",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "provider",
                  "from",
                  "to",
                  "date",
                  "outcome",
                  "consent"
                ],
                "properties": {
                  "provider": {
                    "type": "string"
                  },
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "success",
                      "blocked",
                      "delayed",
                      "rejected"
                    ]
                  },
                  "amount": {
                    "type": "number"
                  },
                  "amountCurrency": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "consent": {
                    "type": "boolean",
                    "const": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded"
          },
          "400": {
            "description": "Invalid input or consent missing"
          },
          "401": {
            "description": "Key required"
          }
        }
      }
    },
    "/api/v1/fx/forward": {
      "post": {
        "summary": "Fair forward and hedge carry",
        "description": "Estimated fair forward rate for a pair and tenor from the independent mid and public interest rates, with its margin of error. With a key and quotedRate, a bank's forward held to it.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/intents": {
      "post": {
        "tags": [
          "Options Map"
        ],
        "summary": "Compile a PaymentIntent",
        "description": "Structure a requirement into a PaymentIntent. Returns the intent, its sha256 hash and every assumption made.",
        "operationId": "compileIntent",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A full PaymentIntent, a flat form, or { text, from }. The source currency is never assumed.",
                "properties": {
                  "text": {
                    "type": "string",
                    "example": "pay a Japanese supplier JPY 800m by 15 October"
                  },
                  "from": {
                    "type": "string",
                    "example": "EUR"
                  },
                  "to": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "amount_basis": {
                    "type": "string",
                    "enum": [
                      "source",
                      "destination"
                    ]
                  },
                  "value_date": {
                    "type": "string",
                    "format": "date"
                  },
                  "max_all_in_bps": {
                    "type": "number"
                  },
                  "max_settlement_days": {
                    "type": "number"
                  },
                  "allowed_rail_classes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "bank",
                        "specialist_fx",
                        "payout_network",
                        "payment_network",
                        "local_rail",
                        "stablecoin"
                      ]
                    }
                  },
                  "instrument_classes_allowed": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "spot",
                        "forward",
                        "stablecoin_rail"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maps": {
      "post": {
        "tags": [
          "Options Map"
        ],
        "summary": "The signed Options Map for an intent",
        "description": "Body: { intent } in any form /api/v1/intents takes, or { intent_id }. Candidates sorted by coverage tier, rail class and provider name. Signed (options.map), with map_id and expires_at. Free within the daily allowance; a Bearer key lifts it.",
        "operationId": "createMap",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "intent": {
                    "type": "object",
                    "description": "A full PaymentIntent, a flat form, or { text, from }. The source currency is never assumed.",
                    "properties": {
                      "text": {
                        "type": "string",
                        "example": "pay a Japanese supplier JPY 800m by 15 October"
                      },
                      "from": {
                        "type": "string",
                        "example": "EUR"
                      },
                      "to": {
                        "type": "string"
                      },
                      "amount": {
                        "type": "number"
                      },
                      "amount_basis": {
                        "type": "string",
                        "enum": [
                          "source",
                          "destination"
                        ]
                      },
                      "value_date": {
                        "type": "string",
                        "format": "date"
                      },
                      "max_all_in_bps": {
                        "type": "number"
                      },
                      "max_settlement_days": {
                        "type": "number"
                      },
                      "allowed_rail_classes": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "bank",
                            "specialist_fx",
                            "payout_network",
                            "payment_network",
                            "local_rail",
                            "stablecoin"
                          ]
                        }
                      },
                      "instrument_classes_allowed": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "spot",
                            "forward",
                            "stablecoin_rail"
                          ]
                        }
                      }
                    }
                  },
                  "intent_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maps/{map_id}": {
      "get": {
        "tags": [
          "Options Map"
        ],
        "summary": "A stored Options Map",
        "description": "The map as issued, with expired true or false.",
        "operationId": "getMap",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "parameters": [
          {
            "name": "map_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/maps/{map_id}:check": {
      "post": {
        "tags": [
          "Options Map"
        ],
        "summary": "Hold a map to constraints",
        "description": "Re-evaluate every candidate against constraints supplied now, an AP2 open (intent) mandate, a Verifiable Intent credential, or x402 payment requirements (accepts[] with the listed price). Each row inside, outside or unknown. Nothing is executed.",
        "operationId": "checkMap",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "constraints": {
                    "type": "object"
                  },
                  "ap2_mandate": {
                    "type": "object"
                  },
                  "x402": {
                    "type": "object",
                    "properties": {
                      "accepts": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "price": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          }
                        }
                      }
                    }
                  },
                  "instrument_classes_allowed": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "policy_id": {
                    "type": "string",
                    "description": "A ReleasePolicy of this organisation (needs its key): supplies the limit and the map-age rule."
                  },
                  "verifiable_intent": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object"
                      }
                    ],
                    "description": "A Verifiable Intent credential (github.com/agent-intent/verifiable-intent): the serialised SD-JWT, or decoded mandate objects. amount_range, budget and expiry are held to the intent; disclosure digests are checked, signatures are left to the network; where the payment crosses currencies the result states that the mandate does not bound the conversion cost."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "map_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/reconcile": {
      "post": {
        "tags": [
          "Options Map"
        ],
        "summary": "Match what landed against a map",
        "description": "Expected band beside realised cost, signed (options.reconcile). Kept by pair and size band only; later maps at that size carry it. Economics only.",
        "operationId": "reconcileOutcome",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "map_id",
                  "candidate_id_used",
                  "realised"
                ],
                "properties": {
                  "map_id": {
                    "type": "string"
                  },
                  "candidate_id_used": {
                    "type": "string"
                  },
                  "realised": {
                    "type": "object",
                    "properties": {
                      "sent_amount": {
                        "type": "number"
                      },
                      "landed_amount": {
                        "type": "number"
                      },
                      "all_in_bps_vs_ref": {
                        "type": "number"
                      },
                      "settled_at": {
                        "type": "string"
                      },
                      "failure": {
                        "type": "boolean"
                      }
                    }
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "bank_mt",
                      "swift",
                      "onchain_tx",
                      "manual_upload"
                    ]
                  },
                  "proof_ref": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/watches": {
      "post": {
        "tags": [
          "Options Map"
        ],
        "summary": "Watch a corridor at a size",
        "description": "Body: { from, to, amount, amount_basis }. Returns watch_id and the URL to check for changes.",
        "operationId": "createWatch",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to",
                  "amount"
                ],
                "properties": {
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "amount_basis": {
                    "type": "string",
                    "enum": [
                      "source",
                      "destination"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Options Map"
        ],
        "summary": "Change events since the last check",
        "description": "candidate_added, candidate_removed, band_moved (beyond the reference error band), capacity_changed, access_fact_stale, coverage_tier_changed, reference_changed.",
        "operationId": "checkWatch",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": ""
          }
        ]
      }
    },
    "/api/v1/coverage": {
      "get": {
        "tags": [
          "Options Map"
        ],
        "summary": "Coverage",
        "description": "Without parameters: the register's coverage. With from and to (and amount): the coverage card for that pair and size: tier, matched outcomes behind it, candidates with economics, reference publishers and error band, whether a failure rate is published.",
        "operationId": "coverage",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input: error, field, message"
          },
          "404": {
            "description": "Not found"
          }
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "amount_basis",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          }
        ]
      }
    },
    "/api/v1/measure": {
      "post": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Markup Measure",
        "description": "A quote or landed payment as a mark-up over the ECB reference (available: false where the ECB does not publish the pair) and SwapEazi's reference with its error band. all_in_bps_vs_ref, spread and fee components, EUR size band, and an external band only from 5 consented observations (position_vs_band is descriptive). Signed (fx.measure). Free within the daily allowance; a key lifts it per org.",
        "operationId": "measure",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pair": {
                    "type": "string",
                    "example": "EURZAR"
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "sell_source",
                      "buy_destination"
                    ]
                  },
                  "source_amount": {
                    "type": "string"
                  },
                  "quoted_rate": {
                    "type": "string"
                  },
                  "fees": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "quote_timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "quote",
                      "landed"
                    ]
                  },
                  "landed_destination_amount": {
                    "type": "string"
                  },
                  "contribute": {
                    "type": "boolean",
                    "description": "Landed only: add this payment's cost, anonymously, to the band for its pair and size."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/policies": {
      "post": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Create a ReleasePolicy version",
        "description": "Versions are never edited; a change is a new version. Needs the organisation's key.",
        "operationId": "createPolicy",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "policy_id": {
                    "type": "string",
                    "description": "Omit for a new policy; send to create its next version."
                  },
                  "material_threshold": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      }
                    }
                  },
                  "require_map_id": {
                    "type": "boolean"
                  },
                  "map_max_age_minutes": {
                    "type": "integer"
                  },
                  "require_reconcile_within_days": {
                    "type": "integer"
                  },
                  "max_all_in_bps_vs_ref": {
                    "type": "number"
                  },
                  "exception_approver_role": {
                    "type": "string"
                  },
                  "agent_autonomy": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "description": "Optional tiers for releases by an agent, in the material_threshold currency: alone up to release_up_to; with a recorded agent_approval by approver_role up to approval_up_to (null for no upper bound); above it, a policy miss. Omit or null for no tiers.",
                    "properties": {
                      "release_up_to": {
                        "type": "string"
                      },
                      "approval_up_to": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "approver_role": {
                        "type": "string"
                      }
                    }
                  },
                  "effective_from": {
                    "type": "string",
                    "format": "date"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/policies/{policy_id}": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "A ReleasePolicy",
        "description": "Latest version, or ?version=n, with the list of versions.",
        "operationId": "getPolicy",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/policies/{policy_id}/clause.md": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "The model clause, filled in",
        "description": "Markdown with this policy's threshold and approver role. Names no vendor.",
        "operationId": "renderClause",
        "responses": {
          "200": {
            "description": "Markdown",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/releases": {
      "post": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Record a release",
        "description": "Creates a Release Evidence Record: policy_result (material, map_present_and_valid, within_max_all_in, exception, outcome met|miss|exception|not_material), appended to the organisation's hash chain (prev_rer_hash, rer_hash) and signed (release.record). A release with no map is recorded as a policy miss, never blocked. match status is kept outside the hash.",
        "operationId": "createRelease",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "policy_id",
                  "payment_ref",
                  "released_by"
                ],
                "properties": {
                  "policy_id": {
                    "type": "string"
                  },
                  "policy_version": {
                    "type": "integer"
                  },
                  "payment_ref": {
                    "type": "string",
                    "description": "Your internal reference; account numbers are refused."
                  },
                  "uetr": {
                    "type": "string",
                    "description": "The payment's SWIFT UETR (UUID v4), optional: ties the record to the payment itself. POST /api/v1/reconcile also accepts it in place of rer_id."
                  },
                  "amount": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "number"
                      },
                      "currency": {
                        "type": "string"
                      }
                    }
                  },
                  "intent_hash": {
                    "type": "string"
                  },
                  "map_id": {
                    "type": "string"
                  },
                  "measure_id": {
                    "type": "string"
                  },
                  "released_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "released_by": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "human",
                          "system",
                          "agent"
                        ]
                      },
                      "id": {
                        "type": "string"
                      }
                    }
                  },
                  "exception": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string"
                      },
                      "approved_by": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "agent_approval": {
                    "type": "object",
                    "description": "Agent releases only: { id, role } of the person who signed off a release above the policy's agent_autonomy.release_up_to.",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "List releases",
        "description": "Filter by released_at (from, to) and policy_result.",
        "operationId": "listReleases",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "policy_result",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/releases/{rer_id}": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "One release record",
        "description": "With its match status as of now: pending, done, overdue or not_required.",
        "operationId": "getRelease",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "parameters": [
          {
            "name": "rer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/releases/verify-chain": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Verify the chain",
        "description": "Recomputes every hash and link: { ok, count, head } or { ok: false, broken_at, reason }.",
        "operationId": "verifyChain",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        }
      }
    },
    "/api/v1/adherence": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Policy adherence",
        "description": "material_releases, with_valid_map_pct, exceptions_count with reasons, reconciled_pct, realised_vs_expected. No saving figure.",
        "operationId": "adherence",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/audit/sample": {
      "post": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Draw an audit sample",
        "description": "random or monetary_unit, seeded and stored: the same period, method, size and seed return the same sample.",
        "operationId": "auditSample",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to",
                  "seed"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "random",
                      "monetary_unit"
                    ]
                  },
                  "size": {
                    "type": "integer"
                  },
                  "seed": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/audit/exceptions": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Exceptions report",
        "description": "JSON, or CSV (UTF-8 BOM, ISO dates) with format=csv. Columns: rer_id, payment_ref, released_at, amount, currency, map_ok, exception_approved, reconcile_status, chain_ok, finding.",
        "operationId": "auditExceptions",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          },
          "401": {
            "description": "A key is required"
          },
          "403": {
            "description": "The key acts for a different org_id"
          }
        },
        "parameters": [
          {
            "name": "sample_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/benchmark/leakage": {
      "get": {
        "tags": [
          "Release evidence"
        ],
        "summary": "Public Leakage Benchmark",
        "description": "Not yet available: no company filings have been collected yet, so the response carries status not_yet_available and no cells. When published: median and interquartile FX result as bps of revenue by sector, region and size tier, from filings. Cells of 5 companies or more only; no company named; versioned quarterly snapshots.",
        "operationId": "leakageBenchmark",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "404": {
            "description": "Not found"
          }
        },
        "parameters": [
          {
            "name": "sector",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "snapshot",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/fx/free-check": {
      "post": {
        "summary": "Free one-route check",
        "description": "A company's payment export (JSON or CSV) measured for its largest route, against the official business average, bank advertised prices and the best price without negotiating. Requires consent 'contribute-v1': the anonymised economics of the payments are kept. Free.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input, with the field named"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "consent",
                  "payments"
                ],
                "properties": {
                  "consent": {
                    "type": "string",
                    "enum": [
                      "contribute-v1"
                    ]
                  },
                  "payments": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Payment"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fx/check": {
      "get": {
        "summary": "FX Agent check: how to call it",
        "description": "Price, limits and the request shape of POST /api/v1/fx/check.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "FX Agent check: every FX cost on a statement found, proven and booked",
        "description": "A bank or card statement (CSV, or PDF/screenshot where the reader is configured) plus supplier invoices, or transactions[] and invoices[] as JSON. Matches each charge to its invoice, rates it at the ECB mid of the transaction date (last business day on weekends), splits hidden markup, disclosed fee and VAT, books balanced journals, flags exceptions and returns a signed, re-runnable pack (same input = same output). Free up to 20 transactions a month without a key; with an API key, unlimited and metered. ?format=pdf returns the audit pack PDF.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "name",
                        "data"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "data": {
                          "type": "string",
                          "description": "CSV/JSON text, or base64 for PDF and images"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "statement",
                            "invoice"
                          ]
                        },
                        "media_type": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string",
                          "description": "Account currency when the CSV has no currency column"
                        },
                        "account": {
                          "type": "string",
                          "description": "Card or account label for the summary"
                        }
                      }
                    }
                  },
                  "transactions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "processing_date": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Negative = money out"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "foreign_amount": {
                          "type": "number"
                        },
                        "foreign_currency": {
                          "type": "string"
                        },
                        "bank_rate": {
                          "type": "number"
                        },
                        "fee": {
                          "type": "number"
                        },
                        "vat": {
                          "type": "number"
                        },
                        "cashback": {
                          "type": "number"
                        },
                        "status": {
                          "type": "string"
                        },
                        "account": {
                          "type": "string"
                        },
                        "chain": {
                          "type": "string",
                          "enum": [
                            "ethereum",
                            "tron",
                            "base"
                          ]
                        },
                        "tx_hash": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "invoices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "vendor": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "date": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "vat": {
                          "type": "number"
                        },
                        "reference_currency": {
                          "type": "string"
                        },
                        "reference_amount": {
                          "type": "number"
                        },
                        "reference_rate": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "functional_currency": {
                        "type": "string"
                      },
                      "chart_of_accounts": {
                        "type": "object"
                      },
                      "rate_source": {
                        "type": "string",
                        "enum": [
                          "ECB"
                        ]
                      },
                      "accounting_policy": {
                        "type": "object",
                        "properties": {
                          "fx_cost": {
                            "type": "string",
                            "enum": [
                              "separate_account",
                              "in_expense"
                            ]
                          },
                          "expense_rate_date": {
                            "type": "string",
                            "enum": [
                              "invoice",
                              "charge"
                            ]
                          }
                        }
                      },
                      "match_window_days": {
                        "type": "integer"
                      },
                      "period_end": {
                        "type": "string"
                      }
                    }
                  },
                  "consent": {
                    "type": "boolean",
                    "description": "Add the result anonymously to the public markup index (provider, card type, pair, amount bucket, date, markup %)"
                  },
                  "provider": {
                    "type": "string"
                  },
                  "card_type": {
                    "type": "string",
                    "enum": [
                      "credit",
                      "debit",
                      "prepaid",
                      "app"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The check: lines, journals, flags, totals, summary, pack_id, input_hash, output_hash, signature"
          },
          "400": {
            "description": "Invalid input, with the field named"
          },
          "422": {
            "description": "Nothing could be read, with the reason"
          }
        }
      }
    },
    "/api/v1/fx/check/{pack_id}": {
      "get": {
        "summary": "A stored FX Agent pack (JSON, or ?format=pdf)",
        "parameters": [
          {
            "name": "pack_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "No such pack"
          }
        }
      }
    },
    "/api/v1/fx/markup-index": {
      "get": {
        "summary": "The public FX markup index",
        "description": "Average hidden markup by provider and currency pair from consented anonymous checks; a provider is shown once it has 10 or more samples.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "searchRoutes",
        "summary": "Search payment routes in plain words",
        "description": "Ask how to land a payment, e.g. q=land 500 EUR in Douala on MTN today. Returns the payment as understood, official and street rates as separate dated fields, and routes ordered by evidence of what landed; without enough landed evidence a route says \"not enough evidence yet\" and has no rank. Signed. Free view; a paid key, or the MCP tool search_routes paid by x402 (USD 0.25), gives every route's full evidence. SwapEazi never sends or holds money.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "land 500 EUR in Douala on MTN today"
          }
        ],
        "responses": {
          "200": {
            "description": "Search answer (schema swapeazi.search.v1)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/official-rates": {
      "get": {
        "operationId": "officialRates",
        "summary": "Official central-bank rate per currency",
        "description": "Latest official rate per US dollar: legal peg, the currency's own central bank, or another institutional fixing (labelled), with the street rate as a separate dated field. Without currency: the latest for every hard-to-read currency. Free; history and every publisher with a paid key or the MCP tool get_official_rate by x402.",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "XAF"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Official rate (schema swapeazi.official_rate.v2)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/datasets": {
      "get": {
        "operationId": "datasetIndex",
        "summary": "Machine-readable index of SwapEazi's datasets",
        "description": "Every dataset and stable URL an agent can read: corridors, official rates, coverage ledger, capacity registry, landed reports, with how each is collected, how often, and what is free or paid.",
        "responses": {
          "200": {
            "description": "Dataset index (schema swapeazi.datasets.v1)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/plan": {
      "post": {
        "operationId": "planPayment",
        "summary": "Plan a cross-border payment in one call",
        "description": "Routes ordered by evidence of what landed, official and street rates, all-in cost where public, documents, tracking handle, compliance manifest and safety block. Signed. Free view; a paid key or the MCP tool plan_payment by x402 (USD 0.25) gives every route's full evidence. SwapEazi never sends or holds money.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "q": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "corridor": {
                    "type": "string",
                    "example": "EUR-XAF"
                  },
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "payer_type": {
                    "type": "string",
                    "enum": [
                      "business",
                      "payout_company",
                      "individual"
                    ]
                  },
                  "payee": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "people"
                    ]
                  },
                  "payout_method": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Plan (schema swapeazi.plan.v1)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/plans/{plan_id}": {
      "get": {
        "operationId": "getPlan",
        "summary": "A plan's tracking record",
        "parameters": [
          {
            "name": "plan_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Plan record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokenised-routes": {
      "get": {
        "operationId": "tokenisedRoutes",
        "summary": "Tokenised deposit route check, or every network record",
        "description": "With q: can a payment move on tokenised deposits (networks, links, hours and downtime, reachable banks, the Swift correspondent alternative, sources, signed); \"not enough evidence yet\" where public sources do not prove it. Without q: every network record. SwapEazi never sends, holds or settles money.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "can a USD payment reach DBS Singapore 24/7 on tokenised deposits from a US bank?"
          }
        ],
        "responses": {
          "200": {
            "description": "Route check (swapeazi.tokenised_route.v1) or networks (swapeazi.tokenised_networks.v1)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokenised-routes/networks/{id}": {
      "get": {
        "operationId": "tokenisedNetwork",
        "summary": "One tokenised deposit network's record",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "kinexys",
                "dbs-token-services",
                "partior",
                "swift-ledger"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Network record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokenised-routes/banks": {
      "get": {
        "operationId": "tokenisedBankLookup",
        "summary": "Which tokenised deposit networks a bank is on",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "DBSSSGSG"
          }
        ],
        "responses": {
          "200": {
            "description": "Bank lookup (swapeazi.tokenised_bank.v1)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pre-payout": {
      "post": {
        "operationId": "prePayoutCheck",
        "summary": "The check an agent runs right before a payout",
        "description": "e.g. q=about to pay out 4,000,000 MXN to a bank via Solana. Payout value at the official rate, routes ordered by evidence of what landed (\"not enough evidence yet\" where thin), all-in cost where public, landing time, delay risk, documents, compliance, safety, signed. Free view; full evidence with a paid key or the MCP tool check_before_payout by x402 (USD 0.25 in USDC on Base or Solana). SwapEazi never sends, holds or settles money.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "q": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "chain": {
                    "type": "string",
                    "enum": [
                      "solana",
                      "base"
                    ]
                  },
                  "from": {
                    "type": "string"
                  },
                  "payout_method": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-payout check (swapeazi.pre_payout.v1)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "HmacApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-swapeazi-key",
        "description": "Stateless HMAC-signed key. Issue one at https://swapeazi.io/developers (free, rate-limited)."
      },
      "X402Payment": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PAYMENT",
        "description": "Base64url-encoded x402 payment payload. $0.02 USDC on Base. See https://docs.cdp.coinbase.com/x402"
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A paid API key, issued on purchase."
      },
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Payment": {
        "type": "object",
        "required": [
          "settledOn",
          "from",
          "to",
          "sourceAmount",
          "landedAmount"
        ],
        "properties": {
          "ref": {
            "type": "string"
          },
          "settledOn": {
            "type": "string",
            "format": "date"
          },
          "invoicedOn": {
            "type": "string",
            "format": "date"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "sourceAmount": {
            "type": "number"
          },
          "landedAmount": {
            "type": "number"
          }
        }
      },
      "PricingSource": {
        "type": "string",
        "enum": [
          "published",
          "reported",
          "estimated"
        ],
        "description": "How a price in a ranking was obtained. published: the provider states this price or markup itself (its pricing page or advertised price). reported: a credible third party reports it, such as an independent rate tracker or a published comparison; the provider has not confirmed it to us. estimated: no provider-specific figure exists; the price is what this kind of provider typically charges, from published industry ranges. Estimated rows are labelled on every screen that shows them."
      },
      "DataConfidence": {
        "type": "object",
        "description": "How much of a ranking is published, reported or estimated. The three counts add up to total, the number of ranked rows returned (alternatives plus business_rails).",
        "properties": {
          "published": {
            "type": "integer"
          },
          "reported": {
            "type": "integer"
          },
          "estimated": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "published",
          "reported",
          "estimated",
          "total"
        ]
      },
      "RankedAlternative": {
        "type": "object",
        "description": "A provider's advertised all-in price at the nearest sampled size, from the public comparison feed.",
        "properties": {
          "provider": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "bank",
              "specialist"
            ]
          },
          "all_in_bps": {
            "type": "number"
          },
          "advertised_at": {
            "type": "number"
          },
          "estimated_landed": {
            "type": "number"
          },
          "vs_your_quote": {
            "type": [
              "number",
              "null"
            ]
          },
          "max_per_transaction": {
            "type": [
              "number",
              "null"
            ]
          },
          "licence": {
            "type": [
              "string",
              "null"
            ]
          },
          "collected": {
            "type": "string",
            "format": "date"
          },
          "pricing_source": {
            "$ref": "#/components/schemas/PricingSource"
          },
          "pricing_basis": {
            "type": "string",
            "enum": [
              "advertised_price"
            ]
          }
        },
        "required": [
          "provider",
          "all_in_bps",
          "pricing_source"
        ]
      },
      "BusinessRailEstimate": {
        "type": "object",
        "description": "A business payment provider that publishes no comparable price, with a price range and how it was obtained.",
        "properties": {
          "provider": {
            "type": "string"
          },
          "rail": {
            "type": "string"
          },
          "estimate": {
            "type": "object",
            "properties": {
              "low_bps": {
                "type": "number"
              },
              "mid_bps": {
                "type": "number"
              },
              "high_bps": {
                "type": "number"
              }
            }
          },
          "pricing_source": {
            "$ref": "#/components/schemas/PricingSource"
          },
          "basis": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "provider",
          "estimate",
          "pricing_source"
        ]
      },
      "OpenMarketFloor": {
        "type": "object",
        "description": "What converting this amount costs on public order books right now, across venues each confirmed against its own live responses (see GET /api/v1/market/status). Venues not confirmed are excluded.",
        "properties": {
          "cost_bps": {
            "type": [
              "number",
              "null"
            ]
          },
          "route": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "venues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "venues_confirmed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "filled": {
            "type": "boolean"
          },
          "depth_limit": {
            "type": [
              "number",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "reference_point",
              "live_alternative"
            ],
            "description": "reference_point on major pairs, where public order books are thinner than the interbank market and the negotiated-tier benchmark is the primary comparison; live_alternative on emerging-market pairs, where stablecoin rails compete."
          },
          "role_note": {
            "type": "string"
          }
        }
      },
      "ReferenceFreshness": {
        "type": "object",
        "description": "How old the reference behind a quote is. Stale past 36 business hours (weekends not counted); a stale reference carries a wider margin of error.",
        "properties": {
          "rate_as_of": {
            "type": "string",
            "format": "date"
          },
          "age_business_hours": {
            "type": "number"
          },
          "stale": {
            "type": "boolean"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AuditGuarantee": {
        "type": "object",
        "description": "Whether the performance fee is due; the flat fee is charged regardless. Counts measured cost only: each payment's cost against the independent mid, less its margin of error, less the top of the negotiated range for the company's annual volume. Estimated or advertised provider prices, the open-market floor, provider comparisons, timing and unpriced payments never count.",
        "properties": {
          "threshold_usd": {
            "type": "number"
          },
          "measured_avoidable_usd": {
            "type": "number"
          },
          "annual_volume_usd": {
            "type": "number"
          },
          "peer_tier": {
            "type": "string"
          },
          "payments_counted": {
            "type": "integer"
          },
          "payments_without_usd_reference": {
            "type": "integer"
          },
          "never_counted": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "basis": {
            "type": "string"
          },
          "flat_fee_usd": {
            "type": "number",
            "description": "Charged up front for the work, whatever the audit finds."
          },
          "performance_fee_usd": {
            "type": "number",
            "description": "Charged only when measured avoidable cost reaches threshold_usd (10x this fee)."
          },
          "performance_fee_payable": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
