Methods

This page provides a comprehensive overview of all available Aori API methods. Each method is documented with its required parameters, example requests, and expected responses. These endpoints allow you to interact with the Aori protocol for creating RFQs, responding to quotes, managing orders, and subscribing to real-time updates.

Actions


aori_rfq

POSThttps://api.aori.io

This endpoint allows you to create a Request for Quote (RFQ) for a token swap. Market makers can respond to your RFQ with competitive quotes.

Required attributes

  • Name
    inputToken
    Type
    string
    Description

    The token you want to sell.

  • Name
    outputToken
    Type
    string
    Description

    The token you want to buy.

  • Name
    inputAmount
    Type
    string
    Description

    The amount of input token.

  • Name
    chainId
    Type
    number
    Description

    The chain ID for the trade.

Request

POST
https://api.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'https://api.aori.io',
  'aori_rfq',
  [{
    address: "0x123...",
    inputToken: "0x456...", 
    outputToken: "0x789...",
    inputAmount: "1000000000000000000",
    chainId: 1
  }]
)

Response

{
  "status": "Ok",
  "data": {
    "rfqId": "0x123...",
    "event": "QuoteRequested",
    "data": {
      "orderType": "rfq",
      "takerOrder": {
        // <AoriOrder>
      }
    },
    "timestamp": 1234567890
  }
}

aori_respond

POSThttps://api.aori.io

This endpoint allows market makers to respond to an RFQ with a quote.

Required attributes

  • Name
    rfqId
    Type
    string
    Description

    The ID of the RFQ to respond to.

  • Name
    order
    Type
    Order
    Description

    The order details for the quote.

  • Name
    signature
    Type
    string
    Description

    The signed order.

Request

POST
https://api.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'https://api.aori.io',
  'aori_respond',
  [{
    rfqId: "0x123...",
    order: {
      // <AoriOrder> 
    },
    signature: "0xabc..."
  }]
)

Response

{
  "status": "Ok"
}

aori_make

POSThttps://api.aori.io

This endpoint allows you to create a limit order that will be matched against incoming RFQs.

Required attributes

  • Name
    order
    Type
    Order
    Description

    The order details.

  • Name
    signature
    Type
    string
    Description

    The signed order.

Optional attributes

  • Name
    feeInBips
    Type
    number
    Description

    The fee in basis points (1 bip = 0.01%).

  • Name
    isPrivate
    Type
    boolean
    Description

    Whether the order is private.

Request

POST
https://api.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'https://api.aori.io',
  'aori_make',
  [{
    order: {
      // <AoriOrder> 
    },
    signature: "0xabc...",
    feeInBips: 10,
    isPrivate: false
  }]
)

Response

{
  "status": "Ok",
  "data": {
    "tradeId": "aori-123...",
    "event": "QuoteRequested",
    "data": {
      "orderType": "limit",
      "makerOrder": {
        // <AoriOrder>
      }
    },
    "timestamp": 1234567890
  }
}

aori_cancel

POSThttps://api.aori.io

This endpoint allows you to cancel an existing RFQ or limit order. The cancellation must be signed by the original order creator.

Required attributes

  • Name
    tradeId
    Type
    string
    Description

    The ID of the trade/order to cancel.

  • Name
    signature
    Type
    string
    Description

    A signature of the tradeId signed by the order creator's private key.

Request

POST
https://api.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall("wss://api.aori.io", "aori_cancel", [{
  tradeId: "0x123...",
  signature: "0x456..." 
}])

Response

{
  "status": "Ok",
  "data": {
    "tradeId": "0x123...",
    "event": "OrderCancelled",
    "data": {
      "orderType": "rfq",
      "takerOrder": {
        // Original <AoriOrder>
      }
    },
    "timestamp": 1234567890
  }
}

Error Response

{
  "status": "Error",
  "message": "RFQ not found" // Or "Trade already matched" or "Invalid signature"
}

aori_fail

POSThttps://api.aori.io

This endpoint allows you to mark a matched trade as failed. The failure must be signed by the original order creator.

