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

# Create a quote

> Create a quote for a given currency



## OpenAPI

````yaml post /quote
openapi: 3.0.1
info:
  title: Mavapay API
  description: API documentation for Mavapay
  license:
    name: MIT
  version: 1.0.0
  contact:
    name: Mavapay
    url: https://mavapay.co
    email: info@mavapay.co
servers:
  - url: https://staging.api.mavapay.co/api/v1
    description: Staging server
  - url: https://api.mavapay.co/api/v1
    description: Live server
security:
  - ApiKeyAuth: []
    bearerAuth: []
tags:
  - name: Price
    description: Price related endpoints
  - name: Payment Link
    description: Payment Link endpoints for creating and managing hosted payment pages
paths:
  /quote:
    post:
      tags:
        - Quote
      summary: Create a quote
      description: Create a quote for a given currency
      operationId: createQuote
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateQuote'
            examples:
              buyBtcWithNgnAmountInNaira:
                summary: Buy Bitcoin with Naira (Amount in NGN)
                description: >-
                  Quote for buying Bitcoin where the amount is specified in
                  Nigerian Naira. You want to spend exactly ₦5,000.
                value:
                  amount: '500000'
                  sourceCurrency: NGNKOBO
                  targetCurrency: BTCSAT
                  paymentMethod: BANKTRANSFER
                  paymentCurrency: NGNKOBO
                  customerReference: order-1234567890
                  autopayout: false
              buyBtcWithNgnAmountInBtc:
                summary: Buy Bitcoin with Naira (Amount in BTC)
                description: >-
                  Quote for buying Bitcoin where the amount is specified in
                  satoshis. You want to receive exactly 5,000 sats.
                value:
                  amount: '5000'
                  sourceCurrency: NGNKOBO
                  targetCurrency: BTCSAT
                  paymentMethod: BANKTRANSFER
                  paymentCurrency: BTCSAT
                  customerReference: order-1234567890
                  autopayout: false
              buyBtcWithAutopayout:
                summary: Buy Bitcoin with Autopayout (Lightning)
                description: >-
                  Quote for buying Bitcoin with automatic payout to a Lightning
                  invoice. The invoice amount must match the quote amount.
                value:
                  amount: '208238'
                  sourceCurrency: NGNKOBO
                  targetCurrency: BTCSAT
                  paymentMethod: BANKTRANSFER
                  paymentCurrency: BTCSAT
                  customerReference: order-1234567890
                  autopayout: true
                  beneficiary:
                    lnInvoice: >-
                      lnbc2082380n1p5fhytmpp5ujnmhfhle6qpc22x0ghyh0w0geufk2qscpuegr0wu4yrpscexv8qdq8g36kuuccqzzsxqzfvsp5ely8sp5cgatch8e02uujamy39rwmjdd5pgmakptsq74u6redpnzq9qxpqysgq2lry5dgzu2g04s74tpvctwe37rkprs3k579jw6yt7ncrsg62p29yalw8gf5fawfvpydqv4jjve0nsysfhsxa35dtwug9e6gzxkq0h5gp636wc3
              btcToNgn:
                summary: Sell Bitcoin for Naira
                description: >-
                  Quote for selling Bitcoin to receive Nigerian Naira in a bank
                  account.
                value:
                  amount: '1000000'
                  sourceCurrency: BTCSAT
                  targetCurrency: NGNKOBO
                  paymentMethod: LIGHTNING
                  paymentCurrency: NGNKOBO
                  autopayout: true
                  customerReference: order-1234567890
                  beneficiary:
                    bankAccountName: olaolu olajide
                    bankCode: '000013'
                    bankName: GTBANK PLC
                    bankAccountNumber: '0087241555'
        required: true
      responses:
        '200':
          description: Quote response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    format: string
                    example: ok
                  data:
                    $ref: '#/components/schemas/Quote'
              examples:
                buyBtcWithNgnResponse:
                  summary: Buy BTC with NGN Response
                  description: >-
                    Response for buying Bitcoin with Nigerian Naira showing bank
                    transfer details
                  value:
                    status: ok
                    data:
                      id: 53a87b44-2ecc-4106-8297-f1fd15d010a9
                      exchangeRate: 1
                      usdToTargetCurrencyRate: 0.00000917325600278523
                      sourceCurrency: NGNKOBO
                      targetCurrency: BTCSAT
                      transactionFeesInSourceCurrency: 4624
                      transactionFeesInTargetCurrency: 25
                      amountInSourceCurrency: 844540
                      amountInTargetCurrency: 5000
                      paymentMethod: BANKTRANSFER
                      expiry: '2025-09-01T12:52:08.215Z'
                      isValid: true
                      invoice: ''
                      hash: 68b594a09a16ac0012ae3414
                      totalAmountInSourceCurrency: 844540
                      customerInternalFee: 0
                      bankName: GLOBUS BANK
                      ngnBankAccountNumber: '3242273802'
                      ngnAccountName: Mava Digital Solutions Limited
                      ngnBankCode: '000027'
                      estimatedRoutingFee: 0
                      orderId: 43477-4306
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    CreateQuote:
      type: object
      properties:
        amount:
          type: number
          format: number
          example: 1000
          description: >-
            The amount in the target currency in its lowest denomination. e.g
            '500000' for 5000.00 NGN
        sourceCurrency:
          type: string
          format: string
          enum:
            - BTCSAT
            - NGNKOBO
          default: BTCSAT
          description: The source currency for the quote
        targetCurrency:
          type: string
          format: string
          enum:
            - NGNKOBO
            - KESCENT
            - ZARCENT
            - GHSPESEWA
            - BTCSAT
          default: NGNKOBO
          description: The local currency to convert the source currency to
        paymentMethod:
          type: string
          format: string
          enum:
            - LIGHTNING
            - BANKTRANSFER
          default: LIGHTNING
          description: The payment method for the quote
        paymentCurrency:
          type: string
          format: string
          enum:
            - NGNKOBO
            - BTCSAT
            - KESCENT
            - ZARCENT
            - GHSPESEWA
          description: >-
            Currency the amount is denominated in. Must be either sourceCurrency
            or targetCurrency. Determines what the 'amount' field represents.
            Example: if buying BTC with NGN and paymentCurrency is 'NGNKOBO',
            amount is in Naira; if 'BTCSAT', amount is in Bitcoin.
        customerReference:
          type: string
          format: string
          example: order-1234567890
          description: Your unique identifier for the quote
        autopayout:
          type: boolean
          format: boolean
          example: false
          default: false
        beneficiary:
          type: object
          oneOf:
            - title: NGN Beneficiary
              type: object
              properties:
                bankAccountNumber:
                  type: string
                  example: '0149203789'
                  description: The bank account number of the beneficiary
                bankAccountName:
                  type: string
                  example: olaolu olajide
                  description: The name of the beneficiary
                bankCode:
                  type: string
                  example: '000013'
                  description: The bank code of the beneficiary
                bankName:
                  type: string
                  example: GTBANK PLC
                  description: The name of the bank of the beneficiary
              required:
                - bankAccountNumber
                - bankAccountName
                - bankCode
                - bankName
            - title: KES Beneficiary
              type: object
              properties:
                identifierType:
                  type: string
                  enum:
                    - paytophone
                    - paytobill
                    - paytotill
                  example: paytophone
                  description: The type of identifier to use for the beneficiary
                identifiers:
                  type: object
                  properties:
                    phoneNumber:
                      type: string
                      example: '+254796980788'
                      description: >-
                        The phone number of the beneficiary if the
                        identifierType is paytophone
                    paybillNumber:
                      type: string
                      example: '4141031'
                      description: >-
                        The paybill number of the beneficiary if the
                        identifierType is paytobill
                    accountNumber:
                      type: string
                      example: vlad
                      description: >-
                        The account number of the beneficiary if the
                        identifierType is paytobill
                    tillNumber:
                      type: string
                      example: '796980711'
                      description: >-
                        The till number of the beneficiary if the identifierType
                        is paytotill
                    accountName:
                      type: string
                      example: John Doe
                      description: >-
                        The account name of the beneficiary if the
                        identifierType is paytobill or paytotill
              required:
                - identifierType
                - identifiers
            - title: GHS Beneficiary
              type: object
              properties:
                identifierType:
                  type: string
                  enum:
                    - MTN
                  example: MTN
                  description: The type of mobile network to use for the beneficiary
                identifiers:
                  type: object
                  properties:
                    phoneNumber:
                      type: string
                      example: '+233796980788'
                      description: >-
                        The phone number of the beneficiary if the
                        identifierType is MTN
                    accountName:
                      type: string
                      example: Mensah Kwame
                      description: >-
                        The account name of the beneficiary if the
                        identifierType is MTN
              required:
                - identifierType
                - identifiers
            - title: ZAR Beneficiary
              type: object
              properties:
                name:
                  type: string
                  example: Ricki Allardice
                  description: The name of the beneficiary
                bankName:
                  type: string
                  example: CAPITEC BANK
                  description: The name of the bank of the beneficiary
                bankAccountNumber:
                  type: string
                  example: '1352906218'
                  description: The bank account number of the beneficiary
              required:
                - name
                - bankName
                - bankAccountNumber
            - title: BTC Beneficiary
              type: object
              properties:
                lnInvoice:
                  type: string
                  example: >-
                    lnbc2082380n1p5fhytmpp5ujnmhfhle6qpc22x0ghyh0w0geufk2qscpuegr0wu4yrpscexv8qdq8g36kuuccqzzsxqzfvsp5ely8sp5cgatch8e02uujamy39rwmjdd5pgmakptsq74u6redpnzq9qxpqysgq2lry5dgzu2g04s74tpvctwe37rkprs3k579jw6yt7ncrsg62p29yalw8gf5fawfvpydqv4jjve0nsysfhsxa35dtwug9e6gzxkq0h5gp636wc3
                  description: >-
                    Lightning Network invoice for Bitcoin payout (required when
                    autopayout is true)
                lnAddress:
                  type: string
                  example: user@getalby.com
                  description: >-
                    Lightning address for Bitcoin payout (alternative to
                    lnInvoice)
                onChainAddress:
                  type: string
                  example: bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh
                  description: >-
                    Bitcoin on-chain address for payout (alternative to
                    lnInvoice)
      required:
        - amount
        - sourceCurrency
        - targetCurrency
        - paymentMethod
        - paymentCurrency
    Quote:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: d1614a76-9c7f-4111-98a7-43199f307e5b
        exchangeRate:
          type: number
          format: number
          example: 103830225.71866913
          description: >-
            The exchange rate is the rate of 1 BTC to the targetCurrency. So if
            you generated a quote for NGN->BTC (targetCurrency is BTC), the rate
            will be 1 because the exchange rate of 1 BTC to BTC is 1. If it's a
            quote of BTC->NGN (targetCurrency is NGN), the rate will likely be
            103830225.71866913 i.e., 1 BTC to NGN
        usdToTargetCurrencyRate:
          type: number
          format: number
          example: 1500.65
          description: The USD to target currency rate for the quote
        sourceCurrency:
          type: string
          format: string
          enum:
            - BTCSAT
            - NGNKOBO
          description: The source currency for the quote
        targetCurrency:
          type: string
          format: string
          enum:
            - NGNKOBO
            - KESCENT
            - ZARCENT
            - GHSPESEWA
          description: The target currency for the quote
        transactionFeesInSourceCurrency:
          type: number
          format: number
          example: 13.23
          description: >-
            The transaction fees in the source currency in its lowest
            denomination
        transactionFeesInTargetCurrency:
          type: string
          format: string
          example: '3750.00'
          description: >-
            The transaction fees in the target currency in its lowest
            denomination
        amountInSourceCurrency:
          type: number
          format: number
          example: 1499
          description: The amount in the source currency in its lowest denomination
        amountInTargetCurrency:
          type: string
          format: string
          example: '50000.00'
          description: The amount in the target currency in its lowest denomination
        paymentMethod:
          type: string
          format: string
          enum:
            - LIGHTNING
        expiry:
          type: string
          format: date-time
          example: '2021-07-01T12:00:00Z'
        isValid:
          type: boolean
          format: boolean
          example: true
        invoice:
          type: string
          format: string
          example: >-
            lntbs36020n1pnehfzcpp5zc8g9tfpwnmaevh62ak2vu6zjqyt5cpph3gjm4zfyqz9srjjdsaqdz5296k7ar98gsy6ctkvys9qcteyqmnyenr8yunswfdvyer2v3dx33kxe3dvymnsefdv5mnjcm9x5mrydm9vccqcqzpuxqzfvsp5utd7hdfmjp7vw3lc6hal8psqruwcnu89hxfukyzugxh40jhv8xcq9qxpqysgq2lry5dgzu2g04s74tpvctwe37rkprs3k579jw6yt7ncrsg62p29yalw8gf5fawfvpydqv4jjve0nsysfhsxa35dtwug9e6gzxkq0h5gp636wc3
          description: The lightning invoice to pay for the quote
        hash:
          type: string
          format: string
          example: 189727ef2e0f35921af7858b96e27cbad960b0ec2bb2a4ab73b6a231f9ce8727
          description: The payment hash for the lightning invoice attached to the quote
        customerReference:
          type: string
          format: string
          example: order-1234567890
          description: Your unique identifier for the quote
        totalAmountInSourceCurrency:
          type: number
          format: number
          example: 1499
          description: The total amount in the source currency in its lowest denomination
        customerInternalFee:
          type: number
          format: number
          description: >-
            An internal fee you can set to charge the customer. This fee is in
            the source currency in its lowest denomination
          example: 0
        createdAt:
          type: string
          format: date-time
          example: '2021-07-01T12:00:00Z'
          description: The date and time the quote was created
        updatedAt:
          type: string
          format: date-time
          example: '2021-07-01T12:00:00Z'
          description: The date and time the quote was last updated
        bankName:
          type: string
          format: string
          example: WEMA BANK
          description: Bank name for NGN bank transfer (when paymentMethod is BANKTRANSFER)
        ngnBankAccountNumber:
          type: string
          format: string
          example: '7824655568'
          description: >-
            Bank account number for NGN payment (when paymentMethod is
            BANKTRANSFER)
        ngnAccountName:
          type: string
          format: string
          example: Mava Digital Solutions Limited
          description: Account name for NGN payment (when paymentMethod is BANKTRANSFER)
        ngnBankCode:
          type: string
          format: string
          example: '000027'
          description: NIP bank code for NGN payment (when paymentMethod is BANKTRANSFER)
        orderId:
          type: string
          format: string
          example: 43477-4306
          description: Unique order identifier for tracking
        estimatedRoutingFee:
          type: number
          format: number
          example: 0
          description: Estimated routing fee for Lightning Network payments in satoshis
    Error:
      required:
        - error
        - message
      type: object
      properties:
        status:
          type: string
          format: string
          example: error
        message:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    bearerAuth:
      type: http
      scheme: bearer

````