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

# Purchase Data

> Purchase Data



## OpenAPI

````yaml POST /api/v1/data/buy
openapi: 3.1.0
info:
  title: Dancity API
  description: >-
    Paths below match the server base URL + global prefix `api`. Merchant:
    `Authorization: Bearer dcy_live_...` and `channel: API`. App: JWT. See
    Guides for flows.
  version: 1.0.0
servers:
  - url: https://api.dancity.app
    description: Production
  - url: http://localhost:6565
    description: Local development
security: []
tags:
  - name: VAS
    description: >-
      Merchant API (`/api/v1`): catalog GETs (wallet, services, products, plans)
      and purchase routes; `channel: API` on POST buys; app education & betting
      where listed
  - name: Products & services
    description: 'Catalog GETs: all services; products and plans with optional query filters'
  - name: Wallet
    description: Get wallet by id (JWT)
  - name: Transactions
    description: Fetch your transactions and requery one by id for current status
  - name: Betting
    description: Betting funding
  - name: Education
    description: Education pins
  - name: eSIM
    description: eSIM catalog and purchase
  - name: Webhook
    description: Outbound events Dancity POSTs to your configured HTTPS URL
paths:
  /api/v1/data/buy:
    post:
      tags:
        - VAS
      summary: Purchase Data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - plan
                - phone
              properties:
                plan:
                  type: string
                  description: >-
                    Plan id from GET /api/v1/plans/data (`planId` field) or
                    Mongo _id
                  example: 40GB_MTN_GIFTING_1Day
                phone:
                  type: string
                  example: 080*******
                wallettype:
                  type: string
                  description: Wallet type to debit. Defaults to main when omitted.
                  example: main
                  default: main
                customerRef:
                  type: string
                  example: DATA-REF-001
      responses:
        '200':
          description: OK
          content:
            application/json:
              example:
                success: true
                message: Data purchase processed
                data:
                  _id: 6a1c3cf26da239b6da0e26dc
                  tranxId: DNTY506236YALLPF
                  service: DATA
                  product: MTN GIFTING
                  tranxType: DEBIT
                  status: FAILED
                  currency: NGN
                  remarks: MTN GIFTING 40MB for 1 Day
                  amount: 50
                  fee: 0
                  amountPaid: 50
                  balanceBefore: 5276
                  balanceAfter: 5226
                  number: '09015665451'
                  customerRef: DATA-REF-001
                  channel: API
                  paymentMedium: MAIN WALLET
                  tranxDate: '2026-05-31T13:51:46.236Z'
                  apiResponse: >-
                    Sorry, you are not allowed to migrate to Betamix Bundle Mini
                    Plan. Thank you! — Oh dear! It seems xxxxxxxxxxx is not
                    eligible for this bundle. Please select a new bundle and try
                    again
                  isReversal: false
                  quantity: 0
                  createdAt: '2026-05-31T13:51:46.238Z'
        '400':
          description: Bad request
          content:
            application/json:
              example:
                success: false
                message: Validation failed
                statusCode: 400
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                success: false
                message: Invalid API key or IP not allowlisted
                statusCode: 401
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                success: false
                message: Sorry, something went wrong. Please try again later
                statusCode: 500
      security:
        - DancityApiKey: []
components:
  securitySchemes:
    DancityApiKey:
      type: http
      scheme: bearer
      bearerFormat: dcy_live_...
      description: Merchant API key from the Dancity dashboard.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.