Errors and pagination
Start with the endpoint's response schema and the HTTP status code. Different endpoints can use different response shapes and pagination cursors.
Authentication errors
For a 401 response, check that you sent the X-API-Key header and that its value is a valid key for the intended company. A 401 with code ACCOUNT_INACTIVE is different: the key is fine, but the business's LeadTruffle account is inactive, and a person must reactivate it. Keep the key private when sharing logs or asking for support.
Request errors
For a 400 response, compare your request with the endpoint's required fields, enum values, and examples. For a 404, check the record ID and the company associated with your key.
When an error response includes a code, branch on the code and treat the message as an explanation for people. The newer endpoints put the code in one of two places:
- Lead creation (
POST /v2/pub/leads/smsand its older path, andPOST /v2/pub/leads/email):{ "success": false, "code": "…", "error": "message" }. - Inbox, analytics and agent endpoints:
{ "success": false, "error": { "code": "…", "message": "…" } }.
Older /v1 endpoints may return only { "success": false, "error": "message" }, without a code; use the HTTP status for those.
Create SMS leads and start texting lists the SMS lead codes, Create email leads the email lead codes, and Manage AI agents the agent codes.
Rate limits
Lead, agent, analytics and /v1 endpoints share 600 requests per 10 minutes per company, about one request per second. Over that, requests return 429 with code RATE_LIMIT_EXCEEDED (analytics uses RATE_LIMITED); the count resets every 10 minutes. Inbox endpoints have their own limits, described in the Inbox guide, and return RATE_LIMITED. Whenever a response includes a Retry-After header or retryAfterSeconds, wait that long before retrying. Contact LeadTruffle support if your integration needs a higher rate.
Creating leads that text has stricter limits, so the business's texting number is not throttled or filtered by mobile carriers: a burst of 5, then 1 every 30 seconds, and at most 500 in any 24 hours. Send leads one at a time. These responses include retryAfterSeconds and a Retry-After header. See Send leads one at a time.
Before retrying a request that creates data or sends a message, check whether the first attempt took effect. A network timeout alone does not prove the operation failed. Creating an SMS lead is the exception: it is always safe to repeat, because a lead that was already saved returns 409 DUPLICATE_LEAD instead of a second lead. An email lead is safe to repeat within 24 hours; after that, check GET /v2/pub/leads-created first.
Pagination
Follow the cursor documented on the specific endpoint. Do not assume every list operation uses the same parameters.
For List leads created:
- Send the first request with your desired
limit(up to 100). - Process the returned
data.leads. - If
data.hasMoreis true, use the oldest returned lead'stimestampas the next request'sbeforevalue. - Continue until
data.hasMoreis false. If a page is empty or its cursor does not advance, stop and investigate rather than repeating the same request indefinitely.
curl --get \
--url 'https://pub-api.leadtruffle.com/api/v2/pub/leads-created' \
--header 'X-API-Key: YOUR_API_KEY' \
--data-urlencode 'limit=100' \
--data-urlencode 'before=2026-01-01T00:00:00.000Z'
The date above is an example. Use the timestamp from your previous response.
Webhook issues
Confirm the subscription's URL and event type. If signature verification fails, check that you use the exact raw request body and the webhook's shared secret. Parsing and re-serializing JSON can change the bytes used for signing.
See Receive lead events and Verify webhook signatures.
Get help
Email support@leadtruffle.com with the endpoint, time of the request, HTTP status, and a redacted response. Do not include API keys or webhook secrets.