Errors
Errors use the same envelope shape as Meta's Cloud API, so a client that already handles Cloud API errors keeps working. There are two sources:
Meta's errors, passed through
If Meta rejects a request — a bad payload, a rate limit, an unapproved template — that error is forwarded to youuntouched, with Meta's own type, code, and message. Handle these exactly as you would calling Meta directly.
kirim.dev's own errors
Failures that never reach Meta — authentication, billing, throughput — carry a Kirim* type so you can tell them apart from Meta's, while keeping the familiar envelope:
error envelope
{
"error": {
"message": "This account has no active subscription. Subscribe in the dashboard.",
"type": "KirimBillingException",
"code": 402
}
}| HTTP | type | When |
|---|---|---|
| 401 | — | Missing or invalid API key. |
| 402 | KirimBillingException | No active subscription for this account. |
| 404 | KirimRoutingException | Unknown or unsupported route, or an account you do not own. |
| 413 | KirimRequestTooLarge | Request body exceeds the size limit. |
| 422 | KirimAccountException | The number is not connected yet. |
| 429 | KirimThrottleException | Sending too fast for this number; retry after the given delay. |
| 502 | KirimUpstreamException | Could not reach Meta. The request was not sent. |
| 503 | KirimUpstreamException | Temporarily unable to serve the request. |
On a 429, respect the Retry-After header — the limiter paces you below Meta's ceiling so your sends are not rejected mid-campaign.