Required attributes

  • Name
    tradeId
    Type
    string
    Description

    The ID of the matched trade to mark as failed.

  • Name
    signature
    Type
    string
    Description

    A signature of the original order, signed by the order creator's private key.

Request

POST
https://api.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'https://api.aori.io',
  'aori_fail',
  [{
    tradeId: "0x123...",
    signature: "0x456..." // signature of original <AoriOrder>
  }]
)

Response

{
  "status": "Ok",
  "data": {
    "tradeId": "0x123...",
    "event": "OrderFailed",
    "data": {
      "orderType": "rfq",
      "takerOrder": {
        // Original <AoriOrder>
      }
    },
    "timestamp": 1234567890
  }
}

Error Response

{
  "status": "Error",
  "message": "RFQ not found" // Or "Trade not already matched" or "Invalid signature"
}

Querying Data


aori_priceQuote

POSThttps://quoter.aori.io

This endpoint allows you to get a price quote for a token swap across multiple DEX aggregators. The quote includes the best available rate after accounting for gas costs and protocol fees.

Required attributes

  • Name
    inputToken
    Type
    string
    Description

    The token you want to sell.

  • Name
    outputToken
    Type
    string
    Description

    The token you want to buy.

  • Name
    inputAmount
    Type
    string
    Description

    The amount of input token.

  • Name
    chainId
    Type
    number
    Description

    The chain ID for the trade.

Request

POST
https://quoter.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'https://quoter.aori.io',
  'aori_priceQuote',
  [{
    inputToken: "0x123...",
    outputToken: "0x456...",
    inputAmount: "1000000000000000000",
    chainId: 1
  }]
)

Response

{
  "status": "Ok",
  "data": {
    "outputAmount": "2000000000000000000",
    "route": [
      // Route details
    ]
  }
}

aori_queryOrders

POSThttps://data.aori.io

This endpoint allows you to query active limit orders based on various filters.

Optional filter parameters

  • Name
    chainId
    Type
    number
    Description

    Filter by chain ID.

  • Name
    inputToken
    Type
    string
    Description

    Filter by input token.

  • Name
    outputToken
    Type
    string
    Description

    Filter by output token.

  • Name
    isActive
    Type
    boolean
    Description

    Filter by order status.

  • Name
    sortBy
    Type
    string
    Description

    Sort orders by specified criteria.

Request

POST
https://data.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'https://api.aori.io',
  'aori_queryOrders',
  [{
    chainId: 1,
    inputToken: "0x123...",
    outputToken: "0x456...",
    isActive: true,
    sortBy: "rate_desc"
  }]
)

Response

{
  "status": "Ok",
  "data": "deprecated"
}

Subscription


aori_subscribe

WebSocketwss://api.aori.io

This endpoint allows you to subscribe to real-time order and trade events via WebSocket connection. You can filter the events based on various parameters to receive only relevant updates.

Optional filter parameters

  • Name
    tradeId
    Type
    string
    Description

    Subscribe to events for a specific trade.

  • Name
    orderType
    Type
    string
    Description

    Filter events by order type ('rfq' or 'limit').

  • Name
    address
    Type
    string
    Description

    Subscribe only to events related to a specified address.

  • Name
    token
    Type
    string | string[]
    Description

    Subscribe to events for specific tokens:

    • Single token address for all events involving that token
    • Array of two token addresses for specific base/quote pair events
  • Name
    chainId
    Type
    number
    Description

    Subscribe to all events on a specific chain.

Request

WebSocket
wss://api.aori.io
import { rawCall } from '@aori-io/sdk'

await rawCall(
  'wss://api.aori.io',
  'aori_subscribe',
  [{
    tradeId: "0x123...",
    orderType: "limit",
    address: "0x456...",
    token: ["0x789...", "0xabc..."],
    chainId: 1
  }]
)

Subscription Message

{
  "rfqId": "0x123...",
  "type": "QuoteRequested",
  "data": {
    "orderType": "limit",
    "makerOrder": {
      // Order details
    }
  }
}