API Docs

Requests & responses

Headers, the response envelope, pagination, sorting and search.

Request headers

HeaderWhenValue
AuthorizationEvery protected requestBearer <your API key>
Content-TypeRequests with a bodyapplication/json
AcceptRecommendedapplication/json
Idempotency-KeyOptional, on POST /messagesA unique string per send so a retry can't send twice. See Safe retries.

Request bodies are JSON encoded as UTF-8. Query-string parameters are used only on GET requests.

Response envelope

Every response — success or failure — has the same top-level shape, so you can handle them all in one place:

Envelope fields
successbooleanrequired
true when the request did what you asked.
status_codeintegerrequired
The HTTP status code, repeated in the body.
status_textstringrequired
The HTTP reason phrase, e.g. Created.
messagestringrequired
A short, human-readable summary. Its wording may change; don't parse it.
dataobject | array | nulloptional
The result, on success. Some writes return null.
errorstringoptional
A stable, machine-readable code, on failure. See Errors.
Success
200 OK
{
  "success": true,
  "status_code": 200,
  "status_text": "OK",
  "message": "message has been fetched",
  "data": {
    "id": "…"
  }
}
Failure
400 Bad Request
{
  "success": false,
  "status_code": 400,
  "status_text": "Bad Request",
  "message": "messages must contain at least 1 item",
  "error": "validation_error"
}

Pagination

List endpoints return one page at a time. Ask for a page with query parameters:

Query parameters
pageintegeroptionaldefault: 1
Page number, starting at 1.
limitintegeroptionaldefault: 10
Records per page, up to 1000.

The records are in data.data; the rest of data tells you where you are. Keep requesting next_page until has_next_page is false.

Paginated data
200 OK
{
  "success": true,
  "status_code": 200,
  "status_text": "OK",
  "message": "messages have been fetched",
  "data": {
    "data": [
      "…"
    ],
    "total": 342,
    "page": 2,
    "limit": 20,
    "total_pages": 18,
    "has_next_page": true,
    "has_previous_page": true,
    "next_page": 3,
    "previous_page": 1
  }
}
Query parameters
sort_bystringoptionaldefault: created_at
The field to sort by. Each list endpoint documents which fields it allows.
sort_dirstringoptionaldefault: desc
asc or desc.
searchstringrequired
On /search endpoints only: the text to look for. Filters and pagination still apply.
Example
GET /messages?page=1&limit=50&sort_by=created_at&sort_dir=desc&status=delivered

HTTP status codes

CodeMeaning
200OK — the request succeeded.
201Created — a resource (messages, sender name, purchase) was created.
400Bad request — validation failed or the action isn't possible. Check error.
401Unauthorized — missing or invalid API key, or the account can't send.
403Forbidden — the key is valid but may not touch this resource.
404Not found — no such resource, or it isn't yours.
405Method not allowed — wrong HTTP method for this path.
429Too many requests — slow down and retry after the Retry-After seconds.
500Server error — something failed on our side. Safe to retry later (with an Idempotency-Key for sends).