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

# Purchase Data

> Purchase data bundle for a phone number

## Overview

Purchase a data bundle for any Nigerian phone number using a specific product code. The data will be credited instantly to the recipient's phone.

## Request Body

Send an array with one or more data purchases.

<RequestField name="phoneNumber" type="string" required>
  Recipient phone number. Accepted formats: `08012345678` (11 digits), `2348012345678` (international), or `8012345678` (10 digits). All are normalized to the 11-digit local format.
</RequestField>

<RequestField name="productCode" type="string" required>
  Product code from the data catalog.
</RequestField>

<RequestField name="voucherCode" type="string" required>
  Voucher code from the data catalog.
</RequestField>

<RequestField name="network" type="string">
  Network returned by the data catalog.
</RequestField>

<RequestField name="amount" type="number">
  Amount returned by the data catalog.
</RequestField>

## Response Fields

<ResponseField name="requestReference" type="string">
  Reference to store for reconciliation and support.
</ResponseField>

<ResponseField name="data" type="object">
  Details of the accepted batch.

  <Expandable title="data">
    <ResponseField name="message" type="string">
      Confirmation that the request was accepted for processing.
    </ResponseField>

    <ResponseField name="references" type="array">
      One reference per item in the submitted batch. Store these to reconcile or requery individual purchases.
    </ResponseField>
  </Expandable>
</ResponseField>

## Status Codes

| Code  | Meaning                                                                                                                                                                                |
| ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `202` | Batch accepted for processing. Data is credited within a few seconds; use each reference in `data.references` to track individual items.                                               |
| `400` | The request could not be processed. Common causes: invalid payload, empty body, or the supplied `productCode` was not found in the data catalog.                                       |
| `422` | Your organisation is not yet configured for vending, or an individual item in the batch could not be posted.                                                                           |
| `503` | Data vending is temporarily unavailable. Retry after a short delay. If you specified a `voucherCode` tied to a specific server, try again without one so the other server can be used. |

## Purchase Flow

1. **Get Available Plans**: First, call the [List Data Plans](/api-reference/endpoint/datalist) endpoint to see available data plans for a specific network
2. **Select Product Code**: Choose the desired data plan and note its `ProductCode`
3. **Purchase Data**: Submit the selected plan details exactly as returned by the catalog

## Notes

* Data is credited instantly to the recipient's phone
* Phone numbers are accepted as `080...`, `23480...`, or `80...` and normalized to the 11-digit local format; non-Nigerian mobile numbers are rejected before any charge
* Product codes and voucher codes are case-sensitive
* Transaction processing may take a few seconds
* Ensure the phone number is on the correct network for the data plan
* Store the `requestReference` returned by the API for reconciliation and support


## OpenAPI

````yaml POST /purchaseData
openapi: 3.0.3
info:
  title: Bleeprs API Specification 0.1
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.bleeprs.com/api
security:
  - bearerAuth: []
paths:
  /purchaseData:
    post:
      tags:
        - Vending
      summary: Purchase Data
      description: >-
        Purchase a data bundle for one or more Nigerian phone numbers. Submit
        the selected plan details as returned by the data catalog.
      operationId: purchaseData
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  phoneNumber:
                    type: string
                    description: >-
                      Recipient's phone number. Accepted as 08012345678,
                      2348012345678, or 8012345678 — normalized to the 11-digit
                      local format.
                    example: '08107176819'
                  productCode:
                    type: string
                    description: Product code returned by the Data catalog
                    example: MTN_DATA_PRODUCT_CODE
                  network:
                    type: string
                    description: Target network returned by the Data catalog
                    example: MTN
                  voucherCode:
                    type: string
                    description: Voucher code returned by the Data catalog
                    example: MTN_DATA_VOUCHER_CODE
                  amount:
                    type: number
                    description: Amount returned by the Data catalog
                    example: 1000
                  dataValue:
                    type: number
                    description: Data value returned by the Data catalog, when provided
                    example: 1024
                required:
                  - phoneNumber
                  - productCode
                  - voucherCode
                  - network
              minItems: 1
              default:
                - phoneNumber: '08107176819'
                  productCode: MTN_DATA_PRODUCT_CODE
                  voucherCode: MTN_DATA_VOUCHER_CODE
                  network: MTN
                  amount: 1000
      responses:
        '202':
          description: >-
            Batch accepted for processing. Data is credited within a few
            seconds; use each reference in data.references to track individual
            items.
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '00'
                  gatewayMessage:
                    type: string
                    example: Successfully Processed
                  requestReference:
                    type: string
                    example: KpEAFZutv3SvQ4aMjrv7
                  data:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Vending Request successful
                      references:
                        type: array
                        items:
                          type: string
                        example:
                          - bpr_req_a1b2c3d4e5f6
        '400':
          description: >-
            The request could not be processed. Common causes: invalid payload,
            empty body, or the supplied productCode was not found in the data
            catalog.
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '88'
                  gatewayMessage:
                    type: string
                    example: Unsucessfull
                  requestReference:
                    type: string
                    example: bpr_req_a1b2c3d4e5f6
                  data:
                    type: string
                    example: Data bundle for MTN_DATA_PRODUCT_CODE not found
        '422':
          description: >-
            Your organisation is not yet configured for vending, or an
            individual item in the batch could not be posted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '88'
                  gatewayMessage:
                    type: string
                    example: Unsucessfull
                  requestReference:
                    type: string
                    example: bpr_req_a1b2c3d4e5f6
                  data:
                    type: string
                    example: Vending account not configured
        '503':
          description: >-
            Data vending is temporarily unavailable. Retry after a short delay.
            If you specified a voucherCode tied to a specific server, try again
            without one so the other server can be used.
          content:
            application/json:
              schema:
                type: object
                properties:
                  gatewayStatus:
                    type: string
                    example: '88'
                  gatewayMessage:
                    type: string
                    example: Unsucessfull
                  requestReference:
                    type: string
                    example: bpr_req_a1b2c3d4e5f6
                  data:
                    type: string
                    example: >-
                      Data vending is temporarily unavailable across all
                      servers. Please try again later.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````