# Queue a batch

Set the send rate and a unique key for the batch. Follow the job ID after acceptance.

Required. Send the account API key in X-API-Key with messages:create and a verified phone. Never put the key in a browser or in git.

1. POST /api/v2/messages/bulk with Idempotency-Key, messagesPerSecond from 1 to 50, and a messages array.

2. Store id from the 202 response. status validating means checks are not finished and nothing has been sent.

3. GET /api/v2/messages/bulk/{jobId} until status is queued, running, rejected, paused, completed, or cancelled.

4. Use /items and /errors for detail. Pause, resume, cancel, and retry use the matching routes. Resume without balance returns 402.

## Request preview

```bash
curl --request POST 'https://raselsms.com/api/v2/messages/bulk' \
  -H "X-API-Key: $RASEL_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: bulk-example-001' \
  --data-binary @- <<'RASEL_JSON'
{
  "name": "Morning notices",
  "messagesPerSecond": 10,
  "messages": [
    {
      "to": "+963912345678",
      "channel": "local_sms",
      "messageType": "free_text",
      "content": {
        "text": "Example notice from Rasel."
      }
    },
    {
      "to": "+963987654321",
      "channel": "local_sms",
      "messageType": "free_text",
      "content": {
        "text": "Example notice from Rasel."
      }
    }
  ]
}
RASEL_JSON
```

## HTTP 202

```json
{
  "success": true,
  "id": "64b0c0ff0000000000000001",
  "name": "Morning notices",
  "status": "validating",
  "messagesPerSecond": 10,
  "pauseReason": null,
  "total": 2,
  "validatedCount": 0,
  "counts": {
    "pending": 0,
    "sent": 0,
    "failed": 0,
    "cancelled": 0
  },
  "errorCode": null,
  "errorMessage": null,
  "createdAt": "2026-09-24T12:00:00.000Z"
}
```

Test locally with a mock response first. Confirm the recipient and cost before sending a live request.

- [GET /api/v2/messages/bulk/{jobId}](https://raselsms.com/api-docs/markdown/messaging/bulk-job.md)

- [GET /api/v2/messages/bulk/{jobId}/items](https://raselsms.com/api-docs/markdown/messaging/bulk-items.md)

- [GET /api/v2/messages/bulk/{jobId}/errors](https://raselsms.com/api-docs/markdown/messaging/bulk-errors.md)

## HTTP 400

Idempotency-Key is required.

```json
{
  "success": false,
  "code": "IDEMPOTENCY_KEY_REQUIRED",
  "error": "Idempotency-Key is required"
}
```

[API reference](https://raselsms.com/api-docs/markdown/messaging/bulk.md)

[OpenAPI](https://raselsms.com/api-docs/openapi.json)
