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

# Create Exchange

> Creates a new exchange between two cryptocurrencies for the authenticated merchant



## OpenAPI

````yaml POST /api/v1/merchants/exchange/create
openapi: 3.0.1
info:
  title: OpenAPI Payvra
  description: Payvra API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://payvra.com
security:
  - BearerAuth: []
paths:
  /api/v1/merchants/exchange/create:
    post:
      tags:
        - Exchange
      summary: Create a new exchange
      description: >-
        Creates a new exchange between two cryptocurrencies for the
        authenticated merchant
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExchangeRequest'
      responses:
        '200':
          description: Exchange created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeResponse'
        '400':
          description: Bad request - validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    CreateExchangeRequest:
      type: object
      required:
        - fromCurrency
        - toCurrency
        - amount
      properties:
        fromCurrency:
          type: string
          description: Symbol of the source cryptocurrency
        toCurrency:
          type: string
          description: Symbol of the target cryptocurrency
        amount:
          type: number
          description: Amount to exchange from the source currency
          minimum: 0
          multipleOf: 1.e-8
    ExchangeResponse:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - SUCCESS
            - FAILED
        fromWallet:
          type: object
          properties:
            currency:
              type: object
              properties:
                symbol:
                  type: string
        toWallet:
          type: object
          properties:
            currency:
              type: object
              properties:
                symbol:
                  type: string
        amount:
          type: number
        rate:
          type: number
        toAmount:
          type: number
        createdAt:
          type: string
          format: date-time
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````