> ## Documentation Index
> Fetch the complete documentation index at: https://staging.docs.aile.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Levels

> For every quoted direction: the largest firm size now, its price after the spread and the reference mid. Indicative; only /quote signs.



## OpenAPI

````yaml openapi.json GET /v1/levels
openapi: 3.1.0
info:
  title: Aile Quote API
  version: v1-2026-11
  description: >-
    Get a price, send one transaction, receive the exact amount.


    **How it works**


    1. `GET /config` gives you the chain, the order protocol address
    (`contracts.lop`) and the tokens with their decimals.

    2. `GET /quote` gives you a price for a pair and an amount. Pass as `taker`
    the address that will send the transaction.

    3. From that address, approve `fill.allowanceTarget` for the token you sell.

    4. Send `fill.to`, `fill.data` and `fill.value` from that address before
    `expiresAt`.

    5. Read the receipt. The transaction delivers exactly `buyAmount` or
    reverts.


    **What a quote is**


    A quote is an order signed by the market maker. It is valid for about 30
    seconds, only the `taker` can use it, and it can be used once. `maxFirmSize`
    is the largest amount you can get right now at this rate, in both tokens.


    **What you can rely on**


    - Fields, routes and enumeration values are only ever added, never removed
    or changed in type.

    - Send `fill.to`, `fill.data` and `fill.value` exactly as returned.

    - `order`, `signature`, `maker` and the other `fill` fields are there for
    your information. Do not hard-code the maker address: it changes.

    - `maker.kind`, `signature.type`, `fill.method` and the problem `reason` can
    gain new values. Treat a `reason` you do not know as "no quote".


    **Access**


    Aile issues your API key. Send it as `Authorization: Bearer <key>` and keep
    it on your backend. `GET /quote` requires it. The other routes work without
    it; with it, their calls count against your own budget and are attributed to
    you instead of sharing the anonymous per-address limit. Over budget you get
    429 `key-rate-limit` with `Retry-After`. Use **Authorize** to try the routes
    on this page; the page forgets the key on reload.


    **Scope**


    Base mainnet, real assets. The pairs come from the market makers' books,
    between the tokens `GET /config` lists; a pair nobody quotes answers 400
    `bad-pair`.
servers:
  - url: https://staging.app.aile.tech/api/base
    description: Base
security: []
tags:
  - name: Service
    description: Discover the chain, the order protocol and the tokens
  - name: Quotes
    description: Receive a signed order and ready calldata
  - name: Orders
    description: Track a fill by its order hash
paths:
  /v1/levels:
    get:
      tags:
        - Quotes
      summary: 'Levels: the largest size and its price, before a quote'
      description: >-
        For every direction the market makers quote: `maxFirmSize`, the largest
        quote you can get now, in both tokens (the price after the spread is
        `buyAmount / sellAmount`), a `ladder` of one rung at that size, and the
        `reference` mid it is priced from. Use it to show a price before asking
        `GET /quote`, or to choose a size. A direction that cannot be quoted now
        reads `firmQuoted: false` with the `reason` a quote of it would get;
        treat a `reason` you do not know as no quote. `pair=BASE/QUOTE` narrows
        the answer to one pair, in either order (400 `bad-pair` for a token this
        network does not offer). Levels are indicative: only `GET /quote` signs.
        No key is needed; the calls share a limit per address (429
        `rate-limited` with `Retry-After`), and the answer may be cached for a
        few seconds.
      operationId: getLevels
      parameters:
        - schema:
            type: string
          in: query
          name: pair
          required: false
          description: >-
            Only the two directions of one pair: `BASE/QUOTE`, symbols of this
            network in either order, case-insensitive. 400 `bad-pair` for a
            symbol the network does not offer.
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Levels'
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - {}
        - apiKey: []
components:
  schemas:
    Levels:
      type: object
      properties:
        indicative:
          type: boolean
          const: true
          description: >-
            Always true: a level is a price before a quote, not a commitment.
            Only `GET /quote` signs.
        readAt:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Unix second the maker computed these levels; null before the first
            reading, with `levels` empty.
        levels:
          type: array
          items:
            type: object
            properties:
              sellToken:
                type: string
                description: Symbol of the token the taker pays.
              buyToken:
                type: string
                description: Symbol of the token the taker receives.
              firmQuoted:
                type: boolean
                description: Whether `GET /quote` would answer this direction now.
              makers:
                type: integer
                description: 'Makers quoting this direction now: 1 or 0.'
              maxFirmSize:
                type: object
                properties:
                  sellAmount:
                    type: string
                    description: Base units of the token the taker pays.
                  buyAmount:
                    type: string
                    description: Base units of the token the taker receives.
                required:
                  - sellAmount
                  - buyAmount
                additionalProperties: true
                description: >-
                  The largest quote now, in both tokens. The price after the
                  spread is buyAmount / sellAmount. Zero when not quoted.
              ladder:
                type: array
                items:
                  type: object
                  properties:
                    sellAmount:
                      type: string
                      description: Base units of the token the taker pays.
                    buyAmount:
                      type: string
                      description: Base units of the token the taker receives.
                  required:
                    - sellAmount
                    - buyAmount
                  additionalProperties: true
                description: >-
                  Sizes and their amounts. One rung at maxFirmSize while the
                  price does not depend on the size; empty when not quoted.
              reference:
                anyOf:
                  - type: object
                    properties:
                      rate:
                        type: string
                        description: >-
                          Mid rate the maker prices from, in human units, as the
                          quote's referenceRate.
                      source:
                        type: string
                        description: >-
                          Where the mid comes from: `chainlink` or `api`. Open:
                          new values may be added.
                      at:
                        type: integer
                        description: Unix second of the mid.
                    required:
                      - rate
                      - source
                      - at
                    additionalProperties: true
                  - type: 'null'
                description: The mid, or null when none could be read.
              reason:
                anyOf:
                  - type: string
                  - type: 'null'
                description: >-
                  Why the direction is not quoted, as a quote of it would be
                  refused (`kill-switch`, `screening-unavailable`,
                  `maker-unavailable`, `no-price`, `no-maker`,
                  `maker-underfunded`, `maker-allowance`, `over-size`); null
                  when quoted. Open: new values may be added.
            required:
              - sellToken
              - buyToken
              - firmQuoted
              - makers
              - maxFirmSize
              - ladder
              - reference
              - reason
            additionalProperties: true
          description: One entry per direction of every pair quoted, or of `pair` alone.
      required:
        - indicative
        - readAt
        - levels
      additionalProperties: true
      description: >-
        Indicative levels per direction: the largest firm size now and its
        price, before asking for a quote.
    Problem:
      type: object
      properties:
        type:
          type: string
          description: >-
            Problem type identifier; about:blank unless a machine-readable
            problem type is defined.
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
        reason:
          description: Machine-readable cause, where the route defines one
          type: string
      required:
        - type
        - title
        - status
      additionalProperties: true
      description: RFC 7807 problem details
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        API key issued by Aile. Authorization: Bearer <key>. Required for
        quotes. Optional on the other routes: without it they share the
        anonymous per-address limit, with it the calls are attributed to you and
        charged to your own budget.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.