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

# Create Offramp Request

> This endpoint will create a offramp request for a customer. If the fiat transfer fails after successful crypto receipt, an automatic refund will be initiated after 5 minutes. Use the refund-status endpoint to check refund status.

This endpoint will create an offramp request for a customer to convert crypto to fiat.


## OpenAPI

````yaml POST /api/v3/offramp
openapi: 3.0.0
info:
  title: KOTANI PAY API PLATFORM
  description: ''
  version: '3.0'
  contact: {}
servers:
  - url: https://sandbox-api.kotanipay.com
security: []
tags: []
paths:
  /api/v3/offramp:
    post:
      tags:
        - OFFRAMP
      summary: Offramp Request
      description: >-
        This endpoint will create a offramp request for a customer. If the fiat
        transfer fails after successful crypto receipt, an automatic refund will
        be initiated after 5 minutes. Use the refund-status endpoint to check
        refund status.
      operationId: OffRampController_createOfframp_api/v3
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OfframpDto'
      responses:
        '200':
          description: Offramp Response
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Offramp has been successfully created
                  data:
                    $ref: '#/components/schemas/OfframpResponseDto'
                    type: object
        '400':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Bad Request
                  data:
                    type: object
                    example: {}
        '401':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Unauthorized
                  data:
                    type: object
                    example: {}
      security:
        - JWT: []
