Message spend by API key
Requires api_keys:read and wallet_read. Returns net recorded spend after discounts for successful wallet-paid messages, excluding bundles and grants. Defaults to the calling key and preserves sender restrictions. Balances, subscriptions and top-ups are account-wide. Key names are safe; secret credentials are never returned. Legacy unlinked messages remain unattributed.
When to use it. Reconcile spend with wallet reports for the same key and period. For one day, use equal start/end dates.
Code example
Correct: Store spend for a month
curl --request GET 'https://raselsms.com/api/v2/account/wallet/spend-report?month=2026-11' \--header 'X-API-Key: YOUR_API_KEY'Response example
200 — Store spend for a month
{ "success": true, "data": { "period": { "fromDate": "2026-11-01", "toDate": "2026-11-30", "timezone": "Asia/Damascus" }, "filters": { "apiKeyId": "6800abc123def4567890fedc", "channel": null, "messageType": null }, "apiKey": { "id": "6800abc123def4567890fedc", "name": "Online store", "revoked": false, "deleted": false }, "currency": "USD", "coverage": "successful_wallet_paid_messages", "senderScope": "all", "totals": { "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 }, "monthly": [ { "key": "2026-11", "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 } ], "byChannel": [ { "key": "sms_syria", "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 } ], "byMessageType": [ { "key": "utility", "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 } ] }}HTTP request
GET /api/v2/account/wallet/spend-report
Request Headers
| Header | Type | Description |
|---|---|---|
| X-API-Key | string | Your Rasel API key. Send it on every documented request except inbound webhooks. * |
Query parameters
| Field | Type | Description |
|---|---|---|
| apiKeyId | string | An owned key ID, all, or unattributed. Defaults to the current key. Never send the secret value here. |
| month | string | YYYY-MM; use month OR both start/end dates, never both. |
| fromDate | string | Inclusive start date filter (YYYY-MM-DD). |
| toDate | string | Inclusive end date filter (YYYY-MM-DD). |
| channel | all | whatsapp_user_session | whatsapp_web | whatsapp_official | telegram_verifyway | telegram_bot | sms_twilio | sms_clicksend | sms_syria | sms_taqnyat | email_system | email_user | Delivery channel. For unified send prefer auto, local_sms, int_sms, official_whatsapp, WhatsApp Web sessions, telegram_bot, or email_user. For verification omit the field for automatic selection; do not send bare sms, whatsapp, or auto. |
| messageType | all | otp | utility | marketing | free_text | Message classification: otp, utility, marketing, or free_text. |
Response Fields
| Field | Type | Description | Example |
|---|---|---|---|
| success | boolean | True when the operation succeeded, or when at least one batch recipient succeeded. | |
| data | object | Primary payload for list and snapshot endpoints. | |
| data.period | object | Inclusive period in the report timezone. | |
| data.period.fromDate | string | Inclusive start date filter (YYYY-MM-DD). | |
| data.period.toDate | string | Inclusive end date filter (YYYY-MM-DD). | |
| data.period.timezone | string | Timezone for day boundaries and monthly grouping. | |
| data.filters | object | Filters applied to message spend. | |
| data.filters.apiKeyId | string | Database key reference, never the secret credential. null means all sources; unattributed means unlinked history. | |
| data.filters.channel | string | Delivery channel. For unified send prefer auto, local_sms, int_sms, official_whatsapp, WhatsApp Web sessions, telegram_bot, or email_user. For verification omit the field for automatic selection; do not send bare sms, whatsapp, or auto. | |
| data.filters.messageType | string | Message classification: otp, utility, marketing, or free_text. | |
| data.apiKey | object | Selected key name and status, or null for all sources or a key not found in the account. | |
| data.apiKey.id | string | Resource identifier. | |
| data.apiKey.name | string | Display name or lowercase template identifier, depending on the endpoint. | |
| data.apiKey.revoked | boolean | Whether the key is revoked; historical spend remains available. | |
| data.apiKey.deleted | boolean | Whether the key was deleted while historical usage remains. | |
| data.currency | enum | Currency of the balance and the cost, matching the wallet. | |
| data.coverage | string | Coverage: successful wallet-paid messages, excluding bundles and free grants. | |
| data.senderScope | enum | all or selected according to the calling key sender restrictions. | |
| data.totals | object | Spend, message and unit totals for the selected period and filters. | |
| data.totals.spendUsd | number | Net spend in USD after discounts recorded at send time. | |
| data.totals.messageCount | integer | Recorded message count; in spend reports this differs from SMS unit count. | |
| data.totals.segmentCount | integer | Billed unit count; one SMS message may contain several units. | |
| data.totals.averageMessageCostUsd | number | Average USD cost per message; zero when no messages exist. | |
| data.monthly | json | Spend grouped by month; keys use YYYY-MM. | |
| data.byChannel | json | Spend grouped by channel. | |
| data.byMessageType | json | Spend grouped by message type. |
Status Codes
| Status | Description |
|---|---|
| 200 | Success. |
| 400 | Invalid request, validation error, or the resource cannot be used in this state. |
| 401 | Missing or invalid API key. |
| 403 | Phone not verified, missing permission, or the account cannot perform this action. |
| 429 | Rate limit exceeded, or the maximum number of verification attempts was reached. |
| 500 | Report unavailable. |
| 413 | Request body exceeds the size limit. |
Try it
Parameters
An owned key ID, all, or unattributed. Defaults to the current key. Never send the secret value here.
YYYY-MM; use month OR both start/end dates, never both.
Inclusive start date filter (YYYY-MM-DD).
Inclusive end date filter (YYYY-MM-DD).
Delivery channel. For unified send prefer auto, local_sms, int_sms, official_whatsapp, WhatsApp Web sessions, telegram_bot, or email_user. For verification omit the field for automatic selection; do not send bare sms, whatsapp, or auto.
Message classification: otp, utility, marketing, or free_text.
Request
GET /api/v2/account/wallet/spend-report?month=2026-11&fromDate=2026-11-01&toDate=2026-11-01&channel=sms_syria&messageType=allResponse
Example response
{ "success": true, "data": { "period": { "fromDate": "2026-11-01", "toDate": "2026-11-30", "timezone": "Asia/Damascus" }, "filters": { "apiKeyId": "6800abc123def4567890fedc", "channel": null, "messageType": null }, "apiKey": { "id": "6800abc123def4567890fedc", "name": "Online store", "revoked": false, "deleted": false }, "currency": "USD", "coverage": "successful_wallet_paid_messages", "senderScope": "all", "totals": { "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 }, "monthly": [ { "key": "2026-11", "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 } ], "byChannel": [ { "key": "sms_syria", "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 } ], "byMessageType": [ { "key": "utility", "spendUsd": 0.8, "messageCount": 2, "segmentCount": 4, "averageMessageCostUsd": 0.4 } ] }}