Credits
Read the credit balance and ledger, what every API call costs, and the credits.low webhook.
There is one credit balance per workspace and channel. Transactional sends, campaign messages, test sends and retries all spend from it. The API adds no meter and no surcharge: the price of a delivery is the price of a delivery. See Credits and billing for how the monthly allowance and top-ups work.
| Operation | Scope | Rate class |
|---|---|---|
GET /v1/credits | credits:read | read |
GET /v1/credits/transactions | credits:read | read |
Both read the workspace the key belongs to. Test API keys are refused.
Balance
curl https://api.messagepipe.dev/v1/credits \
-H "Authorization: Bearer mp_live_xxxxxxxxxxxxxxxx"{
"data": [
{ "channel": "email", "monthly_remaining": 1840, "topup_balance": 0, "total": 1840 },
{ "channel": "sms", "monthly_remaining": 0, "topup_balance": 0, "total": 0 }
]
}One entry per bucket: email, sms, push, chat, and the managed buckets email_managed and
sms_managed. The balance is the live counter that sends spend from. It is rebuilt from the database
if the cache is flushed, so a figure read in the instant after a flush can briefly differ from the
ledger.
Ledger
GET /v1/credits/transactions lists grants, top-ups, refunds and adjustments, newest first. Filter
with channel, page with before (an RFC 3339 timestamp, from next_before) and limit (1 to 200,
default 50).
Per-message spend is not a ledger row. It is the send itself: read it from GET /v1/sends, and for
a campaign from its report (GET /v1/campaigns/{id}/report).
What each call costs
| Call | Credits |
|---|---|
POST /v1/{channel}/send, send-bulk | 1 per accepted message (unchanged). A managed SMS costs segments times the destination's credit weight. |
POST /v1/sends/{id}/retry | 1, as a new send |
POST /v1/campaigns/{id}/start and resume | 1 per recipient message, as the campaign sends; refunded if a message cannot be queued |
POST /v1/campaigns/{id}/test-send | 1 per test recipient |
| A recipient who is suppressed or has no valid consent | 0 |
| Pre-flight, previews, counts, samples, drafts, templates, imports, forms, settings, reads | 0 |
Campaign email is taken from the email bucket, or from email_managed for a brand that sends
through managed email.
Running out
- A transactional send with no credits is
402 credits_exhausted. - A campaign
startwith a zero balance is refused with theno_creditspre-flight problem (400 validation_failed); with a shortfall it starts with acredits_shortwarning and pauses withpause_reason: credits_exhaustedwhen the balance reaches zero. Add credits, thenresume.
Webhooks: know before it runs out
Two webhook events mean an automated client does not need to poll:
credits.low, when a debit takes a channel's balance from above the threshold to at or below it. It fires on the crossing, once, not on every debit after it.campaign.paused, withreason: credits_exhaustedwhen that is why.
The credits.low threshold is, by default, 10% of the channel's monthly quota or 100 credits,
whichever is higher, but never more than the quota itself (so a small plan is warned at its quota).
A workspace owner or admin can set its own with credits_low_threshold in PATCH /v1/workspace-settings (a key needs audience:admin); null goes back to the default. A refund or
top-up that lifts the balance back over the line re-arms the event.