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

# Get FX Rate

> Convert between supported currencies using current exchange rates.



## OpenAPI

````yaml GET /fx/convert
openapi: 3.0.1
info:
  title: Stable Pay API
  description: The API for the Stable Pay Gateway
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.stablepay.ai
security:
  - bearerAuth: []
tags:
  - name: Transactions
    description: Operations related to payment transactions
  - name: Payouts
    description: Operations related to payouts
  - name: Identity
    description: Operations related to Stablepay ID management
  - name: Mpesa
    description: Operations related to Mpesa payouts
  - name: ForeignExchange
    description: Operations related to currency conversion
  - name: MoMo
    description: Operations related to Mobile Money
  - name: resolve
    description: Operations related to account resolution
  - name: validate
    description: Operations related to account validation
paths:
  /fx/convert:
    get:
      tags:
        - ForeignExchange
      summary: Convert Currency
      description: Convert between supported currencies using current exchange rates.
      operationId: convertCurrency
      parameters:
        - name: amount
          in: query
          description: Amount to convert
          required: true
          schema:
            type: number
            minimum: 0.01
        - name: sourceCurrency
          in: query
          description: Source currency code
          required: true
          schema:
            type: string
            enum:
              - ZAR
              - NGN
              - KES
              - GHS
              - UGX
              - TZS
              - ZMW
              - ETB
        - name: destinationCurrency
          in: query
          description: Destination currency code
          required: true
          schema:
            type: string
            enum:
              - USDC
              - USDT
      responses:
        '200':
          description: Currency conversion successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversionResponse'
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ConversionResponse:
      type: object
      required:
        - sourceCurrency
        - destinationCurrency
        - sourceAmount
        - convertedAmount
        - exchangeRate
      properties:
        convertedAmount:
          type: number
          description: >-
            Total converted amount in the destination currency, inclusive of
            payout fee, payment network fee, and any applicable Optional Issuer
            Fee (OIF).
        exchangeRate:
          type: string
          description: Market exchange rate sourced from local liquidity partners.
        expiryTimestamp:
          type: integer
          format: int64
          description: Timestamp (Unix timestamp) when the conversion amount expires
        payoutFee:
          type: string
          description: >-
            The payout fee comprises the mobile money or bank payout fee,
            payment network fee, and any applicable Optional Issuer Fee (OIF),
            and is included in the converted amount.
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
          description: Error code
        message:
          type: string
          description: Human-readable error message
        details:
          type: object
          description: Additional error details
          additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        API key authentication using Bearer scheme. 
         Format: Bearer {STA_xxxx}

````