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

# Create a quote

> Request a buy quote by cash amount or a sell quote by quantity. Supply exactly one positive decimal amount and inspect the returned expiry and nullable values before creating an order. Examples contain captured Sandbox identifiers. Request a fresh quote and use a new idempotency key for a new operation.

<RequestExample>
  ```bash cURL
  curl --request POST \
    --url 'https://api-sandbox.uqpaytech.com/api/v1/stocks/quote' \
    --header "Content-Type: application/json" \
    --header "x-auth-token: Bearer ${SANDBOX_TOKEN}" \
    --header "x-idempotency-key: ${UNIQUE_IDEMPOTENCY_KEY}" \
    --data '{
    "asset_id": "7453f146-b267-11f1-b4f4-0abd773ba497",
    "side": "BUY",
    "funding_currency": "USDC",
    "cash_amount": "1"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200
  {
    "quote_id": "0576b03b-56dd-48b1-ba24-058ce90d0f53",
    "asset_id": "7453f146-b267-11f1-b4f4-0abd773ba497",
    "symbol": "AAPLx",
    "side": "BUY",
    "network": "Ethereum",
    "funding_currency": "USDC",
    "quantity": "0.00297066689243735",
    "price": "336.624750000000055741",
    "cash_amount": "1",
    "fees": [
      {
        "type": "TRADING",
        "amount": "0.0005",
        "currency": "USDC"
      }
    ],
    "total_amount": "1.0005",
    "created_at": "2026-09-21T01:33:07.797Z",
    "expires_at": "2026-09-21T01:34:04.542Z"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml /stocks/stocks.yaml post /quote
openapi: 3.0.3
info:
  title: UQPAY Stocks API
  version: 1.0.0
  description: >-
    Browse assets, request quotes, create orders, and query orders and
    positions. Amounts and quantities use decimal strings.
servers:
  - url: https://api-sandbox.uqpaytech.com/api/v1/stocks
    description: Sandbox
security:
  - AuthToken: []
paths:
  /quote:
    post:
      tags:
        - Stocks
      summary: Create a quote
      description: >-
        Request a buy quote by cash amount or a sell quote by quantity. Supply
        exactly one positive decimal amount and inspect the returned expiry and
        nullable values before creating an order. Examples contain captured
        Sandbox identifiers. Request a fresh quote and use a new idempotency key
        for a new operation.
      operationId: createStocksQuote
      parameters:
        - name: x-idempotency-key
          in: header
          required: true
          schema:
            type: string
            format: uuid
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
          description: >-
            A unique identifier used to maintain operation idempotency. Use the
            same key and request body when retrying an operation, and a new key
            for a new operation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuoteRequest'
            examples:
              sandbox:
                summary: Sandbox request
                value:
                  asset_id: 7453f146-b267-11f1-b4f4-0abd773ba497
                  side: BUY
                  funding_currency: USDC
                  cash_amount: '1'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Quote'
              examples:
                sandbox:
                  summary: Sandbox response
                  value:
                    quote_id: 0576b03b-56dd-48b1-ba24-058ce90d0f53
                    asset_id: 7453f146-b267-11f1-b4f4-0abd773ba497
                    symbol: AAPLx
                    side: BUY
                    network: Ethereum
                    funding_currency: USDC
                    quantity: '0.00297066689243735'
                    price: '336.624750000000055741'
                    cash_amount: '1'
                    fees:
                      - type: TRADING
                        amount: '0.0005'
                        currency: USDC
                    total_amount: '1.0005'
                    created_at: '2026-09-21T01:33:07.797Z'
                    expires_at: '2026-09-21T01:34:04.542Z'
        '400':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: >-
            The gateway could not complete the request. For a write, reconcile
            the result before retrying with the same idempotency key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            The request failed. Read type, code, and message in the error
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl --request POST \
              --url 'https://api-sandbox.uqpaytech.com/api/v1/stocks/quote' \
              --header "Content-Type: application/json" \
              --header "x-auth-token: Bearer ${SANDBOX_TOKEN}" \
              --header "x-idempotency-key: ${UNIQUE_IDEMPOTENCY_KEY}" \
              --data '{
              "asset_id": "7453f146-b267-11f1-b4f4-0abd773ba497",
              "side": "BUY",
              "funding_currency": "USDC",
              "cash_amount": "1"
            }'
components:
  schemas:
    QuoteRequest:
      oneOf:
        - type: object
          additionalProperties: false
          properties:
            asset_id:
              type: string
              format: uuid
              description: Asset identifier returned by List assets.
              example: 7453f146-b267-11f1-b4f4-0abd773ba497
            side:
              type: string
              enum:
                - BUY
              example: BUY
            funding_currency:
              type: string
              enum:
                - USDC
              description: Currency used to fund the trade.
              example: USDC
            cash_amount:
              type: string
              pattern: ^[0-9]{1,18}(\.[0-9]{1,6})?$
              description: Positive funding amount before fees. Do not include quantity.
              example: '1'
          required:
            - asset_id
            - side
            - funding_currency
            - cash_amount
          title: Buy quote
        - type: object
          additionalProperties: false
          properties:
            asset_id:
              type: string
              format: uuid
              description: Asset identifier returned by List assets.
            side:
              type: string
              enum:
                - SELL
            funding_currency:
              type: string
              enum:
                - USDC
              description: Currency used to fund the trade.
            quantity:
              type: string
              pattern: ^[0-9]{1,18}(\.[0-9]{1,8})?$
              description: Positive asset quantity to sell. Do not include cash_amount.
          required:
            - asset_id
            - side
            - funding_currency
            - quantity
          title: Sell quote
    Quote:
      type: object
      additionalProperties: false
      properties:
        quote_id:
          type: string
          format: uuid
          description: Quote identifier to submit when creating an order.
          example: 0576b03b-56dd-48b1-ba24-058ce90d0f53
        asset_id:
          type: string
          format: uuid
          description: >-
            Asset identifier used across asset, quote, order, and position
            requests.
          example: 7453f146-b267-11f1-b4f4-0abd773ba497
        symbol:
          type: string
          description: Asset symbol.
          example: AAPLx
        side:
          type: string
          enum:
            - BUY
            - SELL
          description: Direction of the proposed trade.
          example: BUY
        network:
          type: string
          description: >-
            Network selected for the quote. The quote request does not choose a
            network.
          example: Ethereum
        funding_currency:
          type: string
          enum:
            - USDC
          description: Funding currency.
          example: USDC
        quantity:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          nullable: true
          description: >-
            Quoted asset quantity; null when the quantity is determined during
            execution.
          example: '0.00297066689243735'
        price:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          nullable: true
          description: >-
            Quoted price per unit in funding_currency; null when the execution
            price is not fixed by the quote.
          example: '336.624750000000055741'
        cash_amount:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          nullable: true
          description: >-
            Trade amount before fees in funding_currency; null when it is
            determined during execution.
          example: '1'
        fees:
          type: array
          items:
            $ref: '#/components/schemas/Fee'
          nullable: true
          description: >-
            Quoted fees. Null means fees are not yet available; it does not mean
            that no fee will be charged.
        total_amount:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          nullable: true
          description: >-
            Buy outlay including fees, or sell proceeds after fees, in
            funding_currency. Null when the total cannot yet be determined.
          example: '1.0005'
        created_at:
          type: string
          format: date-time
          description: Time the quote was created.
          example: '2026-09-21T01:33:07.797Z'
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: Deadline for accepting the quote. Request a new quote after expiry.
          example: '2026-09-21T01:34:04.542Z'
      required:
        - quote_id
        - asset_id
        - symbol
        - side
        - network
        - funding_currency
        - quantity
        - price
        - cash_amount
        - fees
        - total_amount
        - created_at
        - expires_at
    Error:
      type: object
      additionalProperties: false
      required:
        - type
        - code
        - message
      properties:
        type:
          type: string
          description: Error category for classifying the failure.
          pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$
        code:
          type: string
          description: >-
            Machine-readable business error code. Use this together with the
            HTTP status; do not match on message text.
          pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$
        message:
          type: string
          description: Human-readable explanation of the error.
    Fee:
      type: object
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - TRADING
            - DEPOSIT
            - WITHDRAWAL
          description: Fee category.
          example: TRADING
        amount:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          description: Fee amount.
          example: '0.0005'
        currency:
          type: string
          description: Currency in which the fee is charged.
          example: USDC
      required:
        - type
        - amount
        - currency
  securitySchemes:
    AuthToken:
      type: apiKey
      in: header
      name: x-auth-token
      description: The API token for login provided by UQPAY.

````