Error Handling Library
Every error the Dripcel API returns, with its HTTP status, error.code and error.message, and how to fix the common ones.
What an error looks like
An unsuccessful request gets a 4xx or 5xx status and a JSON body with ok: false and an error field. Depending on where the request failed, error takes one of three shapes:
| Shape | Example | Returned for |
|---|---|---|
| A string | "Campaign not found" | Most errors. There is no error.code: use the HTTP status and the message. |
| An object | { "code": "rate_limit_exceeded", "message": "Rate limit exceeded", ... } | Rate limits, API key access, sales, exchange transactions and call outcomes. Most have a message, some extra fields. |
| A validation issue | { "code": "invalid_enum_value", "path": ["country"], "message": "...", ... } | A request body that doesn't match the endpoint's fields. See Validation errors. |
In the tables on this page, — in the error.code column means error is a plain string, and "none" means error is an object without that field. <id> and similar stand for a value from your request.
Handle all three shapes:
const response = await fetch("https://api.dripcel.com/send/sms", {
method: "POST",
headers: {
Authorization: "Bearer <key>",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
const body = await response.json();
if (!body.ok) {
const { error } = body;
// A string error has no code
const code = typeof error === "string" ? undefined : error.code;
const message =
typeof error === "string" ? error : error.message ?? JSON.stringify(error);
console.error(response.status, code, message);
}
Many messages include the ID or field involved, like Campaign not found: 64f1c0..., so they differ between requests. Branch on the HTTP status and error.code, and log or show the message.
Two responses are not JSON:
- A path that doesn't exist returns
404with an empty body. Check the method and the path. - An unexpected failure on our side returns
500with the plain-text bodyInternal Server Error.
HTTP status codes
| Status | Meaning |
|---|---|
400 Bad Request | The request is invalid: a field is missing, has the wrong type or a value that isn't allowed, or the request can't be carried out as asked. A few endpoints also use 400 for "not found" and for failures on our side. They are listed below. |
401 Unauthorized | The API key is missing or wrong. |
402 Payment Required | Not enough credit for this request. |
403 Forbidden | The API key may not do this: it lacks a permission or access to the resource, or your organisation or tier doesn't allow it. |
404 Not Found | The campaign, contact, tag, template or offer doesn't exist in your organisation, or the path doesn't exist. |
409 Conflict | You already submitted this. |
429 Too Many Requests | You hit the rate limit, your tier's contact limit, or an exchange offer's cap. Check error before retrying. |
500 Internal Server Error | Something failed on our side. Retry later, and contact support if it continues. |
A request is checked in this order, and the first failure is returned:
- The API key: 401 or 403
- The rate limit: 429
- The request body is JSON: 400
- The body's fields: 400
- The endpoint's own checks: errors by endpoint
Errors on every endpoint
Authentication and permissions
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 401 | — | No Authorization header provided | Send your key in the Authorization header as Bearer <key>. |
| 401 | — | Invalid Authorization scheme. Must be 'Bearer' | Start the header value with Bearer . |
| 401 | — | No token provided | Put your key after Bearer . |
| 401 | — | No key provided | GET /sales/create and GET /exchange/buyer/transaction/create take the key as a key query parameter. |
| 401 | — | API Key must be provided in either the Authorization header as a Bearer token, or as a query param (key={key}) | Send the key in the header, or as a key query parameter. |
| 401 | — | Invalid key | The key doesn't exist, or was deleted. Generate one on the API keys page. |
| 403 | — | Organisation blocked | This API key is blocked. Contact support. |
| 403 | — | Insufficient permissions. Must have the '<permission>' permission(s). Note: Permission changes can take up to 3 minutes to take effect. | Give the key the permission(s) named, on the API keys page. |
| 403 | insufficient_resource_ids | none | The key is limited to certain campaigns, tags or contact fields. Use one it can access, or widen its access. missing lists the rest. |
An insufficient_resource_ids error lists, for each kind of resource, the IDs the key can't access. "all" means the request needs every one of that kind.
{
"ok": false,
"error": {
"code": "insufficient_resource_ids",
"missing": {
"campaign_ids": ["64f1c0e5a2b3c4d5e6f7a8b9"]
}
}
}
A few endpoints spell this code Insufficient resource IDs: opting a contact out, adding or removing a contact's tags, and searching contacts. They are listed under errors by endpoint.
Rate limit
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 429 | rate_limit_exceeded | Rate limit exceeded | Wait until resetsAt, or for the number of seconds in Retry-After. |
{
"ok": false,
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"resetsAt": 1763550000000,
"remaining": 0
}
}
resetsAt: when the limit resets, as a Unix timestamp in milliseconds.remaining: what's left until then. Some endpoints count as more than one request, so this can be above0.- The
Retry-Afterresponse header gives the seconds until the limit resets. It may have a fraction.
POST /contacts/call-outcomes has its own limit, separate from the rest of the API.
Request body
Endpoints that take a JSON body return these before checking its fields:
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | — | No body | Send a JSON body. |
| 400 | — | Body must be JSON | Set the Content-Type: application/json header. |
| 400 | — | Invalid JSON | The body isn't valid JSON. Check for trailing commas and quotes. |
Server errors
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 500 | — | Internal Server Error (plain text, not JSON) | Retry later. Contact support if it continues. |
| 500 | — | Organisation not found | Your key isn't linked to an organisation. Contact support. |
| 500 | — | No org_id on apiKey | Your key isn't linked to an organisation. Contact support. |
Validation errors
When the JSON body doesn't match the endpoint's fields, the status is 400 and error describes the first problem found. Fix it and send the request again to find any others.
For example, POST /send/sms with "country": "za" returns:
{
"ok": false,
"error": {
"received": "za",
"code": "invalid_enum_value",
"options": ["ZA", "NA", "GB", "AU", "IE", "IT", "US"],
"path": ["country"],
"message": "Invalid enum value. Expected 'ZA' | 'NA' | 'GB' | 'AU' | 'IE' | 'IT' | 'US', received 'za'"
}
}
Every validation issue has:
| Field | Description |
|---|---|
code | The kind of problem. See the table below. |
path | Where in the body, as a list of field names and array indexes. ["contacts", 2, "cell"] is the cell of the third contact. Empty for the body itself. |
message | What's wrong, in words. |
Other fields depend on the code:
code | Meaning | Extra fields | Example error.message |
|---|---|---|---|
invalid_type | A required field is missing, or has the wrong type | expected, received | Required, Expected boolean, received string |
invalid_enum_value | The value isn't one of the allowed values. Values are case-sensitive. | options (the allowed values), received | See the example above |
invalid_union_discriminator | A kind field isn't one of the allowed kinds | options | Invalid discriminator value. Expected 'manual' ... |
invalid_literal | The field must be one exact value | expected, received | Invalid literal value, expected "manual" |
invalid_string | A string isn't in the required format, like an ID or an email address | validation (e.g. regex, email) | Invalid email |
too_small | Too short, too few items, or below the minimum | minimum, type, inclusive, exact | Content cannot be empty |
too_big | Too long, too many items, or above the maximum | maximum, type, inclusive, exact | Array must contain at most 1000 element(s) |
invalid_date | Not a valid date | none | Invalid date |
invalid_union | Matches none of the accepted forms | unionErrors (why each form failed) | Invalid input |
unrecognized_keys | A field the endpoint doesn't accept | keys | Unrecognized key(s) in object: 'foo' |
custom | A rule specific to the endpoint | none | Must specify at least one filter in 'find' |
An ID that isn't valid fails with invalid_string and the message Invalid ObjectId. Must be a 24-character hex string. Ensure you're using the resource_id and not the resource_name.
These are Zod validation issues. Zod's reference lists the rarer codes.
Where validation errors differ
POST /contacts/searchandPOST /contacts/updatereturn every problem at once.erroris{ "issues": [...], "name": "ZodError" }, and each item inissuesis a validation issue as above.- Query string and URL path parameters come back as a string: the message, then
atand the parameter. For example,Invalid date at from. When a parameter has a list of allowed values, they follow the message:... (options: Zapier, DripCrm). GET /sales/createandGET /exchange/buyer/transaction/createreturn only the message, as a string.POST /contacts/call-outcomesreturnsinvalid_call_outcome, with the path and message joined:3.cell: Invalid cell number....POST /exchange/seller/leadreturns a problem with thecontactasinvalid_lead, orinvalid_msisdnfor itscell.POST /contactsandPUT /contactsdon't fail on a contact that isn't valid. It comes back ininvalidContactswith its row and issue, and the rest are uploaded.
Errors by endpoint
These are the errors each endpoint adds to the errors on every endpoint and validation errors, grouped as in the API reference.
Balance
GET /balance returns only the errors on every endpoint.
Call outcomes
POST /contacts/call-outcomes
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | invalid_call_outcome | <path>: <reason>, e.g. 3.cell: Invalid cell number... | Fix the field named. Nothing in the request was recorded. |
| 403 | — | Insufficient permissions. Must have the 'contact.create' permission to use create_missing_contact. ... | Give the key contact.create, or stop sending create_missing_contact. |
| 429 | — | Too many contacts. Count after upload: ... Max allowed by tier: ... | Creating the missing contacts would pass your tier's contact limit. Nothing was recorded; send without create_missing_contact. |
| 500 | — | Could not record the call outcomes | Retry: nothing was recorded. |
Campaigns
GET /campaigns and GET /campaigns/v2
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | — | Invalid enum value. Expected ..., received '...' (options: Zapier, DripCrm) | Leave out format, or use one of the options. |
GET /campaigns/:campaign_id and GET /campaigns/v2/:campaign_id
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid ObjectId. Must be a 24-character hex string. ... at campaign_id |
| 403 | insufficient_resource_ids | none |
| 404 | — | Campaign not found |
Compliance
POST /compliance/send
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | — | Invalid ObjectId. ... at campaign_id | Check the campaign_id query parameter. |
| 400 | — | Invalid cell (row 3, 1-based). ... | Fix that cell number. The details follow the row number. |
| 402 | — | Insufficient balance | Buy more credits. |
| 404 | — | Organisation not found | Contact support. |
Contacts
GET /contacts/:cell
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | — | Invalid cell number. Must be a valid number in international (MSISDN) format. at cell | Use the international (MSISDN) format. |
| 403 | insufficient_resource_ids | none | The key needs access to every contact field. |
| 404 | — | Contact not found |
POST /contacts/search
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | none | none | Validation failed. error is { "issues": [...], "name": "ZodError" }. |
| 400 | — | An error occured | The search failed or took longer than 30 seconds. Narrow it down. |
| 402 | Insufficient balance | Insufficient balance. Atleast 10 credits required. | Each search costs 10 credits. Buy more credits. |
| 403 | Insufficient resource IDs | Your API Key does not have access to ... | resource_ids.missing lists what the key can't read, and resource_ids.has what it can. Narrow your projection or filter to those. |
| 404 | Organisation not found | none | Contact support. |
| 500 | Internal server error | none | Retry later. |
DELETE /contacts/:cell
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid cell number. Must be a valid number in international (MSISDN) format. at cell |
Deleting a contact that doesn't exist is not an error: deletedCount is 0.
POST /contacts/:cell/optOut
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid cell number. Must be a valid number in international (MSISDN) format. at cell |
| 400 | — | Invalid campaign_ids: <ids> |
| 400 | — | Must provider either campaign_ids or set 'all' flag to true |
| 403 | Insufficient resource IDs | none. missing lists the campaigns the key can't access. |
| 403 | Action not allowed on current tier | Contact deduping is not enabled on your current tier |
PUT /contacts/:cell/optOut
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid cell number. Must be a valid number in international (MSISDN) format. at cell |
| 400 | — | Invalid campaign_id |
| 400 | — | Must provider either campaign_id or set 'all' flag to true |
| 403 | Insufficient resource IDs | none. missing lists the campaigns the key can't access. |
| 403 | Action not allowed on current tier | Contact deduping is not enabled on your current tier |
PUT /contacts/:cell/tag/add and PUT /contacts/:cell/tag/remove
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | — | Invalid cell number. Must be a valid number in international (MSISDN) format. at cell | |
| 400 | — | No tags to add | No tags were sent, or none of them exist. Also when removing. |
| 403 | Insufficient resource IDs | none. missing lists the tags the key can't access. |
POST /contacts and PUT /contacts
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | — | Welcome send campaign not found | Check send.campaign_id. |
| 400 | — | Welcome send template is not one of the campaign's templates | Use one of the campaign's templates. |
| 404 | — | Org not found | Contact support. |
| 429 | — | Too many contacts. Count after upload: ... Max allowed by tier: ... | This is your tier's contact limit, not the rate limit, so retrying won't help. Delete contacts, or upgrade. |
| 500 | — | Internal Server Error | Retry later. |
POST /contacts/update
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | none | none | Validation failed. error is { "issues": [...], "name": "ZodError" }. Besides field problems, the custom issues are Must specify at least one filter in 'find', Must specify at least one update in 'update' and Cannot add and remove tag_ids in the same request. |
| 400 | — | An error occured | The update failed or took longer than 60 seconds. Narrow find. |
| 403 | insufficient_permissions | none | required lists the permissions this update needs. |
| 403 | insufficient_resource_ids | none | missing lists the tags or campaigns the key can't access. |
| 500 | — | Internal Server Error | Retry later. |
Deliveries
GET /deliveries
| Status | error.code | error.message |
|---|---|---|
| 400 | — | A query parameter isn't valid, e.g. Invalid date at from or Number must be less than or equal to 1000 at limit |
| 400 | — | From date cannot be later than to date |
Email templates
GET /email/templates
| Status | error.code | error.message |
|---|---|---|
| 500 | — | Internal error |
Exchange transactions
POST /exchange/buyer/transaction and GET /exchange/buyer/transaction/create
| Status | error.code | error.message |
|---|---|---|
| 400 | invalid_msisdn | Invalid cell number: <cell> |
| 404 | campaign_not_found | No matching marketplace offer for: <resource_ids>, Campaign not found: <id>, Campaign(s) not found: <ids>, No matching Campaigns found for these Send IDs: <ids> or No matching Campaigns found for these Click IDs: <ids> |
| 500 | internal_server_error | Failed to create one or more lead transactions |
POST /exchange/buyer/transaction/search
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Cannot use afterId together with _id |
| 400 | internal_server_error | Something went wrong |
PUT /exchange/buyer/transaction/:id/status
| Status | error.code | error.message |
|---|---|---|
| 400 | transaction_not_found | Transaction not found: <id> |
| 400 | transaction_invalid_kind | Transaction kind does not match expected: <id> |
| 400 | transaction_error | Buyer Org ID does not match transaction Buyer Org ID: <id> |
| 400 | transaction_error | Only "pending" transactions (or re-approving a "rejected" one) can be updated |
| 400 | org_not_found | Organization not found: <id> |
| 400 | internal_server_error | Failed to update transaction status. |
POST /exchange/seller/lead
| Status | error.code | error.message |
|---|---|---|
| 400 | invalid_lead | contact.<field>: <reason>, or contact is missing field(s) this offer requires: <fields> |
| 400 | invalid_msisdn | contact.cell: <reason> |
| 400 | offer_not_per_lead | This offer pays per <kind>, not per lead |
| 402 | offer_buyer_insufficient_balance | The offer's buyer has insufficient balance |
| 403 | insufficient_resource_ids | none. missing lists the campaigns the key can't access. |
| 403 | org_blocked | Organisation blocked |
| 403 | org_not_verified | Your organisation is not verified yet |
| 403 | offer_api_leads_disabled | This offer does not accept leads via the API |
| 403 | offer_inactive | Marketplace offer is inactive |
| 403 | offer_paused | Marketplace offer is paused by its schedule: <reason> |
| 403 | offer_permission_denied | Your organisation may not run this offer |
| 404 | org_not_found | Organisation not found |
| 404 | campaign_not_found | No exchange campaign found: <campaign_id> |
| 404 | offer_not_found | Marketplace offer not found: <offer_id> |
| 409 | duplicate_resource | A lead with resource_id "<resource_id>" was already submitted |
| 429 | offer_capped | Marketplace offer cap reached |
| 500 | internal_server_error | Could not check the offer's caps, Failed to check the lead or Failed to create the lead transaction |
See Submit a Lead for what to do about each.
Replies
POST /replies/search
| Status | error.code | error.message |
|---|---|---|
| 400 | internal_server_error | Something went wrong |
Sales
POST /sales and GET /sales/create
| Status | error.code | error.message |
|---|---|---|
| 400 | invalid_msisdn | Invalid cell number: <cell> |
| 404 | campaign_not_found | Campaign not found: <id>, Campaign(s) not found: <ids>, No matching Campaigns found for these Send IDs: <ids> or No matching Campaigns found for these Click IDs: <ids> |
| 500 | internal_server_error | Internal server error |
A duplicate sale is not an error. It is skipped, and the request still succeeds.
Send
POST /send/sms
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 400 | invalid_enum_value | Invalid enum value. Expected ..., received '...' | country or deliveryMethod isn't one of the options. Values are case-sensitive. |
| 400 | too_small | Content cannot be empty | Send some content. |
| 400 | — | Invalid ZA cell number. | cell isn't a valid number for the country. |
| 400 | — | Invalid country/deliveryMethod. ZA does not offer transactional delivery method. | Use a delivery method the country offers. |
| 400 | Action not allowed on current tier | Reverse-billed messaging is not allowed on your current org tier | Use another deliveryMethod, or upgrade. |
| 400 | — | Marketplace offer cap exceeded | Exchange campaigns only. Stop sending until the cap resets. |
| 400 | — | Marketplace buyer has insufficient balance | Exchange campaigns only. Try again later. |
| 400 | — | Marketplace offer is paused by its schedule: <reason> | Exchange campaigns only. Send when the offer's schedule allows. |
POST /send/sms answers before the SMS is sent. Problems found while sending, like an insufficient balance, an unverified organisation or spam, aren't in the response. If an SMS doesn't appear in your send logs, check those first.
POST /send/email
| Status | error.code | error.message | What to do |
|---|---|---|---|
| 404 | — | Campaign not found (campaign_id:<id>) | Check campaign_id. |
| 400 | — | Org not verified | Get verified. |
| 400 | — | Org blocked | Contact support. |
| 400 | — | Org not found | Contact support. |
| 400 | — | Insufficient balance | Buy more credits. |
| 400 | — | campaign is not active | Activate the campaign. |
| 400 | — | No template found (template_id:<id>) | Use one of your email templates. |
| 400 | — | No email templates on campaign (campaign_id:<id>) | Add an email template to the campaign. |
| 400 | — | no best template found | Use another template.kind until the campaign has enough sends. |
| 400 | — | No contacts found (campaign_id:<id>) | No contact in your org has this email address. Upload them first. |
| 400 | — | No contacts to send to | As above. |
| 400 | — | Your org has reached its daily email limit. It resets at midnight. | Send again after midnight. |
| 400 | — | Email send failed: <reason> or Email send failed | Check the from address is a verified email identity, then retry. |
| 400 | — | Marketplace offer not found (offer_id:<id>) | Exchange campaigns only. |
| 400 | — | marketplace offer is not active | Exchange campaigns only. |
| 400 | — | marketplace offer is paused by its schedule: <reason> | Exchange campaigns only. |
| 400 | — | marketplace buyer has insufficient balance | Exchange campaigns only. |
| 400 | — | Marketplace permission denied (offer_id:<id>) | Exchange campaigns only. |
POST /send/email/bulk returns only the errors on every endpoint and validation errors. The emails are queued, so problems sending them aren't in the response.
Send logs
GET /send-logs/:send_id
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid ObjectId. ... at send_id |
| 400 | resource_not_found | No send logs found for send_id: <send_id> |
POST /send-logs/search returns only the errors on every endpoint and validation errors.
Tags
GET /tags
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid enum value. Expected ..., received '...' (options: Zapier, DripCrm) |
GET /tags/:tag_id and DELETE /tags/:tag_id
| Status | error.code | error.message |
|---|---|---|
| 400 | — | Invalid ObjectId. ... at tag_id (GET only) |
| 403 | insufficient_resource_ids | none |
| 404 | — | Tag not found |
Messages in the Dripcel app
Errors you may see when sending from the Dripcel app, and how to fix them.
Insufficient balance
You do not have enough credits to send the SMS. Please purchase more credits or reduce the number of contacts.
Your organisation is not verified yet. Our team will be in touch soon
Please contact us if your organisation is not verified.
Insufficient permissions
You do not have the relevant permissions to perform the action. Please contact your administrator for permissions.
Campaign not found
The campaign you are trying to access cannot be found. The campaign has been removed.
Campaign inactive
Please activate the campaign in the campaign settings.
No contacts match the campaign's distribution criteria
There are not enough contacts available in the reachability window, tags and/or segments that you have selected.
No content found. Please add content, or change the Selection method on the campaign
Please add content to your SMS content or change the Selection method. You can choose best maximise performance, first content, random copy or least sent content.
Spam detected. Please contact support
Spam was detected in your SMS content. Please contact us.
No best time with enough sends
Please send more using the "random time" feature so Dripcel can analyse your data and recommend a best time.
No start/end hours for random time
Please add a start and end time for random time.