{
  "openapi": "3.1.0",
  "info": {
    "title": "Bebop Aggregation API",
    "version": "2",
    "description": "Aggregation API powered by solver competition. Get the best swap prices from multiple solvers."
  },
  "servers": [
    {
      "url": "https://api.bebop.xyz/jam/{chain}",
      "variables": {
        "chain": {
          "default": "ethereum",
          "enum": [
            "ethereum",
            "polygon",
            "arbitrum",
            "bsc",
            "zksync",
            "optimism",
            "blast",
            "mode",
            "base",
            "scroll",
            "taiko",
            "superseed",
            "berachain",
            "hyperevm",
            "avalanche"
          ],
          "description": "Blockchain network"
        }
      }
    }
  ],
  "paths": {
    "/v2/quote": {
      "get": {
        "summary": "Quote",
        "description": "Get a solver quote and a ready-to-broadcast settlement transaction. Broadcast tx before expiry.",
        "operationId": "getQuote",
        "parameters": [
          {
            "name": "sell_tokens",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "x-default": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
              "example": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
            },
            "description": "The tokens that will be supplied by the taker"
          },
          {
            "name": "buy_tokens",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "x-default": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
              "example": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
            },
            "description": "The tokens that will be supplied by the maker"
          },
          {
            "name": "sell_amounts",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "x-default": "1000000000",
              "example": "1000000000"
            },
            "description": "The amount of each taker token, order respective to taker_tokens"
          },
          {
            "name": "buy_amounts",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Buy Token Amounts",
              "description": "The amount of each maker token, order respective to maker_tokens"
            },
            "description": "The amount of each maker token, order respective to maker_tokens",
            "examples": {
              "None": {
                "description": "Use when specifying 'sell_amounts'"
              },
              "One": {
                "summary": "One To One / Many To One",
                "description": "Use for 'One To One' or 'One To Many' quotes",
                "value": "100000000"
              },
              "Many": {
                "summary": "One To Many",
                "description": "Use for 'One To Many' quotes",
                "value": "100000000,100000000"
              }
            }
          },
          {
            "name": "taker_address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "x-default": "0x5Bad996643a924De21b6b2875c85C33F3c5bBcB6",
              "example": "0x5Bad996643a924De21b6b2875c85C33F3c5bBcB6"
            },
            "description": "Address that supplies the sell tokens during settlement."
          },
          {
            "name": "receiver_address",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Receiver Address",
              "description": "Address that receives the bought tokens. Defaults to taker_address."
            },
            "description": "Address that receives the bought tokens. Defaults to taker_address."
          },
          {
            "name": "approval_type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ApprovalType",
              "title": "Type of approval",
              "description": "Use Standard approval for direct EVM settlement.",
              "default": "Standard"
            },
            "description": "Use Standard approval for direct EVM settlement."
          },
          {
            "name": "buy_tokens_ratios",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Buy Tokens Ratios",
              "description": "Ratios of maker tokens to receive for each taker token"
            },
            "description": "Ratios of maker tokens to receive for each taker token",
            "examples": {
              "Default": {},
              "One To Many": {
                "summary": "One To Many",
                "description": "Use ONLY with 'One To Many' quotes and specified 'sell_amounts'",
                "value": "0.5,0.5"
              }
            }
          },
          {
            "name": "sell_tokens_ratios",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Sell Tokens Ratios",
              "description": "Ratios of taker tokens to receive for each maker token"
            },
            "description": "Ratios of taker tokens to receive for each maker token",
            "examples": {
              "Default": {},
              "Many To One": {
                "summary": "Many To One",
                "description": "Use ONLY with 'Many To One' quotes and specified 'buy_amounts'",
                "value": "0.5,0.5"
              }
            }
          },
          {
            "name": "slippage",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Slippage",
              "description": "The slippage to use"
            },
            "description": "The slippage to use"
          },
          {
            "name": "origin_address",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Origin Address",
              "description": "Original user of the quote if different than taker."
            },
            "description": "Original user of the quote if different than taker."
          },
          {
            "name": "include_solvers",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Include Solvers",
              "description": "The list of solvers to include"
            },
            "description": "The list of solvers to include",
            "examples": {
              "Default": {},
              "Solvers": {
                "summary": "Solvers",
                "description": "Solvers",
                "value": "solver1,solver2"
              }
            }
          },
          {
            "name": "fee_recipient",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Fee Recipient",
              "description": "The recipient of the fee"
            },
            "description": "The recipient of the fee"
          },
          {
            "name": "fee",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "title": "Partner Fee",
              "description": "Fee (bps) to be charged for this quote",
              "default": 0
            },
            "description": "Fee (bps) to be charged for this quote"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteResponse"
                },
                "examples": {
                  "Default": {
                    "summary": "Sell 1000 USDC for WETH",
                    "value": {
                      "requestId": "971da938-4c62-420b-b6d6-4f234abb25f5",
                      "type": "121",
                      "status": "Success",
                      "quoteId": "12321539-2a28-42cb-9328-b0159f5b15b6",
                      "chainId": 1,
                      "approvalType": "Standard",
                      "nativeToken": "ETH",
                      "taker": "0x5Bad996643a924De21b6b2875c85C33F3c5bBcB6",
                      "receiver": "0x5Bad996643a924De21b6b2875c85C33F3c5bBcB6",
                      "expiry": 1772813548,
                      "slippage": 0.1,
                      "gasFee": {
                        "native": "0",
                        "usd": 0.0
                      },
                      "buyTokens": {
                        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
                          "amount": "507481070765462272",
                          "decimals": 18,
                          "priceUsd": 1980.81,
                          "symbol": "WETH",
                          "minimumAmount": "506973589694696809",
                          "price": 1970.5168480306936,
                          "priceBeforeFee": 1970.5168480306936,
                          "amountBeforeFee": "507481070765462272",
                          "deltaFromExpected": 0.005272838152004709
                        }
                      },
                      "sellTokens": {
                        "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": {
                          "amount": "1000000000",
                          "decimals": 6,
                          "priceUsd": 0.999951,
                          "symbol": "USDC",
                          "price": 0.0005074810707654622,
                          "priceBeforeFee": 0.0005074810707654622
                        }
                      },
                      "settlementAddress": "0xbeb0b0623f66bE8cE162EbDfA2ec543A522F4ea6",
                      "approvalTarget": "0xC5a350853E4e36b73EB0C24aaA4b8816C9A3579a",
                      "priceImpact": 0.005272838152004709,
                      "warnings": [],
                      "tx": {
                        "chainId": 1,
                        "from": "0x5Bad996643a924De21b6b2875c85C33F3c5bBcB6",
                        "to": "0xbeb0b0623f66bE8cE162EbDfA2ec543A522F4ea6",
                        "value": "0x0",
                        "data": "0x2143d82c00...",
                        "gas": 593494
                      },
                      "hooksHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
                      "solver": "\ud83c\udf46"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/competition/{quote_id}": {
      "get": {
        "summary": "Competition",
        "description": "Get the solver competition results for a given quote, including which solvers participated and their offered prices.",
        "operationId": "getCompetition",
        "parameters": [
          {
            "name": "quote_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Quote Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SolverCompetitionResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/chains": {
      "get": {
        "summary": "Supported Chains",
        "operationId": "getChains",
        "description": "Returns a mapping of chain names to chain IDs supported by the Aggregation API.",
        "servers": [
          {
            "url": "https://api.bebop.xyz/jam"
          }
        ],
        "responses": {
          "200": {
            "description": "Mapping of chain names to chain IDs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer"
                  }
                },
                "example": {
                  "ethereum": 1,
                  "polygon": 137,
                  "arbitrum": 42161,
                  "base": 8453,
                  "bsc": 56
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiError": {
        "properties": {
          "errorCode": {
            "type": "integer",
            "title": "Errorcode"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "fee": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MinSizeFee"
              },
              {
                "type": "null"
              }
            ]
          },
          "requestId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Requestid"
          }
        },
        "type": "object",
        "required": [
          "errorCode"
        ],
        "title": "ApiError"
      },
      "ApprovalType": {
        "type": "string",
        "enum": [
          "Standard"
        ],
        "title": "ApprovalType",
        "description": "Approval type for public direct quotes. Use Standard."
      },
      "GasFeeResponse": {
        "properties": {
          "native": {
            "type": "string",
            "title": "Native"
          },
          "usd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usd"
          }
        },
        "type": "object",
        "required": [
          "native"
        ],
        "title": "GasFeeResponse"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "MinSizeFee": {
        "properties": {
          "ether": {
            "type": "number",
            "title": "Ether"
          },
          "usd": {
            "type": "number",
            "title": "Usd"
          }
        },
        "type": "object",
        "required": [
          "ether",
          "usd"
        ],
        "title": "MinSizeFee"
      },
      "PriceWarning": {
        "properties": {
          "code": {
            "type": "integer",
            "title": "Code"
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "title": "PriceWarning"
      },
      "QuoteResponse": {
        "properties": {
          "requestId": {
            "type": "string",
            "title": "Requestid"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "quoteId": {
            "type": "string",
            "title": "Quoteid"
          },
          "chainId": {
            "type": "integer",
            "title": "Chainid"
          },
          "approvalType": {
            "$ref": "#/components/schemas/ApprovalType"
          },
          "nativeToken": {
            "type": "string",
            "title": "Nativetoken"
          },
          "taker": {
            "type": "string",
            "title": "Taker"
          },
          "receiver": {
            "type": "string",
            "title": "Receiver"
          },
          "expiry": {
            "type": "integer",
            "title": "Expiry"
          },
          "slippage": {
            "type": "number",
            "title": "Slippage"
          },
          "gasFee": {
            "$ref": "#/components/schemas/GasFeeResponse",
            "description": "Protocol-reported gas-fee information for the selected route. Direct transaction senders pay their network fee separately."
          },
          "buyTokens": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ResponseBuyToken"
            },
            "type": "object",
            "title": "Buytokens"
          },
          "sellTokens": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ResponseSellToken"
            },
            "type": "object",
            "title": "Selltokens"
          },
          "settlementAddress": {
            "type": "string",
            "title": "Settlementaddress"
          },
          "approvalTarget": {
            "type": "string",
            "title": "Approvaltarget"
          },
          "priceImpact": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Priceimpact"
          },
          "partnerFee": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Partnerfee"
          },
          "protocolFee": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Protocolfee"
          },
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/PriceWarning"
            },
            "type": "array",
            "title": "Warnings",
            "default": []
          },
          "info": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Info"
          },
          "tx": {
            "$ref": "#/components/schemas/TxData"
          },
          "hooksHash": {
            "type": "string",
            "title": "Hookshash"
          },
          "solver": {
            "type": "string",
            "title": "Solver"
          }
        },
        "type": "object",
        "required": [
          "requestId",
          "type",
          "status",
          "quoteId",
          "chainId",
          "approvalType",
          "nativeToken",
          "taker",
          "receiver",
          "expiry",
          "slippage",
          "gasFee",
          "buyTokens",
          "sellTokens",
          "settlementAddress",
          "approvalTarget",
          "hooksHash",
          "solver",
          "tx"
        ],
        "title": "QuoteResponse"
      },
      "ResponseBuyToken": {
        "properties": {
          "amount": {
            "type": "string",
            "title": "Amount"
          },
          "decimals": {
            "type": "integer",
            "title": "Decimals"
          },
          "priceUsd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Priceusd"
          },
          "symbol": {
            "type": "string",
            "title": "Symbol"
          },
          "minimumAmount": {
            "type": "string",
            "title": "Minimumamount"
          },
          "price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "priceBeforeFee": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pricebeforefee"
          },
          "amountBeforeFee": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amountbeforefee"
          },
          "deltaFromExpected": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deltafromexpected"
          }
        },
        "type": "object",
        "required": [
          "amount",
          "decimals",
          "symbol",
          "minimumAmount"
        ],
        "title": "ResponseBuyToken"
      },
      "ResponseSellToken": {
        "properties": {
          "amount": {
            "type": "string",
            "title": "Amount"
          },
          "decimals": {
            "type": "integer",
            "title": "Decimals"
          },
          "priceUsd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Priceusd"
          },
          "symbol": {
            "type": "string",
            "title": "Symbol"
          },
          "price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "priceBeforeFee": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pricebeforefee"
          }
        },
        "type": "object",
        "required": [
          "amount",
          "decimals",
          "symbol"
        ],
        "title": "ResponseSellToken"
      },
      "SolverCompetitionQuote": {
        "properties": {
          "solver": {
            "type": "string",
            "title": "Solver"
          },
          "amounts": {
            "additionalProperties": {
              "$ref": "#/components/schemas/SolverQuoteOutput"
            },
            "type": "object",
            "title": "Amounts"
          },
          "reputation": {
            "type": "integer",
            "title": "Reputation"
          },
          "response_time": {
            "type": "number",
            "title": "Response Time"
          }
        },
        "type": "object",
        "required": [
          "solver",
          "amounts",
          "reputation",
          "response_time"
        ],
        "title": "SolverCompetitionQuote"
      },
      "SolverCompetitionResponse": {
        "properties": {
          "quoteId": {
            "type": "string",
            "title": "Quoteid"
          },
          "solutions": {
            "items": {
              "$ref": "#/components/schemas/SolverCompetitionQuote"
            },
            "type": "array",
            "title": "Solutions"
          }
        },
        "type": "object",
        "required": [
          "quoteId",
          "solutions"
        ],
        "title": "SolverCompetitionResponse"
      },
      "SolverQuoteOutput": {
        "properties": {
          "amount": {
            "type": "string",
            "title": "Amount"
          },
          "amountUsd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amountusd"
          }
        },
        "type": "object",
        "required": [
          "amount",
          "amountUsd"
        ],
        "title": "SolverQuoteOutput"
      },
      "TxData": {
        "properties": {
          "chainId": {
            "type": "integer",
            "title": "Chainid"
          },
          "from": {
            "type": "string",
            "title": "From"
          },
          "to": {
            "type": "string",
            "title": "To"
          },
          "value": {
            "type": "string",
            "title": "Value"
          },
          "data": {
            "type": "string",
            "title": "Data"
          },
          "gas": {
            "type": "integer",
            "title": "Gas"
          },
          "gasPrice": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gasprice"
          }
        },
        "type": "object",
        "title": "TxData",
        "required": [
          "chainId",
          "from",
          "to",
          "value",
          "data",
          "gas"
        ]
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key passed as a Bearer token."
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ]
}