components:
  schemas:
    OfframpDto:
      type: object
      properties:
        mobileMoneyReceiver:
          description: Mobile Money receiver details
          allOf:
            - $ref: '#/components/schemas/MobileMoneyReceiverDto'
        bankReceiver:
          description: Bank receiver details
          allOf:
            - $ref: '#/components/schemas/BankDto'
        lipaNaMpesaReceiver:
          description: Lipa na M-Pesa (Till/Buy Goods) receiver — Kenya only
          allOf:
            - $ref: '#/components/schemas/LipaNaMpesaReceiverDto'
        paybillReceiver:
          description: Paybill receiver — Kenya only
          allOf:
            - $ref: '#/components/schemas/PaybillReceiverDto'
        cryptoAmount:
          type: number
          description: The crypto amount
        currency:
          type: string
          description: Fiat currency (e.g. KES, GHS, SLE, TZS)
        chain:
          description: Chain
          allOf:
            - $ref: '#/components/schemas/Chain'
        token:
          description: Stable Coin or Token
          allOf:
            - $ref: '#/components/schemas/StableCoin'
        referenceId:
          type: string
          description: Reference ID
        senderAddress:
          type: string
          description: >-
            Sender address (optional - if not provided, will use integrator
            crypto wallet)
        callbackUrl:
          type: string
          description: Callback URL
        rateId:
          type: string
          description: Rate ID obtained from the /offramp/rate endpoint
        refund_config:
          description: >-
            Where to send a refund if the fiat disbursement fails. See the
            refunds guide.
          allOf:
            - $ref: '#/components/schemas/OfframpRefundConfigDto'
      required:
        - cryptoAmount
        - currency
        - chain
        - token
        - referenceId
    OfframpResponseDto:
      type: object
      properties:
        referenceId:
          type: string
          description: Reference ID
        fiatAmount:
          type: number
          description: Fiat amount
        fiatTransactionAmount:
          type: number
          description: Fiat transaction amount
        cryptoAmount:
          type: number
          description: Crypto amount
        fiatCurrency:
          type: string
          description: Fiat currency
        customerKey:
          type: string
          description: Customer key
        fiatWalletId:
          type: string
          description: Fiat wallet ID
        senderAddress:
          type: string
          description: Sender address
        transactionHash:
          type: string
          description: Transaction hash
        transactionHashAmount:
          type: number
          description: Transaction hash amount
        status:
          type: string
          description: Status
        onchainStatus:
          type: string
          description: Onchain status
        rate:
          type: object
          description: Rate
        escrowAddress:
          type: string
          description: Escrow address
        usingIntegratedWallet:
          type: boolean
          description: Whether using integrated crypto wallet flow
        created_at:
          format: date-time
          type: string
          description: Creation timestamp
        updated_at:
          format: date-time
          type: string
          description: Last update timestamp
        onchainError:
          type: object
          description: Onchain error details if the transaction failed
        transactionError:
          type: object
          description: Transaction error details if the transaction failed
      required:
        - referenceId
        - fiatAmount
        - fiatTransactionAmount
        - cryptoAmount
        - fiatCurrency
        - customerKey
        - fiatWalletId
        - senderAddress
        - transactionHash
        - transactionHashAmount
        - status
        - onchainStatus
        - rate
        - escrowAddress
    MobileMoneyReceiverDto:
      type: object
      properties:
        phoneNumber:
          type: string
          description: Phone number
        accountName:
          type: string
          description: Account name
        networkProvider:
          type: string
          description: >-
            Provider network (Check Payment Providers API for available
            networks)
          example: MTN, VODAFONE, AIRTEL, MPESA
      required:
        - phoneNumber
        - accountName
        - networkProvider
    BankDto:
      type: object
      properties:
        name:
          type: string
          description: Full name
        address:
          type: string
          description: Address
        phoneNumber:
          type: string
          description: >-
            Phone number of the bank account holder (optional — not used for the
            bank transfer itself)
        bankCode:
          type: string
          description: >-
            Bank code. Required for Kenya, use 0 for South Africa. Zero-pad as a
            string for Nigeria.
        bankName:
          type: string
          description: >-
            Bank name — required for South Africa (e.g. "FNB", "ABSA",
            "NEDBANK"). Not needed for Kenya.
          example: FNB
        accountNumber:
          type: string
          description: Account number
        country:
          type: string
          description: Country code (ISO-2 like KE, GH, NG or ISO-3 like KEN, GHA, NGA)
          example: KE
      required:
        - name
        - address
        - bankCode
        - accountNumber
        - country
    LipaNaMpesaReceiverDto:
      type: object
      properties:
        businessShortcode:
          type: string
          description: Till number (Business shortcode) to pay to
          example: '174379'
        accountReference:
          type: string
          description: Account reference (optional)
        transactionDesc:
          type: string
          description: Transaction description (optional)
      required:
        - businessShortcode
    PaybillReceiverDto:
      type: object
      properties:
        paybillNumber:
          type: string
          description: Paybill number to send payment to
          example: '400200'
        accountNumber:
          type: string
          description: Account number / reference the Paybill uses to identify the sender
          example: ACC123456
        remarks:
          type: string
          description: Transaction remarks (optional)
      required:
        - paybillNumber
        - accountNumber
    Chain:
      type: string
      enum:
        - ETHEREUM
        - CELO
        - AVALANCHE
        - POLYGON
        - ARBITRUM
        - OPTIMISM
        - BINANCE
        - STELLAR
        - TRON
        - FUSE
        - LIGHTNING
        - SOLANA
        - PROVENANCE
        - CARDANO
        - HEDERA
        - BASE
        - LISK
        - VICTION
        - SCROLL
      description: The chain of the wallet.Its required if the wallet is a crypto wallet
    StableCoin:
      type: string
      enum:
        - CUSD
        - USDC
        - USDT
        - USDT0
        - SAT
        - BTC
        - HASH
        - FUSE
        - HBAR
        - USDGLO
        - CKES
        - CGHS
        - MSAT
        - XLM
        - ADA
      description: The currency of the wallet
    OfframpRefundConfigDto:
      type: object
      properties:
        bolt11:
          type: string
          description: >-
            Pre-generated bolt11 refund invoice, paid directly if a refund is
            triggered.
          example: lnbc1500n1p0xyz...
        payment_hash:
          type: string
          description: >-
            Payment hash of the bolt11 invoice — used to detect if the invoice
            was already paid.
          example: a1b2c3d4e5f6...
        amount_msat:
          type: number
          description: >-
            Invoice amount in millisatoshis. Must exactly match the crypto
            amount refunded.
          example: 150000000
        expires_at:
          type: string
          description: >-
            ISO 8601 expiry of the bolt11 invoice. Kotani refreshes it via
            generate_invoice_url once past.
          example: '2024-11-22T13:00:00Z'
        generate_invoice_url:
          type: string
          description: >-
            URL Kotani POSTs to for a fresh bolt11 when the stored one expires.
            See the refunds guide.
          example: https://api.yourapp.com/lightning/generate-refund-invoice
        address:
          type: string
          description: >-
            Fallback on-chain refund address for non-Lightning chains. Must
            match the transaction chain.
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
  securitySchemes:
    JWT:
      scheme: bearer
      bearerFormat: JWT
      type: http

````