Getting Started
This guide will get you all set up and ready to use the Aori API. We'll cover how to get started using one of our SDK's and how to make your first API request. We'll also look at where to go next to find all the information you need to take full advantage of our powerful API.
Interacting with the Aori API does not currently require an API key, although it is recommended you visit the Aori Developer Portal to receive an integrator ID to be provided tracking and analytics on your integration.
Understanding the Endpoints
Main Api | |
---|---|
https://api.aori.io | HTTP API to be able to send RFQs statelessly, typically from end users. |
wss://api.aori.io | WebSocket API for market makers and solvers that want lower latency. |
Quoter Api | |
https://quoter.aori.io | Dedicated API for receiveing price estimates. |
Data Api | |
https://data.aori.io | Dedicated API for retreiving historical activity data. |
Choose your Client
Before making your first API request, you need to pick which API client you will use.
# Install the TypeScript SDK
npm install @aori-io/sdk --save
Formatting Requests
Payloads to the HTTP or Websocket API's follow the JSON-RPC 2.0 specification.
JSON-RPC Request Template
{
"id": 1,
"jsonrpc": "2.0",
"method": "aori_...",
"params": [{ ... }]
}
Making your first API request
After picking your preferred client, you are ready to make your first call to Aori. As an example, let's request a price quote to the quoter API for 1 ETH.
import rawCall from '@aori-io/sdk'
const priceQuote = await rawCall(
'https://quoter.aori.io',
'aori_priceQuote',
[{
"inputToken": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
"outputToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"inputAmount": "1000000000000000",
"chainId": 42161
}]
);
Response
{
"id": 1,
"result": {
"inputToken": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
"outputToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"inputAmount": "1000000000000000",
"chainId": 42161,
"outputAmount": "..." //respones now includes quoted outputAmount
}
}
What's next?
Great, now you're set up with an API client and have made your first request. Now let's dive deeper into the Aori API: