MessagePipedocs
API Reference

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.

OperationScopeRate class
GET /v1/creditscredits:readread
GET /v1/credits/transactionscredits:readread

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

CallCredits
POST /v1/{channel}/send, send-bulk1 per accepted message (unchanged). A managed SMS costs segments times the destination's credit weight.
POST /v1/sends/{id}/retry1, as a new send
POST /v1/campaigns/{id}/start and resume1 per recipient message, as the campaign sends; refunded if a message cannot be queued
POST /v1/campaigns/{id}/test-send1 per test recipient
A recipient who is suppressed or has no valid consent0
Pre-flight, previews, counts, samples, drafts, templates, imports, forms, settings, reads0

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 start with a zero balance is refused with the no_credits pre-flight problem (400 validation_failed); with a shortfall it starts with a credits_short warning and pauses with pause_reason: credits_exhausted when the balance reaches zero. Add credits, then resume.

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, with reason: credits_exhausted when 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.