API Enablement

How Long Does It Take to Integrate the API?

Integration of the API can be done in less than two weeks. We provide sample code to help get you off the ground quickly. To get started, reach out to request an API key. If you are not yet in touch with Uniswap Labs, register your interest in integrating the API here: https://hub.uniswap.org/.

Do You Have OAS Documentation?

Yes. OAS documentation is available here. We recommend using the OpenAPI generator CLI to build a typed client.

How Does Authentication Work?

All endpoints require an API key to be accessed, which needs to be provided in the header of each request as illustrated in the example below:

curl --request GET \
     --header 'accept: application/json' \
     --header 'x-api-key: <YOUR_API_KEY>'

What Are the API Rate Limits?

By default each API key is rate limited to 12 requests per second. If a higher rate is needed, please reach out to your Uniswap Labs contact.

What Permit2 Address Do I Need to Whitelist for Approvals?

The Permit2 address for all chains we support EXCEPT zkSync is: 0x000000000022D473030F116dDEE9F6B43aC78BA3.

The zkSync’s Permit2 address is: 0x0000000000225e31D15943971F47aD3022F714Fa.

Quotes and Quoting

What Parameter Determines If I Receive a Gasless Quote?

When the /quote endpoint’s routingPreference is set to BEST_PRICE, the endpoint will attempt to find a quote that nets users the best execution price for a trade. Assuming the protocols are not limited, the endpoint will attempt to get a gasless order and a Uniswap Protocol swap quote, calculate which is currently providing the best price to the user including transaction costs, and return that quote.

Integrators of the API who only want gasless quotes may limit the protocols considered to just gasless options (e.g. UniswapX - see Swap Routing for more details).

There are some scenarios where the API will not be able to get a gasless quote, even if the integrator attempts to force it. The most common reason for this is that the gas price of the swap is too high relative to the value of the trade. In cases where gas cost is 20% or more of the total trade value, the API will always return Uniswap Protocol swap quotes (if permitted by protocols) or fail.

How Often Are Quotes Refreshed?

Whenever you request a quote from the APIs, a new check is performed to get the freshest pricing.

How Do You Recommend Setting Slippage?

We recommend using our automatic slippage option in the /quote request. However, you may use your own slippage algorithm and directly populate your preferred slippage in the /quote request.

How Should I Handle Failed Quotes?

If a quote fails, the response includes helpful information to understand the problem with the request. The most common quote failure reason is that no route can be found for the quoted pair. This can be for a variety of reasons including that all available routes would exceed the slippage, that there is not enough liquidity for the requested quote size, or that there is no route through the set of protocols specified. We recommend retrying the quote but modifying one or more parameters of the requested quote (ex. protocols used, slippage allowed, or the size of the swap).

Swapping

How Can I Simulate a Swap Before Submitting It?

Whenever you request a quote from our endpoints we will automatically simulate the quote to ensure that the result will be a viable route should you decide to proceed to the swap step. Further, when you make a request to the /swap endpoint, you may request for the calldata that we generate to be simulated to further ensure that the calldata is valid and will be processed. (Note that simulation is not a guarantee that a swap will be successful on chain as factors including gas and slippage may change between the time of the /swap response and you placing the transaction on chain).

Reference Data

Can I Query All Tokens Available to Trade?

No, at this time we do not offer an endpoint to query all tokens which are tradable. For more information on tradable tokens, see our guide on Supported Chains and Tokens.

Mechanics of UniswapX

Why Do UniswapX Quotes Have More Slippage Than the Tolerance I Set?

Quotes in UniswapX work differently than they do in the Uniswap AMMs. While AMM quotes return the market price with some buffer for slippage, UniswapX works to get users price improvement over the market price. The difference between the best and worst price in a UniswapX order is called its spread.

When you set a Slippage Tolerance in your quote request, you’re only setting the amount below the market price you are willing to accept. UniswapX will still return a spread larger than your slippage tolerance when it’s able to find a price above the market price.

What is a Priority Quote?

UniswapX supports multiple auction types that take advantage of different properties of different chains. When you request a UniswapX quote, depending on the chain, the API will return the following quote/auction:

  • Mainnet: DutchV2
  • Arbitrum: DutchV3
  • Unichain and Base: Priority In other words, a Priority quote is specific UniswapX auction type. Uniswap will notify you of the auction type being used in the quote response.

Commercial

Are There Restrictions On How I Can Integrate the API?

We are very flexible with regards to how you decide to offer the API through your application. Customers may create a whitelabel swap experience, add swapping to a custodial wallet, integrate the APIs into a mobile application, and more. The one restriction at this time is that under no circumstances do we allow you to reoffer the API substantially unchanged (e.g. pass through our API to your end customers).

Can I Restrict Token Pairs Available to My Users?

The APIs do not offer a way to restrict which tokens may be requested to the API, but your application may apply rules to restrict the list of tokens which your end users can access.

Can I Trial the API?

We do offer trial arrangements through our Beta endpoints (e.g. for non-production traffic). Please reach out to your account manager to arrange a trial.

Fees

Is There A Cost to Use the API?

Yes, API integration is offered under contract agreement which will outline the fees. API integration licenses are offered under volume-based or per-swap fee agreements.

How Can I Set My Own Fees?

API integrators may request to have their own fees automatically added to calldata transactions by reaching out to Uniswap Labs. Fees can be set on a per-API key basis and apply to all swaps except for those prohibited for fee collection by Uniswap Labs. Uniswap Labs does not permit fee collection on swaps where both sides are tied to the same underlying asset and the asset is tied to the price of USD, ETH, EUR, or BTC.

Does Uniswap Take Positive Slippage as Fees?

No. Uniswap Labs never takes positive slippage. All price improvement achieved at execution is for the benefit of the end swapper.

Support

Who Do I Contact for Technical Support?

If you require technical support, please reach out to your account manager, your technical account manager, or submit your request to our helpdesk. Note that our helpdesk does not take requests for API enablement and those should be submitted through https://hub.uniswap.org/. Further note that we are unable to provide technical assistance with troubleshooting your code, deployment, or workflow.

Is There A Sandbox Environment?

Yes, we provide a Beta environment for testing. If you would like access to the Beta environment, reach out to your account manager for a Beta API key.

Do You Offer Any Customer Dashboards, Metrics, Monitoring, or Usage?

At this time we do not provide any customer dashboards, metrics, monitoring, or usage reports. However, we hope to bring these to you soon as we continue to improve our API service offerings.