Data API

Environment: Live

Sell a network-specific data bundle from a wallet using its bundle ID, not an amount. Use a unique reference per wallet and check pending or uncertain outcomes with Sales Status.

# Data API

Send a data bundle to a recipient on MTN, Telecel, or AT, paid from the wallet identified by accountnumber. Choose a bundle that Bundles lists for the selected network. Its price is the amount charged; do not send amount. Use a unique external reference per wallet for each new sale.

## Endpoint
- **Method**: POST
- **URL**: https://api.moolre.com/open/sales/data

## Headers
| Header | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| Content-Type | string | Yes | Send application/json. |
| X-API-USER | string | Yes | Your Moolre username. |
| X-API-KEY | string | Yes | Your Private API Key for the paying wallet. |

## Request Body
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| type | integer | Yes | Data sale function. Must be 1. |
| channel | string | Yes | Recipient network. Send the channel name (case-insensitive). The numeric ids still work but are deprecated and return a notice. Values: `MTN` MTN Mobile Money (deprecated id 1); `TELECEL` Telecel Cash (deprecated id 6); `AT` AT Money (deprecated id 7). |
| receiver | string | Yes | Phone number receiving the data bundle. |
| bundle | string | Yes | Bundle ID returned by Bundles for the selected channel network. The bundle price determines the charge. |
| currency | string | Yes | Sale currency. Must be GHS. |
| accountnumber | string | Yes | Moolre wallet account number that pays for the data bundle. Must be linked to your Sell on Our Platform Service. |
| externalref | string | Yes | Unique reference per wallet for this sale. The API also accepts extid as an alternative field name; send only one. Examples and this form use externalref. |
| reference | string | No | Optional narration for the sale. |

## Response (200 In progress (ASL11))
The sale is in progress. This example is not confirmation of data bundle delivery.

```json
{
  "status": "1",
  "code": "ASL11",
  "message": "Data sale in progress, please check its status.",
  "data": {
    "txstatus": 0,
    "receiver": "233240000000",
    "transactionid": "Pending",
    "externalref": "your-extid",
    "amount": "3.00"
  },
  "go": null,
  "meta": {
    "requestid": "req_c68f4c66115c26725c796242",
    "notices": []
  }
}
```

## Before you begin

Before using the Airtime or Data Sales APIs, you must create a Sell on Our Platform Service in the Moolre App.

**Use a linked wallet:** The accountnumber you send in every Sales request must be a Moolre wallet linked to your Sell on Our Platform Service. Requests using a wallet that is not linked to a sales service will not work.

[Open the Moolre App](https://app.moolre.com/).

## Special payment pricing

Special payment pricing is available for businesses that want to sell airtime and data. Contact Moolre Support to request this pricing.

[Contact Moolre Support](mailto:hello@moolre.com?subject=Airtime%20and%20Data%20Sales%20pricing).

## Bundle selection and pricing

Use a bundle ID returned by Bundles for the selected channel network. The bundle price determines the amount charged to the wallet. Do not send an amount parameter.

[Use the Bundles API](https://docs.moolre.com/api/sales/bundles) to look up bundle IDs, current prices, and validity for the selected network.

## Handle pending and uncertain sales

ASL11 means the sale is in progress, not that the data bundle has been delivered. ASL06 is an uncertain outcome: the sale may still have gone through. Check the sale status before retrying; do not generate a new external reference to resubmit a pending or uncertain sale.

Check the sale using /open/sales/status with type 1, the paying wallet accountnumber, idtype 1, and id set to the original externalref (or extid). Only sales belonging to that wallet are searched.

[Open Sales Status](https://docs.moolre.com/api/sales/status) for identifier types, recorded sale details, refunds, and outcome codes.

Other replies from the sales server are returned unchanged; handle unlisted codes without assuming delivery succeeded.

## Data application codes

Data uses the Airtime application codes plus ASL14 and ASL15. These meanings are not HTTP status codes or guaranteed exact response messages. ASL01 is inherited from the shared Sales code catalogue; Data requests still must not send amount.

| Code | Meaning | Next step |
| --- | --- | --- |
| ASL11 | Sale in progress; no final reply yet. | Check the sale status before treating the top-up as complete or submitting again. |
| ASL00 | Authentication error. | Check the API user and private API key for the wallet. |
| ASL01 | Amount missing or below GHS 1.00. | Data requests do not send amount. Check bundle selection and contact support if this shared Sales code persists. |
| ASL02 | Receiver missing. | Provide the recipient phone number. |
| ASL03 | Incomplete request. | Check all required request fields. |
| ASL04 | Channel not supported. | Use MTN, TELECEL, or AT, or the corresponding legacy value 1, 6, or 7. |
| ASL05 | Type invalid. | Send type 1. |
| ASL06 | Unknown error; the sale may still have gone through. | Confirm the sale status before any retry. Do not generate a new reference to resubmit an uncertain sale. |
| ASL08 | External reference missing or already used. | Use a unique reference per wallet for a new sale. Check the original sale before attempting a duplicate. |
| ASL09 | Currency is not GHS. | Send currency GHS. |
| ASL10 | Wallet currency not supported. | Use a wallet with a supported currency for this GHS sale. |
| ASL12 | Wallet inactive. | Check the wallet activation state. |
| ASL13 | Account number not found. | Check the paying wallet account number. |
| ASL14 | Bundle missing. | Provide a bundle ID returned by Bundles for the selected network. |
| ASL15 | Bundle not sold on this network. | Use a bundle ID that Bundles lists for the selected channel network. |

## Fields every response can carry

These fields are additive: existing fields keep their names, order and types.

| Field | Meaning |
| :--- | :--- |
| meta | Always present, last in the object. meta.replayed is true only when the response is the stored answer to a repeated Idempotency-Key (absent otherwise). meta.requestid is the unique id of the request (also the X-Request-Id response header): quote it when you contact support. meta.notices is always an array, empty when there is nothing to report; each notice is { code, message, docs? }, for example that a deprecated way of sending credentials was used. See [Deprecations](https://docs.moolre.com/guides/deprecations). |

There is no outcome field. Decide the result from status, code and, on payment and transfer endpoints, data.txstatus (0 pending, 1 succeeded, 2 failed). These codes mean the result is unknown and may still succeed, so treat them as pending and check the status: PY01, PY02, TR01, TR02, TP11, TP18, APY10, APY16, ASL06, IS30, SYS500. Status 1 with TR08, OBGH01, OTGH01, OBNG01, GHQ03 or OM03 is final success; any other status 1 is an accepted, unfinished request.

Send X-Moolre-Http-Status: strict to receive real HTTP status codes (400, 401, 403, 404, 409, 422, 429, 5xx) instead of HTTP 200. See [Responses and request IDs](https://docs.moolre.com/guides/responses).

Back to the Moolre AI documentation index