This page explains how InstaMessage uses HTTP status codes and error responses across the API.
Understanding these responses will help you handle errors correctly, retry requests safely, and track message delivery reliably.
InstaMessage uses standard HTTP status codes to indicate the result of an API request.
Messaging operations are asynchronous, meaning a successful API response confirms acceptance — not delivery.
These responses indicate that the request was accepted or processed successfully.
| Status Code | Meaning | Notes |
|---|---|---|
200 OK | Request processed successfully | Common for read-only operations |
201 Created | Resource created | Used when creating messages, contacts, groups, opt-outs |
Important
A successful response (including201 Created) means the request was accepted — not delivered.
Message delivery outcomes are reported later via webhooks or the Message Status API.
These responses indicate an issue with the request itself.
| Status Code | Meaning | Common causes |
|---|---|---|
400 Bad Request | Invalid request | Missing fields, invalid JSON, invalid IDs |
401 Unauthorized | Authentication failed | Missing or invalid API key |
422 Unprocessable Entity | Valid request but invalid values | Invalid phone number, unsupported parameters |
InstaMessage does not currently return
403,404, or409responses.
Invalid resources or IDs are reported as400 Bad Requestwith a specific error code.
These responses indicate an error on the InstaMessage platform or an upstream provider.
| Status Code | Meaning |
|---|---|
500 Internal Server Error | Unexpected platform error |
502 Bad Gateway | Upstream provider error |
503 Service Unavailable | Temporary service outage |
All error responses follow a consistent JSON structure:
{
"code": 4006,
"message": "Invalid phone number"
}For batch operations (if supported in future), partial failures may be reported per item.
All error responses include the following fields:
| Field | Description |
|---|---|
code | Numeric, machine-readable error code |
message | Human-readable description of the error |
Sending a message is an asynchronous operation.
This means:
- A successful API response confirms acceptance, not delivery
- Delivery, failure, or read status is reported later
Message outcomes are available via:
- Webhooks (
message.status) - Message Status API (lookup by
message_id)
Never assume message delivery based on an HTTP response alone.
Webhook delivery is best-effort.
- Webhooks are not retried if your endpoint fails
- Events may arrive out of order
- Missed events can be recovered via the Message Status API
For reliability:
- Respond with 200 OK immediately
- Process events asynchronously
- Store delivery updates idempotently using
message_idandstatus
You may retry requests when encountering:
- Network timeouts
5xxserver errors
Always ensure retries are idempotent to avoid duplicate actions.
Do not retry requests that return:
400or422errors (fix the request instead)401 Unauthorized(fix authentication)
{
"code": 4006,
"message": "Invalid phone number"
}{
"code": 4001,
"message": "Missing required field: to"
}- Always check HTTP status codes before assuming success
- Treat message creation as asynchronous
- Use webhooks for real-time delivery updates
- Use the Message Status API as a fallback
- Store and correlate
message_idvalues - Never assume delivery from a 2xx response alone
- Send messages → Send a Message
- Track delivery → Delivery Receipts & Message Status
- Receive events → Webhook Quick-Start
- Manage contacts → Contacts
- Handle inbound replies → Inbound Messages & Replies
Understanding status codes and errors ensures your integration is reliable, predictable, and production-ready.