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

# A signed quote

> A signed quote for one feed. The Knockout program verifies the signatures on chain. Fetch a new quote for each attempt, with a new `idempotency_key`. For a window quote, send `min_slot` and `payload_version: 2`. `409` and `429` are retryable after `retry_after_ms`. Every other `4xx` is not: fix the request.



## OpenAPI

````yaml /openapi/prices.json post /v1/quote
openapi: 3.1.0
info:
  title: Rekt price service
  version: '1'
  summary: Signed price quotes for the instructions that read a price.
  description: >-
    Quotes come from `https://prices.rekt.trading`. There is no other address.
    Use TLS everywhere.


    Only the instructions that read a price need a quote: `settle`,
    `stamp_book`, `set_take_profit` and `prove_price`. The Knockout program
    verifies the signatures on chain. Nothing that the service returns outside
    the signed bytes is authoritative.


    Rules:


    - Call the service from a server, not from a browser. It sends no CORS
    headers.

    - Public use needs no sign-up. If you have a token, send it as
    `Authorization: Bearer <token>`. Keep a token out of URLs.

    - Public use is rate-limited for each client address. A limited request gets
    `429` with `retry_after_ms` and a `Retry-After` header. A limit says nothing
    about whether a feed is healthy.

    - Back off with jitter on `429` and `503`, and obey `retry_after_ms`.

    - For the latest price, use the stream
    (`wss://prices.rekt.trading/v1/stream`), not polling. Keep one stream
    connection per process.

    - A response can hold fields that this description does not list. Ignore a
    field that you do not know.


    For higher limits, write to support@asymmetra.xyz.
servers:
  - url: https://prices.rekt.trading
    description: The price service.
security:
  - {}
  - bearerAuth: []
tags:
  - name: Quotes
    description: Signed quotes.
  - name: Feeds
    description: Feeds, signer keys and readiness.
  - name: Health
    description: Process health.
