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

# Generate quote

> Creates a quote for a currency pair and amount, returning a quote ID and rate valid for 3 seconds by default.

<Warning>
  **v1 sunsets December 31, 2026.** Migrate to v2 — see the [migration guide](/v1/migration-v1-to-v2).
</Warning>

Creates a new quote for a specific currency pair and amount, returning a quote ID and guaranteed rate valid for 3 seconds.

Use this endpoint to:

* Get real-time exchange rates
* Lock in rates for trading
* Calculate exchange amounts
* Review applicable fees and margins

<Note>
  Idempotency is supported on v2 and v3 for this endpoint. v1 does not support idempotency keys — see [Migration guide](/v1/migration-v1-to-v2).
</Note>

## Errors

| Status | Message                                                                         | Notes                                                                                                                  |
| ------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| 400    | `Query validation failed`                                                       | Request didn't match schema (unsupported pair, bad amount, missing direction, etc.)                                    |
| 401    | `The authorization key provided is either invalid or expired, please try again` | Mint a fresh JWT — see [Authentication](/v1/authentication)                                                            |
| 500    | `Error while creating a quote, please try again later`                          | Quote-engine failure. Distinct from the generic 500 — the request never reached trade execution; request a fresh quote |

See the full [v1 error reference](/v1/errors).


## OpenAPI

````yaml POST /v1/brokerage/{orgId}/generate_quote
openapi: 3.1.0
info:
  title: Overview of OpenFX APIs
  description: >-
    OpenFX provides a robust and secure API suite engineered for high
    performance and reliability, enabling programmatic access to real-time
    market data, trade execution, and money movement functionalities. This guide
    will walk through the step-by-step process of deposits, quoting, trading,
    settlements and monitoring using OpenFX APIs.
  version: v1.0.0
  termsOfService: https://www.openfx.com/terms
  contact:
    name: OpenFX Support
    email: support@openfx.com
    url: https://www.openfx.com
servers:
  - url: https://api.openfx.com
    description: OpenFX API Server
security:
  - bearerAuth: []
tags:
  - name: MarketData
    description: >-
      This endpoint retrieves a complete list of all tradable fiat and
      stablecoin currency pairs on the OpenFX platform.
  - name: Balances
    description: >-
      The Balance endpoints enable real-time tracking and management of currency
      holdings within an account.
  - name: Trade
    description: >-
      The Trade APIs facilitate programmatic currency exchange through a
      quote-then-trade workflow, ensuring price transparency and guaranteed
      execution at quoted rates.
  - name: Deposits
    description: >-
      Deposit endpoints enable secure funding of trading accounts across
      multiple supported currencies and methods.
  - name: Withdrawals
    description: >-
      The Withdrawal API facilitates secure fund withdrawals for both fiat and
      stablecoins.
paths:
  /v1/brokerage/{orgId}/generate_quote:
    post:
      tags:
        - Trade
      summary: Generate quote
      description: >
        Creates a new quote for a specific currency pair and amount, returning a
        quote ID and guaranteed rate valid for 3 seconds.
              
        Use this endpoint to:
                - Get real-time exchange rates
                - Lock in rates for trading
                - Calculate exchange amounts
                - Review applicable fees and margins
      operationId: generateQuote
      parameters:
        - schema:
            type: string
          in: path
          name: orgId
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
                  exclusiveMinimum: 0
                  example: 1000
                buy:
                  type: string
                  example: USDC
                sell:
                  type: string
                  example: USD
                referencedUnit:
                  type: string
                  example: USDC
                quoteForSeconds:
                  type: number
                  enum:
                    - 3
                    - 15
                    - 30
                    - 45
                    - 60
                  default: 3
                  example: 3
                  description: Requested quote expiry validity in seconds.
              required:
                - amount
                - buy
                - sell
                - referencedUnit
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                      - error
                    example: success
                  data:
                    type:
                      - object
                      - 'null'
                    properties:
                      quote:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                            example: 123e4567-e89b-12d3-a456-426614174000
                            description: Unique identifier for the quote
                          userId:
                            type: string
                            format: uuid
                            example: 123e4567-e89b-12d3-a456-426614174001
                            description: >-
                              Unique identifier of the user who generated the
                              quote
                          buy:
                            type: string
                            example: USD
                            description: >-
                              Currency the user wants to buy (quote's target
                              currency)
                          sell:
                            type: string
                            example: USDC
                            description: >-
                              Currency the user wants to sell (quote's base
                              currency)
                          referencedUnit:
                            type: string
                            example: USD
                            description: Currency symbol used to reference the input amount
                          referencedAmount:
                            type: number
                            example: 1000
                            description: >-
                              Input amount in the referenced unit provided by
                              the user
                          quoteAmount:
                            type: number
                            example: 999.800000007998
                            description: >-
                              Calculated amount the user will receive or pay,
                              based on the reference amount
                          createdAt:
                            type: string
                            example: '2024-11-25T15:05:34.945Z'
                            description: UTC Timestamp when the quote was generated
                          expiryTimeinSeconds:
                            type: number
                            example: 3
                            description: Number of seconds until the quote expires
                  message:
                    type: string
                    example: Data fetched successfully
              examples:
                default_example:
                  value:
                    status: success
                    data:
                      quote:
                        id: 123e4567-e89b-12d3-a456-426614174000
                        userId: 123e4567-e89b-12d3-a456-426614174001
                        buy: USD
                        sell: USDC
                        referencedUnit: USD
                        referencedAmount: 1000
                        quoteAmount: 999.800000007998
                        createdAt: '2024-11-25T15:05:34.945Z'
                        expiryTimeinSeconds: 3
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                    example: error
                  message:
                    type: string
                    example: Data fetched successfully
              examples:
                default_example:
                  value:
                    status: error
                    message: Query validation failed
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                    example: error
                  message:
                    type: string
                    example: Data fetched successfully
              examples:
                default_example:
                  value:
                    status: error
                    message: >-
                      The authorization key provided is either invalid or
                      expired, please try again
        '500':
          description: Quote request failed
          content:
            application/json:
              examples:
                default_example:
                  value:
                    status: error
                    message: Error while creating a quote, please try again later
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````