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: MTN, TELECEL, or AT. Legacy values are also accepted: 1=MTN, 6=Telecel, 7=AT. |
| 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 to pay for the data bundle. |
| 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
}
```
## Before you begin
Before using the Airtime or Data Sales APIs, you must create a Sell on Our Platform Service in the Moolre App.
[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. |