31Third.
  • 👋Introduction
    • About 31Third
    • Use cases
    • 0x Labs Collaboration
    • Architecture
    • Team
  • 🤝31Third API
    • Overview
    • Healthcheck
    • Assets
      • Wallet
      • Enzyme
    • Swap
      • Get started
      • price
      • quote
    • Basket Trade (m:n swap)
      • async
      • Wallet
      • Enzyme
      • SetProtocol
    • Refresh Quotes
    • RFQ
  • ⛓️Protocol
    • Overview
    • Contracts
      • BatchTrade
      • Owner Privilege
    • Prohibition
    • Audit
    • Statistics
      • Gas cost analysis
    • Fees
  • 📚Resources
    • FAQ
    • Start trading
    • Discord
    • Twitter
Powered by GitBook
On this page
  1. 31Third API
  2. Swap

price

PreviousGet startedNextquote

Last updated 22 days ago

API reference to fetch an indicative price for a swap.

🤝

Get indicative price for a swap

get
Query parameters
sellTokenstringRequired

Address of the sell token

Example: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
buyTokenstringRequired

Address of the buy token

Example: 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599
sellAmountstringRequired

Sell amount in token base units (e.g. Wei for ETH)

Example: 1000000000000
Header parameters
x-api-keystringOptional

31Third API key (Request via dev@31third.com)

chain-idstringOptional

Chain ID as hex string. (e.g.: 0x1 for Ethereum mainnet)

Responses
200Success
application/json
get
GET /0.1/swap/price?sellToken=text&buyToken=text&sellAmount=text HTTP/1.1
Host: 
Accept: */*
200Success
{
  "id": "0096124c-19df-4459-8cbb-7615fdc7c157",
  "sellToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "buyToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "sellAmount": "100000000",
  "buyAmount": "99500000",
  "price": 0.999955,
  "priceImpactBps": 31
}