paths:
  /v1/quote:
    post:
      tags:
        - Quotes
      summary: A signed quote
      description: >-
        A signed quote for one feed. The Knockout program verifies the
        signatures on chain. Fetch a new quote for each attempt, with a new
        `idempotency_key`. For a window quote, send `min_slot` and
        `payload_version: 2`. `409` and `429` are retryable after
        `retry_after_ms`. Every other `4xx` is not: fix the request.
      operationId: createQuote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuoteRequest'
            examples:
              latest:
                summary: The latest quote
                value:
                  feed: SOL/USD
                  payload_version: 2
                  idempotency_key: 3f6c1d2e9a8b4c7d0e1f2a3b4c5d6e7f
              window:
                summary: A window quote
                value:
                  feed: SOL/USD
                  payload_version: 2
                  min_slot: 400000000
                  idempotency_key: 9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d
      responses:
        '200':
          description: The signed quote.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '409':
          $ref: '#/components/responses/NotReady'
        '422':
          $ref: '#/components/responses/Unachievable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    QuoteRequest:
      type: object
      description: A request for one signed quote.
      properties:
        feed:
          type: string
          description: The feed symbol, as `GET /v1/feeds` lists it.
          examples:
            - SOL/USD
        idempotency_key:
          type: string
          description: >-
            A new key for each attempt. Reuse a key only for an immediate retry
            after a transport failure. The service refuses a request without a
            key.
          examples:
            - 3f6c1d2e9a8b4c7d0e1f2a3b4c5d6e7f
        payload_version:
          type: integer
          description: The version of the signed payload. Send `2` for a window quote.
          enum:
            - 1
            - 2
          default: 1
        min_slot:
          type: integer
          description: >-
            With `payload_version: 2`: return the first quote at or after this
            slot. Every caller who asks for the same slot gets the same bytes.
            Unit: slots.
          minimum: 0
        min_sources:
          type: integer
          description: >-
            The minimum number of sources for this quote. It can only make the
            feed's own floor stricter. A value that the feed cannot meet gets
            `422`. Unit: sources.
          minimum: 1
        max_age_slots:
          type: integer
          description: >-
            The maximum age of the quote. It can only make the feed's own limit
            stricter. Unit: slots.
          minimum: 0
      required:
        - feed
        - idempotency_key
    QuoteResponse:
      type: object
      description: >-
        One signed quote. Only the signed bytes are authoritative. Decide on
        `payload`, not on `decoded`.
      properties:
        status:
          type: string
          description: The result of the request, as a short code.
        feed_id:
          type: string
          description: >-
            The feed id, as 64 hex characters. It equals `market.feeds[0]` of
            the market of this feed.
          pattern: ^[0-9a-f]{64}$
        payload:
          type: string
          description: >-
            The signed bytes, as hex. Payload versions 1 and 2 are 80 bytes.
            Decode them with the SDK.
          pattern: ^[0-9a-f]+$
        signatures:
          type: array
          description: The signatures over `payload`. Several keys sign each quote.
          items:
            $ref: '#/components/schemas/QuoteSignature'
        ed25519_instruction_data:
          type: string
          description: >-
            The complete ed25519 instruction data, as hex. Place this
            instruction immediately before yours in the same transaction.
          pattern: ^[0-9a-f]+$
        ed25519_program_id:
          type: string
          description: The ed25519 program id, in base58.
          examples:
            - Ed25519SigVerify111111111111111111111111111
        decoded:
          type: object
          description: >-
            A copy of some payload fields, for reading only. It is not
            authoritative.
        instance_id:
          type: string
          description: The service instance that signed this quote.
        current_slot:
          type: integer
          description: 'The slot of the service when it answered. Unit: slots.'
        expires_at_slot:
          type: integer
          description: >-
            The expiry slot that the service states for this quote. It is not
            signed. The program judges the age itself, against
            `market.maxOracleAgeSlots`. Unit: slots.
        policy_revision:
          type: integer
          description: >-
            The revision of the feed policy that served this quote. It is not
            signed. Read it, but do not decide on it. Only some responses carry
            it.
      required:
        - payload
        - signatures
        - ed25519_instruction_data
    QuoteSignature:
      type: object
      description: One signature over the payload.
      properties:
        pubkey:
          type: string
          description: The public key of the signer.
        signature:
          type: string
          description: The ed25519 signature over `payload`.
      required:
        - pubkey
        - signature
    Refusal:
      type: object
      description: A refused request. A failure is never a price.
      properties:
        status:
          type: string
          description: >-
            The refusal class, as a short code, for example `not_ready` or
            `invalid_request`.
        reason:
          type: string
          description: >-
            Why the service refused, as a short code in snake_case, for example
            `session_closed`. The list of codes can grow. Route an unknown code
            by its HTTP status.
        error:
          type: string
          description: >-
            The error code of an invalid request, for example
            `idempotency_key_reuse`.
        detail:
          type: string
          description: The refusal, in words.
        retry_after_ms:
          type: integer
          description: >-
            Wait this long before you retry. Only a retryable refusal carries
            it. Unit: milliseconds.
        retryable:
          type: boolean
          description: False when a retry cannot succeed.
  responses:
    BadRequest:
      description: >-
        The request is not valid, for example an unknown feed or a reused
        `idempotency_key` with a different body. Do not retry. Fix the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
    NotReady:
      description: >-
        The feed cannot be quoted now, for example `session_closed` or
        `insufficient_sources`. Retry after `retry_after_ms`, with a new
        `idempotency_key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
    Unachievable:
      description: >-
        The request asks for more than the feed can give, for example
        `min_sources_unachievable`. Do not retry. Fix the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
    TooManyRequests:
      description: >-
        The rate limit for your client address applies. Clients behind one
        address share a limit. Retry after `retry_after_ms`, with backoff and
        jitter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
      headers:
        Retry-After:
          description: 'Wait this long before you retry. Unit: seconds.'
          schema:
            type: integer
    Unavailable:
      description: The service cannot answer now. Retry later, with backoff and jitter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Optional. A token for callers that have one. Public use needs no token.

````

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