SendKuy API

Send up to 500 independent messages in one call

Not a repeat of POST /messages. Each element carries its own channel, recipient and body, and each one is answered on its own row: index, the id that was created, and error when that element failed. One mistyped number does not throw away the 499 that were fine. The rows carry ids, not message objects. Every message is accepted as queued and sent in the background, paced per number; read it back with GET /messages/{id} or follow it with webhooks. Status is 200, not 201, because a batch that failed entirely still answers row by row. Too little credit and a channel your plan does not include are reported on the element's row (insufficient_credits, channel_not_in_plan), not as an error for the whole call.

Authorization

bearerAuth messages:write
AuthorizationBearer <token>

Authorization: Bearer sk_live_.... Keys in the query string or the request body are refused — a URL is logged by every proxy it passes, and that is how customer keys leak.

A key carries scopes. A call outside them answers 403 with insufficient_scope and names the scope it wanted.

In: header

Scope: messages:write

Header Parameters

Idempotency-Key?string

Any unique string, one per logical request. Retrying with the same key returns the first answer instead of doing the work twice, and answers with Idempotent-Replay: true. An answer is remembered once something went out. Not remembered, so the same key runs the request again: rate_limit_exceeded (429), a server error (5xx) that left nothing behind, and on POST /messages and POST /messages/batch a refusal (4xx) or a send whose every message failed because of its sender (credentials, balance, a disconnected device). A failure that may still have reached the recipient, such as a provider timeout, stays remembered. A server error after a message was handed over is remembered as that message, so the retry returns it instead of sending again. A batch is always remembered. A key belongs to your account, across endpoints and API keys.

Lengthlength <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Up to 500 independent messages in one call. The shape of every field in every element is validated up front, and a mistake there refuses the whole call with validation_failed. The recipient, the gateway, the channel in your plan and the credit are checked per element, so one bad number does not throw away the 499 that were fine.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST https://app.sendkuy.com/api/v1/messages/batch \  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{  "messages": [    {      "channel": "whatsapp",      "to": "+6281234567890",      "body": "Your order is on its way."    },    {      "channel": "email",      "to": "andi@example.com",      "subject": "Your order",      "body": "<p>Your order is on its way.</p>"    }  ]}'
{  "data": [    {      "index": 0,      "id": "msg_9cBe3A1H-SLhW5fONWZ32wb-IIio5Ts3",      "error": {        "type": "authentication_error",        "code": "missing_api_key",        "message": "string",        "param": "string"      }    }  ]}