{
  "openapi": "3.1.0",
  "info": {
    "title": "Gibs Finance quote service",
    "version": "1.21.0",
    "summary": "Display quotes from LI.FI, Relay and NEAR Intents, through one cached HTTP API.",
    "description": "The quote service asks bridge aggregators for quotes, caches the answers and shares them between callers. The code is `@gibs/quote-service`. The wire contract of its main route is `@gibs/quotes`.\n\n## What a display quote is\n\nA display quote shows what to expect. It is never the transaction to sign. To execute a route, use `searchBridgeRoutes` and `planCandidateExecution` from the SDK, with your own provider keys or with none.\n\n## Origins\n\nEvery route except `/healthz` and `/readyz` checks the `Origin` header against an allow list. The public host `quotes.gibs.finance` answers display quotes for any caller, including a native app that sends no `Origin`. The forwarding routes (`/lifi/`, `/relay/`, `/near-intents/`) accept only the Gibs Finance sites, and answer 403 to every other origin.\n\nAn allowed answer carries `Access-Control-Allow-Origin`: `*` for an open list, or the asking origin with `Vary: Origin`. The service never sends `Access-Control-Allow-Credentials`. A preflight `OPTIONS` request gets 204 with `Access-Control-Allow-Methods: GET, POST, OPTIONS`, `Access-Control-Allow-Headers: Content-Type` and `Access-Control-Max-Age: 600`.\n\n## Limits\n\n- Display quotes: 60 requests a minute for each client, in bursts of up to 20.\n- Display quotes in flight: 4 for each client and 32 in total, by default. The operator can change both.\n- Forwarding routes: 20 requests a minute for each client.\n- A request body can hold 16 KB. It must arrive within 10 seconds.\n- A header block can hold 16 KB and 100 headers.\n\nA refusal for a limit carries a `Retry-After` header, in seconds.\n\n## Errors\n\nEvery error the service writes itself is a JSON object with an `error` string. A forwarding route passes the provider's own status and body through unchanged.",
    "license": {
      "name": "ISC",
      "identifier": "ISC"
    }
  },
  "servers": [
    {
      "url": "https://quotes.gibs.finance",
      "description": "The public Gibs Finance quote service"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Display quotes",
      "description": "Cached quotes to show a reader. Never signed."
    },
    {
      "name": "Service",
      "description": "What the service is, and whether it is up."
    },
    {
      "name": "Forwarding",
      "description": "Uncached calls to one provider, with the server's own key. Each call counts against one shared provider budget. The service builds each outbound request from a fixed table. It never copies a header of yours onto it. It returns only the provider's body, `Content-Type` and `Retry-After`. Only the Gibs Finance sites can call these routes."
    }
  ],
  "paths": {
    "/v1/display-quotes": {
      "post": {
        "tags": [
          "Display quotes"
        ],
        "operationId": "displayQuotes",
        "summary": "Get display quotes",
        "description": "Asks every eligible provider what it expects to deliver, for 1 to 24 asks at once. The answers come back in the order of the asks. Each answer holds one slot for each provider that was asked.\n\nA slot is `quoted`, `refused` or `pending`. A `quoted` slot with `basis: \"scaled-from-nearby-amount\"` is an estimate, scaled from the cached answer for a nearby amount. Ask with `precision: \"exact\"` when you need the answer for your own amount. A `pending` slot means the provider call is still in flight: ask again after `retryAfterMs`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisplayQuoteRequest"
              },
              "example": {
                "asks": [
                  {
                    "from": {
                      "chainId": 1,
                      "token": "0x0000000000000000000000000000000000000000"
                    },
                    "to": {
                      "chainId": 8453,
                      "token": "0x0000000000000000000000000000000000000000"
                    },
                    "amount": "100000000000000000"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One answer for each ask, in ask order.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "$ref": "#/components/headers/AllowOrigin"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisplayQuoteResponse"
                },
                "example": {
                  "answers": [
                    {
                      "providers": {
                        "lifi": {
                          "status": "quoted",
                          "askedAmount": "100000000000000000",
                          "quotedAt": "2026-10-17T09:00:00.000Z",
                          "ageMs": 1200,
                          "cache": "hit",
                          "basis": "exact",
                          "expectedAmount": "99512000000000000",
                          "minimumAmount": "99014000000000000"
                        },
                        "relay": {
                          "status": "pending",
                          "retryAfterMs": 800
                        },
                        "near-intents": {
                          "status": "refused",
                          "kind": "no-quote",
                          "reason": null
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The body is empty, is not JSON, breaks the schema, or did not fully arrive. The `error` names every schema problem, such as `asks.0.amount: must be a decimal, non-negative base-units amount`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "408": {
            "$ref": "#/components/responses/BodyTimeout"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "429": {
            "description": "The client spent its rate limit (`rate limit exceeded`), or already has its share of requests in flight (`too many requests in flight`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "description": "The answer could not be built (`display-quotes upstream failure`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The service has every display slot in use (`service busy`). A slot frees in moments.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/info": {
      "get": {
        "tags": [
          "Service"
        ],
        "operationId": "info",
        "summary": "Describe the service",
        "description": "Tells you which service you reach and which providers it asks. The `contract` number changes only when a field is removed or changes meaning. A new field does not change it, so ignore fields you do not know.",
        "responses": {
          "200": {
            "description": "The service description.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Info"
                },
                "example": {
                  "service": "quote-service",
                  "contract": 1,
                  "providers": [
                    "lifi",
                    "relay",
                    "near-intents"
                  ],
                  "version": "1.21.0"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "tags": [
          "Service"
        ],
        "operationId": "healthz",
        "summary": "Is the process up",
        "description": "Always 200 while the process answers. No `Origin` check applies.",
        "responses": {
          "200": {
            "description": "The process is up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "const": "ok"
                    }
                  }
                },
                "example": {
                  "status": "ok"
                }
              }
            }
          }
        }
      }
    },
    "/readyz": {
      "get": {
        "tags": [
          "Service"
        ],
        "operationId": "readyz",
        "summary": "Is the service ready",
        "description": "200 when the service is ready for real traffic, 503 when it is not. No `Origin` check applies.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Readiness"
          },
          "503": {
            "$ref": "#/components/responses/Readiness"
          }
        }
      }
    },
    "/lifi/v1/quote": {
      "get": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "lifiQuote",
        "summary": "LI.FI quote",
        "description": "Forwards your query string to LI.FI's `GET /v1/quote`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ForwardedQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/lifi/v1/quote/contractCalls": {
      "post": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "lifiContractCallsQuote",
        "summary": "LI.FI contract calls quote",
        "description": "Forwards your body to LI.FI's `POST /v1/quote/contractCalls`.",
        "requestBody": {
          "$ref": "#/components/requestBodies/ForwardedBody"
        },
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "400": {
            "description": "The body did not fully arrive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "$ref": "#/components/responses/BodyTimeout"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/lifi/v1/chains": {
      "get": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "lifiChains",
        "summary": "LI.FI chains",
        "description": "Forwards your query string to LI.FI's `GET /v1/chains`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ForwardedQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/lifi/v1/tokens": {
      "get": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "lifiTokens",
        "summary": "LI.FI tokens",
        "description": "Forwards your query string to LI.FI's `GET /v1/tokens`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ForwardedQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/lifi/v1/status": {
      "get": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "lifiStatus",
        "summary": "LI.FI transfer status",
        "description": "Forwards your query string to LI.FI's `GET /v1/status`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ForwardedQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/relay/quote/v2": {
      "post": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "relayQuote",
        "summary": "Relay quote",
        "description": "Forwards your body to Relay's `POST /quote/v2`. The query string is dropped.",
        "requestBody": {
          "$ref": "#/components/requestBodies/ForwardedBody"
        },
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "400": {
            "description": "The body did not fully arrive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "$ref": "#/components/responses/BodyTimeout"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/near-intents/v0/quote": {
      "post": {
        "tags": [
          "Forwarding"
        ],
        "operationId": "nearIntentsQuote",
        "summary": "NEAR Intents quote",
        "description": "Forwards your body to NEAR Intents' `POST /v0/quote`. The query string is dropped.",
        "requestBody": {
          "$ref": "#/components/requestBodies/ForwardedBody"
        },
        "responses": {
          "200": {
            "description": "The provider answered. Its status, body and `Content-Type` come back unchanged, so any provider status can appear here. A provider `Retry-After` header comes back too.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The provider body."
                }
              }
            }
          },
          "400": {
            "description": "The body did not fully arrive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/OriginNotAllowed"
          },
          "404": {
            "description": "No forwarding route has this path (`no such forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The route does not take this method (`method not allowed for this forwarding route`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "$ref": "#/components/responses/BodyTimeout"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "429": {
            "description": "The client spent its limit of 20 a minute (`rate limit exceeded`, an `Error`), or the shared provider budget is spent and nothing was sent (`upstream budget exhausted`, a `BudgetError`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/BudgetError"
                    }
                  ]
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached, or a guard refused the call before it left (`upstream unreachable`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BaseUnitsAmount": {
        "type": "string",
        "pattern": "^\\d+$",
        "description": "An amount in the token's base units, as a decimal string. No sign, no decimal point, no `0x`.",
        "examples": [
          "100000000000000000"
        ]
      },
      "AssetRef": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "chainId",
          "token"
        ],
        "properties": {
          "chainId": {
            "type": "integer",
            "minimum": 1,
            "description": "The chain id, such as 1 for Ethereum."
          },
          "token": {
            "type": "string",
            "minLength": 1,
            "description": "The token address, in the form the chain uses."
          }
        }
      },
      "ProviderId": {
        "type": "string",
        "enum": [
          "lifi",
          "relay",
          "near-intents"
        ]
      },
      "DisplayAsk": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from",
          "to",
          "amount"
        ],
        "properties": {
          "from": {
            "$ref": "#/components/schemas/AssetRef"
          },
          "to": {
            "$ref": "#/components/schemas/AssetRef"
          },
          "amount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          },
          "recipientEcosystem": {
            "type": "string",
            "enum": [
              "evm",
              "svm",
              "bvm",
              "tvm",
              "tonvm",
              "hypevm",
              "zcash"
            ],
            "description": "The family of chains the recipient address belongs to. When you leave it out, the service uses the family of `to.chainId`."
          },
          "providers": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ProviderId"
            },
            "description": "The providers to ask. When you leave it out, the service asks every provider eligible for the pair."
          },
          "precision": {
            "type": "string",
            "enum": [
              "estimate-ok",
              "exact"
            ],
            "default": "estimate-ok",
            "description": "With `exact`, the service never answers with a figure scaled from a nearby amount."
          }
        }
      },
      "DisplayQuoteRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "asks"
        ],
        "properties": {
          "asks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 24,
            "items": {
              "$ref": "#/components/schemas/DisplayAsk"
            }
          }
        }
      },
      "CacheState": {
        "type": "string",
        "enum": [
          "miss",
          "hit",
          "joined"
        ],
        "description": "`miss`: this request asked the provider. `hit`: the answer came from the cache. `joined`: the answer came from a call another request started."
      },
      "ExactQuotedSlot": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "askedAmount",
          "quotedAt",
          "ageMs",
          "cache",
          "basis",
          "expectedAmount"
        ],
        "properties": {
          "status": {
            "const": "quoted"
          },
          "askedAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          },
          "quotedAt": {
            "type": "string",
            "description": "When the provider answered, in ISO 8601."
          },
          "ageMs": {
            "type": "number",
            "minimum": 0,
            "description": "Milliseconds since `quotedAt`."
          },
          "cache": {
            "$ref": "#/components/schemas/CacheState"
          },
          "basis": {
            "const": "exact"
          },
          "expectedAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          },
          "minimumAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          }
        }
      },
      "ScaledQuotedSlot": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "askedAmount",
          "quotedAt",
          "ageMs",
          "cache",
          "basis",
          "expectedAmount",
          "scaledFrom"
        ],
        "description": "An estimate, scaled from the answer for a nearby amount. Never present it as the exact quote.",
        "properties": {
          "status": {
            "const": "quoted"
          },
          "askedAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          },
          "quotedAt": {
            "type": "string"
          },
          "ageMs": {
            "type": "number",
            "minimum": 0
          },
          "cache": {
            "$ref": "#/components/schemas/CacheState"
          },
          "basis": {
            "const": "scaled-from-nearby-amount"
          },
          "expectedAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          },
          "minimumAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          },
          "scaledFrom": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "askedAmount",
              "expectedAmount"
            ],
            "description": "The nearby amount the provider was asked, and its own answer.",
            "properties": {
              "askedAmount": {
                "$ref": "#/components/schemas/BaseUnitsAmount"
              },
              "expectedAmount": {
                "$ref": "#/components/schemas/BaseUnitsAmount"
              }
            }
          }
        }
      },
      "RefusedSlot": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "kind",
          "reason"
        ],
        "properties": {
          "status": {
            "const": "refused"
          },
          "kind": {
            "type": "string",
            "enum": [
              "no-quote",
              "could-not-ask",
              "cannot-carry",
              "invalid-api-key"
            ],
            "description": "`no-quote`: the provider declined. `could-not-ask`: the service could not ask it. `cannot-carry`: the provider does not serve this pair. `invalid-api-key`: the provider refused the key."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "minimumAmount": {
            "$ref": "#/components/schemas/BaseUnitsAmount"
          }
        }
      },
      "PendingSlot": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "retryAfterMs"
        ],
        "properties": {
          "status": {
            "const": "pending"
          },
          "retryAfterMs": {
            "type": "number",
            "minimum": 0,
            "description": "Ask again after this many milliseconds."
          }
        }
      },
      "ProviderSlot": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ExactQuotedSlot"
          },
          {
            "$ref": "#/components/schemas/ScaledQuotedSlot"
          },
          {
            "$ref": "#/components/schemas/RefusedSlot"
          },
          {
            "$ref": "#/components/schemas/PendingSlot"
          }
        ]
      },
      "DisplayAnswer": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "providers"
        ],
        "properties": {
          "providers": {
            "type": "object",
            "additionalProperties": false,
            "description": "One slot for each provider that was asked.",
            "properties": {
              "lifi": {
                "$ref": "#/components/schemas/ProviderSlot"
              },
              "relay": {
                "$ref": "#/components/schemas/ProviderSlot"
              },
              "near-intents": {
                "$ref": "#/components/schemas/ProviderSlot"
              }
            }
          }
        }
      },
      "DisplayQuoteResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "answers"
        ],
        "properties": {
          "answers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DisplayAnswer"
            }
          }
        }
      },
      "Info": {
        "type": "object",
        "required": [
          "service",
          "contract",
          "providers",
          "version"
        ],
        "properties": {
          "service": {
            "const": "quote-service"
          },
          "contract": {
            "const": 1
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The providers this instance asks."
          },
          "version": {
            "type": "string",
            "description": "The package version, or `unknown`."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "example": {
          "error": "rate limit exceeded"
        }
      },
      "BudgetError": {
        "type": "object",
        "required": [
          "error",
          "provider"
        ],
        "properties": {
          "error": {
            "const": "upstream budget exhausted"
          },
          "provider": {
            "type": "string"
          }
        }
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "Seconds to wait before you ask again.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "AllowOrigin": {
        "description": "`*`, or the asking origin.",
        "schema": {
          "type": "string"
        }
      }
    },
    "parameters": {
      "ForwardedQuery": {
        "name": "query",
        "in": "query",
        "required": false,
        "style": "form",
        "explode": true,
        "description": "Every query parameter goes to the provider unchanged. See the provider's own API reference.",
        "schema": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "requestBodies": {
      "ForwardedBody": {
        "required": true,
        "description": "The provider's own request body. It goes to the provider unchanged, as `application/json`.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object"
            }
          }
        }
      }
    },
    "responses": {
      "OriginNotAllowed": {
        "description": "The `Origin` is missing or not on the allow list (`origin not allowed`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "The route does not take this method.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BodyTimeout": {
        "description": "The body did not arrive within 10 seconds. The service closes the connection.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BodyTooLarge": {
        "description": "The body is larger than 16 KB.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "An unexpected error (`internal error`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Readiness": {
        "description": "Whether the service is ready.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "ready"
              ],
              "properties": {
                "ready": {
                  "type": "boolean"
                }
              }
            },
            "example": {
              "ready": true
            }
          }
        }
      }
    }
  }
}
