Request headers
Every Sozuri API call accepts the same small set of HTTP headers. Send your key in Authorization, describe your body with Content-Type, and you’re ready to go. Responses are always JSON.
Standard headers
| Header | Required | Type | Description |
|---|---|---|---|
| Authorization | Yes, unless you send apiKey as a field |
String |
Bearer token containing your project’s API key, for example Bearer YOUR_API_KEY. Remember the single space between Bearer and the key.
The project field is still required, in the body or the query string.
If you prefer, you can omit this header and pass apiKey inside the request body or the query string — see Authentication. A header named apiKey is not read.
|
| Content-Type | Yes, when the request has a body | String | Format of the request body. Use application/json for JSON payloads, or application/x-www-form-urlencoded for form submissions. A GET with query parameters needs no body and no Content-Type. |
| Accept | No | String | Responses are always JSON, whatever you send here. application/json is a good value to send. |
| Idempotency-Key | No | String | On the send APIs: a key of your own that makes a retry safe. See Retrying safely. |
Retrying safely: the Idempotency-Key header
If a send times out or your connection drops, you cannot tell whether it went. Send the request again with
the same Idempotency-Key and Sozuri answers with the first response instead of
sending a second message. It works on POST /api/v1/messaging and POST /api/v2/messaging (SMS),
and POST /api/v1/whatsapp/messages (WhatsApp, both channels).
- Use a new key for each message you mean to send, and the same key only to retry that one. A UUID is ideal: 1 to 128 visible characters, no spaces.
-
A key belongs to your project and is remembered for
24 hours. Within that time, a repeat
with the same request gets the first response again, byte for byte, with the header
Idempotent-Replayed: true, and nothing is sent or charged. -
Only a successful (
2xx) response is remembered. If the first request was refused (a closed WhatsApp window, a low balance, a rate limit), nothing was sent, so the same key can be used again once you have fixed the cause. -
The same key with a different request is refused:
422 IDEMPOTENCY_KEY_REUSED. A repeat that arrives while the first request is still being handled gets409 IDEMPOTENCY_KEY_IN_USE; retry in a moment. A malformed key is422 IDEMPOTENCY_KEY_INVALID. These refusals look like{ "error_code": "…", "message": "…", "retryable": false }. - Without the header, every request is a new send, as before.
curl -X POST https://sozuri.net/api/v1/whatsapp/messages \
-H "Authorization: Bearer $SOZURI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1d2c3b-4a5e-4f60-8b7a-9c0d1e2f3a4b" \
-d '{ "project": "your_project_name", "to": "254700000000", "text": "Your order is on its way" }'
Example request
A typical authenticated POST looks like this:
POST /api/v1/messaging HTTP/1.1
Host: sozuri.net
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: application/json
{
"project": "Galaxion Marketing",
"from": "MySenderID",
"to": "254700000001",
"message": "Hello, world.",
"type": "transactional"
}
Response headers
Responses come back as Content-Type: application/json. Apart from a 401 or a 429, they also carry
X-RateLimit-Limit and X-RateLimit-Remaining: your project’s allowance of API requests per minute, and how
much of it is left. See Request rate.
Use cases
Quick reference for the most common header combinations.
JSON API call
Set Content-Type: application/json and Authorization: Bearer …, with project in the body. The cleanest choice for modern backends — the API key stays out of the body and URL.
Form-encoded request
If you’re posting from a legacy system that can’t build JSON, send application/x-www-form-urlencoded with the same fields and put apiKey in the body (or keep the Bearer header).
Quick GET test
For a one-off check from a browser or script, put project and apiKey in the query string. The key then appears in URLs and logs, so use the Bearer header in production.
Headers in hand. Send a message.
Try the Bulk SMS endpoint next, or grab a ready-made request from the code samples.