# Quickstart and Wallet Balance API

Start here when you’re connecting an app to SIMcloud for the first time. The wallet balance request uses your API token to read the last balance stored for your account in rand. It gives you a way to check that authentication works without placing an order.

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

GET /api/balance.php

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

## Read the wallet balance

In the portal sidebar, open API → Get Token. Use Current token or ask the account owner to generate a token. Set SIMCLOUD_API_TOKEN in your shell. The response gives the authenticated account’s stored last known balance in rand. Check updated_at where present before using that balance to make a decision.

### GET /api/balance.php

```bash
curl -4 -sS -i "${SIMCLOUD_API_BASE:-https://simcloud.co.za}/api/balance.php" \
  -H "Authorization: Bearer $SIMCLOUD_API_TOKEN"
```

HTTP 200 response excerpt

```json
{
  "status": "success",
  "balance": 500.25
}
```

> Store tokens server-side or in a secret manager. The example’s balance is synthetic.

## Set up and handle responses

The examples default to https://simcloud.co.za over IPv4 and use SIMCLOUD_API_BASE for a separately configured test environment. Replace YOUR_… fields, example references and any referenced shell variables with values for the intended account. The write examples can create an account, send an SMS or spend wallet funds once filled in.

1. Send application/json on REST POSTs. Read both the HTTP status and the response status or message.
2. A missing or invalid token normally returns HTTP 401. Read-only GET requests can be retried with backoff on temporary errors. Use Retry-After when supplied.
3. After an uncertain POST, check the original request or account history before attempting another write. Keep the original identifiers.

## Find the machine-readable API contract

Read the OpenAPI YAML or JSON for request and response schemas. The API index lists the service guides with links to HTML and Markdown. The AI setup guides document MCP separately.

- [OpenAPI YAML](https://simcloud.co.za/api/openapi.yaml)
- [OpenAPI JSON](https://simcloud.co.za/api/openapi.json)
- [Markdown reference index](https://simcloud.co.za/api/llms.txt)
