{
 "openapi": "3.0.3",
 "info": {
  "title": "POASwap API",
  "version": "1.1.0",
  "description": "Read-only view of the Proof of Agent swap escrow, plus quotes, prompts, Relay quotes, signed intents, webhooks and the wallet registry. No key, CORS open. POASwap never signs, holds keys or posts offers. Every JSON reply carries X-API-Version; errors are {error, secret}.",
  "contact": {
   "url": "https://poaswap.io/about#api"
  }
 },
 "servers": [
  {
   "url": "https://poaswap.io/api/v1"
  }
 ],
 "paths": {
  "/swaps": {
   "get": {
    "summary": "Every swap offer, newest activity first",
    "tags": [
     "swaps"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Offer"
         }
        }
       },
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    }
   }
  },
  "/swaps.csv": {
   "get": {
    "summary": "Every swap offer as CSV",
    "tags": [
     "swaps"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       },
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    }
   }
  },
  "/swaps/status": {
   "get": {
    "summary": "Swap availability, open offers and market stats from fills",
    "tags": [
     "swaps"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SwapStatus"
        }
       }
      }
     }
    }
   }
  },
  "/swaps/price-history": {
   "get": {
    "summary": "One row per fill: price per 1M POA in the paying asset",
    "tags": [
     "swaps"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "type": "object"
         }
        }
       },
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    }
   }
  },
  "/swaps/{offer_id}": {
   "get": {
    "summary": "One offer with its fill and cancel events",
    "tags": [
     "swaps"
    ],
    "parameters": [
     {
      "name": "offer_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "64-hex offer id"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "offer": {
           "$ref": "#/components/schemas/Offer"
          },
          "events": {
           "type": "array",
           "items": {
            "type": "object"
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "description": "unknown offer"
     }
    }
   }
  },
  "/price": {
   "get": {
    "summary": "POA in USD from filled swaps only",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/book": {
   "get": {
    "summary": "Asks per pair, spread, last fill and recent fills",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/stream": {
   "get": {
    "summary": "The book as Server-Sent Events",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/quote": {
   "get": {
    "summary": "Quote a buy or sell over whole offers",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "pair",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "BASE-chain, e.g. SOL-solana, USDC-solana, ETH-base, ETH-ethereum"
     },
     {
      "name": "side",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "buy or sell"
     },
     {
      "name": "amount",
      "in": "query",
      "required": false,
      "schema": {
       "type": "number"
      },
      "description": "buy: asset to spend; sell: POA to sell"
     },
     {
      "name": "route",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "best: rank and split across every pair"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/compose": {
   "get": {
    "summary": "One exact prompt and the unsigned requests for your own Agent",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "pair",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "BASE-chain, e.g. SOL-solana, USDC-solana, ETH-base, ETH-ethereum"
     },
     {
      "name": "side",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "buy or sell"
     },
     {
      "name": "amount",
      "in": "query",
      "required": false,
      "schema": {
       "type": "number"
      },
      "description": ""
     },
     {
      "name": "quote_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "quote_id from /quote"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   },
   "post": {
    "summary": "The compose call as a POST (same fields as GET /compose)",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "pair": {
          "type": "string"
         },
         "asset": {
          "type": "string"
         },
         "chain": {
          "type": "string"
         },
         "side": {
          "type": "string"
         },
         "amount": {
          "type": "number"
         },
         "quote_id": {
          "type": "string"
         },
         "quote": {
          "type": "string"
         },
         "offer": {
          "type": "string"
         },
         "pay_with": {
          "type": "string"
         },
         "to": {
          "type": "string"
         },
         "to_sol": {
          "type": "string"
         },
         "to_evm": {
          "type": "string"
         },
         "agent": {
          "type": "string"
         },
         "session": {
          "type": "string"
         },
         "route": {
          "type": "string"
         },
         "poa": {
          "type": "number"
         },
         "usd": {
          "type": "number"
         },
         "across": {
          "type": "string"
         },
         "from": {
          "type": "string"
         }
        },
        "additionalProperties": false
       }
      },
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "pair": {
          "type": "string"
         },
         "asset": {
          "type": "string"
         },
         "chain": {
          "type": "string"
         },
         "side": {
          "type": "string"
         },
         "amount": {
          "type": "number"
         },
         "quote_id": {
          "type": "string"
         },
         "quote": {
          "type": "string"
         },
         "offer": {
          "type": "string"
         },
         "pay_with": {
          "type": "string"
         },
         "to": {
          "type": "string"
         },
         "to_sol": {
          "type": "string"
         },
         "to_evm": {
          "type": "string"
         },
         "agent": {
          "type": "string"
         },
         "session": {
          "type": "string"
         },
         "route": {
          "type": "string"
         },
         "poa": {
          "type": "number"
         },
         "usd": {
          "type": "number"
         },
         "across": {
          "type": "string"
         },
         "from": {
          "type": "string"
         }
        },
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/ladder": {
   "get": {
    "summary": "Split one sell into stepped offers",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "pair",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "BASE-chain, e.g. SOL-solana, USDC-solana, ETH-base, ETH-ethereum"
     },
     {
      "name": "poa",
      "in": "query",
      "required": true,
      "schema": {
       "type": "number"
      },
      "description": "total POA to sell"
     },
     {
      "name": "steps",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer"
      },
      "description": "2 to 10"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/track": {
   "get": {
    "summary": "Swap stages by offer, Agent or payer",
    "tags": [
     "track"
    ],
    "parameters": [
     {
      "name": "offer",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "offer ids, comma separated"
     },
     {
      "name": "agent",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "poa1 address or Agent name"
     },
     {
      "name": "pay",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "public payer address"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/makers": {
   "get": {
    "summary": "An Agent's record as a maker",
    "tags": [
     "track"
    ],
    "parameters": [
     {
      "name": "agent",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "poa1 address or Agent name"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/intents": {
   "get": {
    "summary": "Open signed buy intents",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "pair",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "BASE-chain, e.g. SOL-solana, USDC-solana, ETH-base, ETH-ethereum"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   },
   "post": {
    "summary": "Post a signed buy intent",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "201": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "body": {
          "type": "object"
         },
         "sig": {
          "type": "string",
          "description": "base58 ed25519 signature of the canonical body by the poa1 key, made on your own machine"
         }
        },
        "additionalProperties": false,
        "required": [
         "body",
         "sig"
        ]
       }
      }
     },
     "description": "body from GET /intents/draft, signed locally"
    }
   }
  },
  "/stats": {
   "get": {
    "summary": "Public market and network stats",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/health": {
   "get": {
    "summary": "Freshness of POASwap's copy of the swap data; 503 when stale or refused",
    "tags": [
     "meta"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "503": {
      "description": "stale, or the last sync was refused (redirect or self-reference)"
     }
    }
   }
  },
  "/relay/quote": {
   "post": {
    "summary": "Relay legs for one open offer to your own verified address (numbers only while swaps are not live)",
    "tags": [
     "relay"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "upstream (Relay or a public RPC) unavailable",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "offer": {
          "type": "string",
          "description": "64-hex offer id"
         },
         "pay_with": {
          "type": "string",
          "description": "chain:ASSET, e.g. base:ETH"
         },
         "to": {
          "type": "string",
          "description": "your own verified address on the offer's chain"
         },
         "agent": {
          "type": "string",
          "description": "your poa1 address or Agent name"
         },
         "session": {
          "type": "string"
         },
         "from": {
          "type": "string",
          "description": "your paying address"
         }
        },
        "additionalProperties": false,
        "required": [
         "offer",
         "pay_with",
         "from",
         "to"
        ]
       }
      }
     }
    }
   }
  },
  "/relay/chains": {
   "get": {
    "summary": "Allow-listed pay_with origins and whether Relay has each enabled",
    "tags": [
     "relay"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "upstream (Relay or a public RPC) unavailable",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/relay/status": {
   "get": {
    "summary": "One Relay request's status (a refund is not a delivery)",
    "tags": [
     "relay"
    ],
    "parameters": [
     {
      "name": "request_id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Relay request id"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "upstream (Relay or a public RPC) unavailable",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/registry/register": {
   "post": {
    "summary": "Record your Emblem Wallet's public addresses for your poa1 Agent (JSON body only, never a query string)",
    "tags": [
     "registry"
    ],
    "parameters": [],
    "responses": {
     "201": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "410": {
      "description": "code expired",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "code": {
          "type": "string"
         },
         "src": {
          "type": "string",
          "enum": [
           "scan",
           "swap"
          ]
         },
         "event": {
          "type": "string",
          "enum": [
           "created",
           "connected"
          ]
         },
         "poa1": {
          "type": "string"
         },
         "poa": {
          "type": "string"
         },
         "sol": {
          "type": "string"
         },
         "evm": {
          "type": "string"
         },
         "client": {
          "type": "string"
         },
         "app_version": {
          "type": "string"
         },
         "created": {
          "type": "boolean"
         },
         "sig": {
          "type": "string",
          "description": "base58 ed25519 signature of the canonical body by the poa1 key, made on your own machine"
         },
         "session": {
          "type": "string"
         }
        },
        "additionalProperties": false,
        "required": [
         "code",
         "src",
         "event"
        ]
       }
      }
     }
    }
   }
  },
  "/registry/delete": {
   "post": {
    "summary": "Delete your wallet records, signed by the poa1 key",
    "tags": [
     "registry"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "body": {
          "type": "object"
         },
         "sig": {
          "type": "string",
          "description": "base58 ed25519 signature of the canonical body by the poa1 key, made on your own machine"
         }
        },
        "additionalProperties": false,
        "required": [
         "body",
         "sig"
        ]
       }
      }
     }
    }
   }
  },
  "/webhooks": {
   "post": {
    "summary": "Add a signed webhook for one offer or one public address (the secret is shown once)",
    "tags": [
     "track"
    ],
    "parameters": [],
    "responses": {
     "201": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "url": {
          "type": "string",
          "description": "https URL on port 443, public host"
         },
         "offer": {
          "type": "string"
         },
         "address": {
          "type": "string"
         }
        },
        "additionalProperties": false,
        "required": [
         "url"
        ]
       }
      }
     }
    }
   }
  },
  "/webhooks/{id}": {
   "get": {
    "summary": "A webhook's status (secret masked); unsubscribe=1 removes it",
    "tags": [
     "track"
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "wh_ id"
     },
     {
      "name": "token",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "token from the add reply"
     },
     {
      "name": "unsubscribe",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "1 to remove"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "unknown id",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "delete": {
    "summary": "Remove a webhook",
    "tags": [
     "track"
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "wh_ id"
     },
     {
      "name": "token",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "token from the add reply"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "unknown id",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/intents/draft": {
   "get": {
    "summary": "The unsigned intent body and its canonical string, to sign locally (nothing stored)",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "agent",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "poa1 address"
     },
     {
      "name": "pair",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "BASE-chain, e.g. SOL-solana, USDC-solana, ETH-base, ETH-ethereum"
     },
     {
      "name": "size",
      "in": "query",
      "required": true,
      "schema": {
       "type": "number"
      },
      "description": "POA wanted"
     },
     {
      "name": "max_price",
      "in": "query",
      "required": true,
      "schema": {
       "type": "number"
      },
      "description": "per 1M POA"
     },
     {
      "name": "ttl",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer"
      },
      "description": "seconds"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/intents/cancel-draft": {
   "get": {
    "summary": "The unsigned cancel body to sign locally",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "agent",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "poa1 address"
     },
     {
      "name": "id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "in_ id"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/intents/cancel": {
   "post": {
    "summary": "Cancel your intent, signed by the poa1 key",
    "tags": [
     "market"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "body": {
          "type": "object"
         },
         "sig": {
          "type": "string",
          "description": "base58 ed25519 signature of the canonical body by the poa1 key, made on your own machine"
         }
        },
        "additionalProperties": false,
        "required": [
         "body",
         "sig"
        ]
       }
      }
     }
    }
   }
  },
  "/intents/{id}": {
   "get": {
    "summary": "One intent",
    "tags": [
     "market"
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "in_ id"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "unknown id",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/balance": {
   "post": {
    "summary": "One public balance from a public RPC (never logged or stored)",
    "tags": [
     "track"
    ],
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "upstream (Relay or a public RPC) unavailable",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "pair": {
          "type": "string"
         },
         "address": {
          "type": "string"
         }
        },
        "additionalProperties": false,
        "required": [
         "pair",
         "address"
        ]
       }
      }
     }
    }
   }
  },
  "/beacon": {
   "post": {
    "summary": "Count one allow-listed page event (navigator.sendBeacon; plain text body, no cookies)",
    "tags": [
     "meta"
    ],
    "parameters": [],
    "responses": {
     "204": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "text/plain": {
       "schema": {
        "type": "string",
        "maxLength": 64
       }
      }
     }
    }
   }
  },
  "/agent/{op}": {
   "post": {
    "summary": "The swap page's side of an Agent session (same origin; new, send, close, state)",
    "tags": [
     "agent"
    ],
    "parameters": [
     {
      "name": "op",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "new, send, close or state"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "bad input (error says why; secret is true when a key-shaped value was refused)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "411": {
      "description": "chunked bodies are refused; send Content-Length",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "body over the route's cap",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "page": {
          "type": "string"
         },
         "text": {
          "type": "string"
         }
        },
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/agent/stream": {
   "get": {
    "summary": "The page session's messages as Server-Sent Events (status rows with stage setup carry step and state)",
    "tags": [
     "agent"
    ],
    "parameters": [
     {
      "name": "page",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "page token"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-API-Version": {
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "429": {
      "description": "rate limited; try again shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "busy or stale",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  }
 },
 "tags": [
  {
   "name": "swaps"
  },
  {
   "name": "market"
  },
  {
   "name": "track"
  },
  {
   "name": "relay"
  },
  {
   "name": "registry"
  },
  {
   "name": "agent"
  },
  {
   "name": "meta"
  }
 ],
 "components": {
  "schemas": {
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string"
     },
     "secret": {
      "type": "boolean",
      "description": "true when a key-shaped value was refused; it is never echoed"
     }
    }
   },
   "Offer": {
    "type": "object",
    "properties": {
     "offer_id": {
      "type": "string"
     },
     "maker": {
      "type": "string"
     },
     "poa": {
      "type": "number"
     },
     "chain": {
      "type": "string"
     },
     "asset": {
      "type": "string"
     },
     "want": {
      "type": "number"
     },
     "pay_to": {
      "type": "string"
     },
     "expires_ts": {
      "type": "integer"
     },
     "created_ts": {
      "type": "integer",
      "nullable": true
     },
     "status": {
      "type": "string",
      "enum": [
       "open",
       "filled",
       "cancelled",
       "expired",
       "delisted"
      ]
     },
     "taker": {
      "type": "string",
      "nullable": true
     },
     "fill_txid": {
      "type": "string",
      "nullable": true
     },
     "fill_ts": {
      "type": "integer",
      "nullable": true
     },
     "ext_ref": {
      "type": "string",
      "nullable": true
     },
     "cancel_txid": {
      "type": "string",
      "nullable": true
     },
     "cancel_ts": {
      "type": "integer",
      "nullable": true
     },
     "fee_bp": {
      "type": "integer",
      "nullable": true
     },
     "memo": {
      "type": "string",
      "nullable": true
     },
     "last_open_seen": {
      "type": "integer",
      "nullable": true
     },
     "updated": {
      "type": "integer",
      "nullable": true
     },
     "fill_usd": {
      "type": "number",
      "nullable": true
     },
     "timeline": {
      "type": "array",
      "items": {
       "type": "object"
      }
     },
     "maker_chains": {
      "type": "object"
     },
     "taker_chains": {
      "type": "object"
     },
     "fee_poa": {
      "type": "number"
     },
     "fill_atts": {
      "type": "integer"
     },
     "fill_final": {
      "type": "boolean"
     },
     "fill_epoch": {
      "type": "integer",
      "nullable": true,
      "description": "network epoch of the fill; on every filled row, null when unknown"
     }
    }
   },
   "SwapStatus": {
    "type": "object",
    "properties": {
     "available": {
      "type": "boolean"
     },
     "state": {
      "type": "string",
      "enum": [
       "available",
       "coming_soon",
       "upgrading"
      ]
     },
     "message": {
      "type": "string",
      "nullable": true
     },
     "last_good_read": {
      "type": "string",
      "nullable": true
     },
     "last_good_read_age_s": {
      "type": "integer",
      "nullable": true
     },
     "last_attempt": {
      "type": "string",
      "nullable": true
     },
     "last_attempt_status": {
      "type": "string",
      "nullable": true
     },
     "open_offers": {
      "type": "integer"
     },
     "fresh_after_s": {
      "type": "integer"
     },
     "upstream": {
      "type": "string"
     },
     "url": {
      "type": "string"
     },
     "market": {
      "type": "object"
     },
     "names": {
      "type": "object"
     }
    }
   }
  }
 }
}