Rasel / Docs
EN
POST/api/v2/messages/bulk/{jobId}/cancel

Cancel a bulk job

Accepts cancellation unless the job is completed, cancelled, or rejected. No body. The current window may finish, then unsent rows become cancelled. Poll until the status changes.

When to use it. Stop rows that have not been sent.

Code example

Correct: Correct: request cancel

curl --location 'https://raselsms.com/api/v2/messages/bulk/64b0c0ff0000000000000001/cancel' \--header 'X-API-Key: YOUR_API_KEY' \--header 'Content-Type: application/json'

Incorrect: Incorrect: already finished

curl --location 'https://raselsms.com/api/v2/messages/bulk/64b0c0ff0000000000000001/cancel' \--header 'X-API-Key: YOUR_API_KEY' \--header 'Content-Type: application/json'

Response example

200 — Correct: request cancel

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

409 — Incorrect: already finished

{  "success": false,  "code": "JOB_NOT_CANCELLABLE",  "error": "Job cannot be cancelled"}

200 — Cancel was accepted.

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

404 — No job with this id belongs to this account. Code JOB_NOT_FOUND.

{  "success": false,  "code": "JOB_NOT_FOUND",  "error": "Job was not found"}

401 — Missing or invalid API key.

{  "success": false,  "requestId": "msgreq_1739012345678_abc123",  "code": "UNAUTHORIZED",  "error": "Missing or invalid API key"}

403 — Phone is not verified or messages:create is missing. Code FORBIDDEN.

{  "success": false,  "code": "FORBIDDEN",  "error": "Phone not verified or missing permission"}

429 — Rate limit exceeded. Honor Retry-After when present.

{  "success": false,  "requestId": "msgreq_1739012345678_abc123",  "code": "RATE_LIMITED",  "error": "Rate limit exceeded",  "retryAfterSeconds": 30}

HTTP request

POST /api/v2/messages/bulk/{jobId}/cancel

Request Headers

HeaderTypeDescription
X-API-KeystringYour Rasel API key. Send it on every documented request except inbound webhooks. *

Path parameters

FieldTypeDescription
jobIdstringJob id from the create response. The job is visible only to that key's account. *

Response Fields

FieldTypeDescriptionExample
successenumTrue when the operation succeeded, or when at least one batch recipient succeeded. *
jobobjectJob details. The following fields belong to this job and are not visible to another account. *
job.idstringResource identifier. *
job.namestringDisplay name or lowercase template identifier, depending on the endpoint. *
job.statusenumDelivery or record status. On send: sent, queued, or scheduled. On other resources it is the row status filter or value. *
job.messagesPerSecondintegerRate ceiling: an integer from 1 to 10. Zero, fractions, and values above 10 reject the request before a job is stored. The ceiling is shared by the account's jobs in creation order. *
job.pauseReasonenumSet only while status is paused. insufficient_balance and provider_rate_limit stop the current window. user means the account requested pause. *
job.totalintegerTotal matching rows. *
job.validatedCountintegerHow many rows have been checked while status is validating. *
job.countsobjectRow counters. They stay separate even when a completed job still has failed rows. *
job.counts.pendingintegerRows not sent yet. *
job.counts.sentintegerRows accepted for delivery. They also appear in the normal message list. *
job.counts.failedintegerRows that failed. A completed job can still have failed rows. *
job.counts.cancelledintegerRows cancelled before send. *
job.errorCodestringJob-level code when status is rejected: VALIDATION_FAILED (one or more rows failed checks; nothing sent), INSUFFICIENT_BALANCE (the account cannot send even one message; nothing sent), INTAKE_INCOMPLETE (storage did not finish; nothing sent). *
job.errorMessagestringShort explanation safe to show the account owner. Match your logic on code, not on this text. *
job.createdAtstringCreation timestamp.

Status Codes

StatusDescription
200Success.
401Missing or invalid API key.
403Phone not verified, missing permission, or the account cannot perform this action.
404Resource not found for this API key owner.
409Conflict, such as an idempotency key reuse with a different body, or a session that is not ready.
429Rate limit exceeded, or the maximum number of verification attempts was reached.

Try it

Parameters

Job id from the create response. The job is visible only to that key's account.

Request

{}

Response

Send a request to see the response.