# Data API

The Data API lets your app offer mobile data bundles and order one for a recipient. Read the current catalogue for the chosen network before ordering. After a recharge is queued, check its status with the original request ID.

[Web guide](https://simcloud.co.za/docs/guide/data-api/)

GET /api/data.php · POST /api/data.php

[API reference](https://simcloud.co.za/api/data.html)

## List data products

GET without an order identifier lists the configured data catalogue. Use products=1 and optionally network. Look up the current sellvalue for the recipient’s network before ordering. Each product includes its network, amount and bundle description.

### GET /api/data.php

```bash
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/api/data.php" \
  -H "Authorization: Bearer $SIMCLOUD_API_TOKEN" \
  --get \
  --data-urlencode 'products=1' \
  --data-urlencode 'network=vodacom'
```

HTTP 200 response excerpt

```json
{
  "status": "success",
  "service": "data"
}
```

## Place a data order

Send msisdn, the published network code, amount matching an active bundle’s sell value, and your reference. The example uses R25 as a synthetic catalogue value. Check the current catalogue for the value you intend to send. The API also accepts sellvalue as an alias for amount. Save request_id on HTTP 201.

1. A duplicate within the five-minute window can return 409. Check the earlier request before resubmitting.
2. If the current bundle or amount is rejected, refresh the catalogue. Balance errors can include required_balance and available_balance.

### POST /api/data.php

```bash
curl -4 -sS -i -X POST "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/api/data.php" \
  -H "Authorization: Bearer $SIMCLOUD_API_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{
  "msisdn": "YOUR_LOCAL_CELL",
  "network": "pd-vodacom",
  "amount": 25,
  "reference": "DOCS-DATA-01"
}'
```

HTTP 201 response excerpt

```json
{
  "status": "success",
  "service": "data",
  "queue_status": "queued"
}
```

## Query a data order

Set SIMCLOUD_DATA_ID to the request_id from placement, or query by the allocated orderno. Without either identifier the endpoint returns the catalogue. Check for delivered or failed before treating the recharge as final.

### GET /api/data.php

```bash
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/api/data.php" \
  -H "Authorization: Bearer $SIMCLOUD_API_TOKEN" \
  --get \
  --data-urlencode "request_id=$SIMCLOUD_DATA_ID"
```

HTTP 200 response excerpt

```json
{
  "status": "queued"
}
```
