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

# Buy Airtime

> Send airtime to a specified recipient.



## OpenAPI

````yaml POST /v1/airtime
openapi: 3.0.1
info:
  title: Delaphone CPaaS API
  description: APIs for sending SMS, purchasing data bundles, and buying airtime.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.delaphonegh.com
security:
  - bearerAuth: []
paths:
  /v1/airtime:
    post:
      description: Send airtime to a specified recipient.
      requestBody:
        description: Airtime purchase details.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AirtimePurchaseRequest'
        required: true
      responses:
        '200':
          description: Airtime sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirtimePurchaseResponse'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error401'
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error402'
        '403':
          description: Insufficient Permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error403'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
components:
  schemas:
    AirtimePurchaseRequest:
      type: object
      required:
        - recipient_phone
        - recipient_network
        - amount
      properties:
        recipient_phone:
          description: Phone number of the recipient in E.164 format
          type: string
        recipient_network:
          description: Network of the recipient
          type: string
        amount:
          description: Amount of airtime to be sent
          type: string
        reference:
          description: Unique reference for the transaction
          type: string
        webhook_url:
          description: URL to receive status updates
          type: string
    AirtimePurchaseResponse:
      type: object
      properties:
        transaction_id:
          description: Unique identifier for the airtime purchase
          type: string
        status:
          description: Status of the airtime purchase
          type: string
    Error:
      required:
        - error
        - message
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          properties:
            status:
              type: integer
              format: int32
            title:
              type: string
              example: Invalid Request Value
            detail:
              type: string
    Error401:
      required:
        - error
        - message
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          properties:
            status:
              type: integer
              format: int32
              example: 401
            title:
              type: string
              example: Authentication failed
              description: 'Title of the error (default: Authentication failed)'
            detail:
              type: string
    Error402:
      required:
        - error
        - message
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          properties:
            status:
              type: integer
              format: int32
              example: 402
            title:
              type: string
              example: Payment Required
              description: 'Title of the error (default: Payment Failed)'
            detail:
              type: string
    Error403:
      required:
        - error
        - message
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          properties:
            status:
              type: integer
              format: int32
              example: 403
            title:
              type: string
              example: Insufficient permissions
              description: 'Title of the error (default: Authentication failed)'
            detail:
              type: string
    Error404:
      required:
        - error
        - message
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          properties:
            status:
              type: integer
              format: int32
              example: 404
            title:
              type: string
              example: Not found
              description: The requested resource was not found
            detail:
              type: string
              example: The requested resource was not found
    Error500:
      required:
        - error
        - message
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          properties:
            status:
              type: integer
              format: int32
              example: 500
            title:
              type: string
              example: Internal server error
              description: 'Title of the error (default: Authentication failed)'
            detail:
              type: string
              example: >-
                We could not fulfil your request. Kindly try again in a few
                moments
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````