For general Telnyx API errors (authentication, rate limiting, etc.), see the API Error Codes reference.
Delivery errors (40xxx)
These errors occur after the message is accepted by the API but fails during delivery. They appear in message detail records andmessage.finalized webhooks.
Carrier rejections
| Code | Error | Cause | Action |
|---|---|---|---|
40001 | Not routable | Destination is a landline or non-routable number | Verify the recipient can receive SMS/MMS |
40002 | Blocked as spam (temporary) | Carrier spam filter triggered | Reduce sending rate; review message content for spam patterns |
40003 | Blocked as spam (permanent) | Sending number permanently blocked by carrier | Use a different sending number; contact support for appeal |
40004 | Rejected by destination | Recipient carrier rejecting for unknown reason | Retry after delay; contact support if persistent |
40005 | Message expired | Message TTL expired before delivery | Increase validity period or check carrier delays |
40006 | Recipient unavailable | Recipient’s carrier server is down | Retry with exponential backoff |
40008 | Undeliverable | Carrier did not accept the message | Check number validity; try alternate route |
40009 | Invalid message body | Message content rejected | Check for invalid characters or encoding issues; see Message Encoding |
40011 | Rate limit exceeded (upstream) | Exceeded carrier throughput limit | Reduce sending rate; see Rate Limiting |
40012 | Invalid destination number | Carrier rejected the destination number | Verify E.164 format and number validity |
40013 | Invalid source number | Carrier rejected the sending number | Check that your number is active and messaging-enabled |
40014 | Expired in queue | Message sat in queue past validity period | Check for throughput bottlenecks; increase sending capacity |
40015 | Internal spam filter | Telnyx internal spam filter triggered | Review message content; contact support if false positive |
10DLC-specific errors
| Code | Error | Cause | Action |
|---|---|---|---|
40010 | Not 10DLC registered | Sending number lacks 10DLC campaign registration | Register for 10DLC |
40016 | T-Mobile sending limit | Exceeded T-Mobile throughput for this campaign | Reduce rate or improve brand vetting score for higher limits |
40017 | AT&T spam rejection | AT&T flagged message as spam | Review content; avoid URL shorteners and spam-like patterns |
40018 | AT&T sending limit | Exceeded AT&T throughput for this campaign | Reduce rate or improve brand vetting score |
40019 | AT&T invalid tag data | Incorrect 10DLC tagging information | Verify campaign and number assignment; troubleshoot 10DLC |
40020 | Artificial traffic inflation | 2FA traffic blocked for 24 hours | Wait 24 hours; review for fraud patterns on your numbers |
Toll-free errors
| Code | Error | Cause | Action |
|---|---|---|---|
40329 | Toll-free not verified | Number hasn’t passed toll-free verification | Complete toll-free verification |
40330 | Toll-free not provisioned | Number not fully provisioned for messaging | Wait for provisioning to complete; contact support |
Group MMS errors
| Code | Error | Cause | Action |
|---|---|---|---|
40334 | Too many destinations for MMS | Group MMS message includes more than 10 destinations | Send to at most 10 destinations per message, or split into multiple messages |
WhatsApp delivery errors
| Code | Error | Cause | Action |
|---|---|---|---|
40040 | Template not found | Template name+language pair does not exist on the WhatsApp Business Account or is not approved | Verify the template name and language, and confirm the template is approved, then resend |
40041 | Parameter count mismatch | Number of parameter values does not match the parameters defined in the template | Match the parameter values to the template’s variable slots and resend |
40042 | Component format mismatch | Template component format is invalid | Verify the parameter formats expected by the template and resend |
40043 | Required parameter missing | A required template parameter is missing | Supply values for all required template parameters and resend |
40044 | Display name is not finalized | The business phone number’s display name is pending, declined, or nonexistent | Approve the business phone number’s display name before sending |
40045 | Malformed send load | The send request contained an invalid parameter | Check request parameters against the API reference and resend |
40046 | 24h window exceeded | More than 24 hours have passed since the recipient last messaged the sender | Send an approved template message instead of a free-form message |
40047 | Number restricted for spam | The sending number is restricted after spam flags or a quality drop | Review sending quality in the WhatsApp Manager; resume normal sending after the restriction lifts |
40048 | Quality-based ecosystem cap | The message was not delivered to maintain healthy ecosystem engagement (per-user marketing limits) | Wait 24 hours before resending; retrying does not guarantee delivery |
40049 | Per-recipient flood cap | Too many messages were sent to the same recipient in a short period | Wait before messaging this recipient; sending to other recipients is unaffected |
40050 | Type unsupported on Cloud API/coexistence | The message type is not supported for this recipient | Use a message type supported for this recipient |
40051 | WABA payment/credit issue | Payment method or credit line problem on the WhatsApp Business Account | Check the WABA billing setup; contact Telnyx support |
40052 | WABA in maintenance mode | The WhatsApp Business Account is in maintenance mode (e.g. a throughput upgrade) | Wait a few minutes and retry |
40053 | Localized template text over limits | Localized template text exceeds character limits | Shorten or re-translate the template text |
40054 | Component format mismatch | A component does not match the expected format (e.g. header expects an image) | Align component types with the template definition and resend |
40055 | Number not registered on Cloud API | The sending number is not registered on the WhatsApp Business Platform | Register the sending number and resend |
40335 | WhatsApp conversation window closed | The 24-hour WhatsApp conversation window is closed | Send an approved template message to re-open the window |
API request errors (403xx)
These errors are returned immediately in the API response when the message request is invalid.Sender/recipient errors
| Code | Error | Cause | Action |
|---|---|---|---|
40300 | Blocked (STOP) | Recipient sent STOP — opt-out in effect | Do not retry; wait for recipient to opt back in |
40301 | Unsupported message type | Cannot send between these number types | Check source and destination number capabilities |
40305 | Invalid ‘from’ address | Sending number not associated with messaging profile | Assign the number to your messaging profile |
40306 | Alpha sender not configured | Alphanumeric sender ID not set on profile | Configure alpha sender on your messaging profile |
40307 | Alpha sender mismatch | From address doesn’t match configured alpha sender | Use the exact alpha sender configured on the profile |
40308 | Invalid ‘from’ for MMS | MMS requires US long code or short code | Use an MMS-capable number |
40309 | Invalid destination region | Destination country not in profile whitelist | Add the destination region to your messaging profile |
40310 | Invalid ‘to’ address | Destination number is invalid | Verify E.164 format: +[country code][number] |
40319 | Incompatible message type | Source and destination types incompatible | Check number type compatibility |
40320 | Temporarily unusable sender | Sending number in pending/transitional state | Wait for number provisioning to complete |
40321 | No usable numbers in pool | Number pool empty or all numbers unhealthy | Add numbers to pool or check number health |
40325 | Invalid alpha sender ID | Alphanumeric sender ID format is invalid | Use 1–11 alphanumeric characters |
Content errors
| Code | Error | Cause | Action |
|---|---|---|---|
40302 | Message too large | SMS would be divided into more parts than the destination allows | Enable SMS chunking on your messaging profile, shorten the message, or send as MMS |
40304 | Invalid content combination | Mixed SMS/MMS content parameters | Use text for SMS; media_urls (with optional text) for MMS |
40316 | No content | Message has no text or media | Include text and/or media_urls |
40317 | Invalid MMS content | Too many media items or total size > 5 MiB | Reduce to ≤10 URLs and ≤5 MiB total |
40322 | Blocked content | Message contains prohibited content | Remove flagged content |
40328 | SMS exceeds recommended size | auto_detect is true and text is longer than 765 characters (GSM-7) or 670 characters (other text) | Shorten the message, send it as MMS, or set auto_detect to false |
Profile/configuration errors
| Code | Error | Cause | Action |
|---|---|---|---|
40311 | Invalid profile secret | X-Profile-Secret header is wrong | Check your messaging profile secret |
40312 | Profile disabled | Messaging profile is disabled | Re-enable in Mission Control |
40313 | Missing profile secret | X-Profile-Secret header required but not sent | Include the header in your request |
40314 | Messaging disabled | Messaging disabled on your account | Contact Telnyx support |
40315 | Unhealthy sender | Sending number has poor health metrics | Check number success/spam rates; consider replacing |
40318 | Queue full | Internal message queue at capacity | Back off and retry after a delay |
40323 | Activation failed | Could not enable messaging on number | Contact support |
40331 | Missing whitelist | No whitelisted destinations on profile | Add destination regions to your messaging profile |
40333 | Spend limit reached | Messaging profile cost limit hit | Increase spend limit or wait for reset |
Number provisioning errors (401xx)
| Code | Error | Cause | Action |
|---|---|---|---|
40100 | Not messaging enabled | Number not configured for messaging | Enable messaging in Mission Control |
40150 | Not in voice registry | Toll-free number missing from registry | Contact support |
40151 | Enablement pending elsewhere | Another provider is enabling messaging | Wait for transfer to complete |
40155 | LOA required | Letter of Authorization needed | Submit LOA through support |
Handle errors in code
import telnyx
telnyx.api_key = "YOUR_API_KEY"
try:
message = telnyx.Message.create(
from_="+18005550100",
to="+18005550101",
text="Hello!",
messaging_profile_id="YOUR_PROFILE_ID"
)
print(f"Sent: {message.id}")
except telnyx.error.InvalidRequestError as e:
# API request errors (40xxx)
error = e.json_body.get("errors", [{}])[0]
code = error.get("code", "unknown")
detail = error.get("detail", "No details")
if code == "40300":
print(f"Recipient opted out (STOP). Do not retry.")
elif code == "40333":
print(f"Spend limit reached. Increase limit or wait for reset.")
elif code == "40310":
print(f"Invalid destination number. Check E.164 format.")
else:
print(f"Error {code}: {detail}")
except telnyx.error.AuthenticationError:
print("Invalid API key")
const telnyx = require("telnyx")("YOUR_API_KEY");
try {
const message = await telnyx.messages.create({
from: "+18005550100",
to: "+18005550101",
text: "Hello!",
messaging_profile_id: "YOUR_PROFILE_ID",
});
console.log(`Sent: ${message.data.id}`);
} catch (err) {
const error = err.rawType || "unknown";
const detail = err.message;
switch (error) {
case "40300":
console.log("Recipient opted out (STOP). Do not retry.");
break;
case "40333":
console.log("Spend limit reached.");
break;
case "40310":
console.log("Invalid destination number.");
break;
default:
console.log(`Error ${error}: ${detail}`);
}
}
require "telnyx"
Telnyx.api_key = "YOUR_API_KEY"
begin
message = Telnyx::Message.create(
from: "+18005550100",
to: "+18005550101",
text: "Hello!",
messaging_profile_id: "YOUR_PROFILE_ID"
)
puts "Sent: #{message.id}"
rescue Telnyx::InvalidRequestError => e
error = e.json_body&.dig(:errors, 0) || {}
code = error[:code] || "unknown"
detail = error[:detail] || "No details"
case code
when "40300"
puts "Recipient opted out. Do not retry."
when "40333"
puts "Spend limit reached."
else
puts "Error #{code}: #{detail}"
end
end
package main
import (
"context"
"fmt"
"strings"
telnyx "github.com/telnyx/telnyx-go"
)
func main() {
client := telnyx.NewClient("YOUR_API_KEY")
_, err := client.Messages.Create(context.Background(), &telnyx.MessageParams{
From: "+18005550100",
To: "+18005550101",
Text: "Hello!",
MessagingProfileID: "YOUR_PROFILE_ID",
})
if err != nil {
if strings.Contains(err.Error(), "40300") {
fmt.Println("Recipient opted out. Do not retry.")
} else if strings.Contains(err.Error(), "40333") {
fmt.Println("Spend limit reached.")
} else {
fmt.Printf("Error: %v\n", err)
}
return
}
fmt.Println("Message sent successfully")
}
# Check response for errors
response=$(curl -s -w "\n%{http_code}" -X POST https://api.telnyx.com/v2/messages \
-H "Authorization: Bearer $TELNYX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+18005550100",
"to": "+18005550101",
"text": "Hello!"
}')
http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | head -n -1)
if [ "$http_code" != "200" ]; then
error_code=$(echo "$body" | python3 -c "import sys,json; print(json.load(sys.stdin).get('errors',[{}])[0].get('code','unknown'))")
echo "Error $error_code (HTTP $http_code)"
echo "$body" | python3 -m json.tool
fi
Handle delivery errors via webhooks
Delivery errors arrive asynchronously inmessage.finalized webhooks:
Python
@app.route("/webhooks", methods=["POST"])
def webhooks():
body = request.json
event_type = body["data"]["event_type"]
if event_type == "message.finalized":
payload = body["data"]["payload"]
status = payload["to"][0]["status"]
if status == "delivery_failed" or status == "sending_failed":
errors = payload.get("errors", [])
for error in errors:
code = error.get("code", "unknown")
detail = error.get("detail", "")
print(f"Delivery failed [{code}]: {detail}")
# Decide whether to retry
if code in ("40006", "40008"):
print("Temporary error — retry with exponential backoff")
elif code in ("40003", "40300", "40001", "40010", "40314", "40322"):
print("Permanent error — do not retry")
elif code in ("40002", "40011", "40016", "40017", "40018"):
print("Intervention required — review content/rate, then retry")
else:
print("Review error and decide")
return "", 200
Retriable vs permanent errors
Most delivery errors require you to change something before retrying — blindly retrying the same message with the same configuration will not resolve the issue and may result in further blocking.
| Category | Codes | Action |
|---|---|---|
| Auto-retriable (genuinely temporary) | 40006, 40008 | Carrier-side issue — retry with exponential backoff (1s, 2s, 4s, 8s…). 40006: recipient carrier is down. 40008: general undeliverable, may resolve on retry. |
| Retriable after intervention (fix first) | 40002, 40005, 40011, 40014, 40016, 40017, 40018, 40318 | These errors indicate a problem with your sending rate, content, or throughput. Reduce sending rate, review message content for spam patterns, or resolve queue pressure before retrying. Automatic retry without changes will likely fail again. |
| Temporary hold | 40020, 40320 | 40020: 2FA traffic blocked for 24 hours — wait, do not retry. 40320: sender in transitional state — wait for provisioning to complete. |
| Permanent (do not retry) | 40001, 40003, 40010, 40300, 40314, 40322 | Fix root cause before attempting again. These will not resolve on their own. |
| Action required (config/compliance) | 40010, 40015, 40019, 40315, 40329, 40333 | Resolve the underlying configuration or compliance issue, then send again. |
| WhatsApp delivery | 40040-40055, 40335 | See the WhatsApp delivery errors table. Template, parameter, display-name, registration, and billing errors need correction before resending; spam/quality caps (40047, 40048, 40049) and maintenance mode (40052) are temporary — wait before resending. |
Related resources
Rate Limiting
Understand and handle API and carrier rate limits.
Message Detail Records
Query delivery status and error details for sent messages.
10DLC Troubleshooting
Diagnose 10DLC registration and delivery issues.
Spend Limits
Configure and manage messaging profile spend limits.