Skip to main content
DELETE
/
batch
/
scrape
/
{batchId}
Cancel a Batch
curl --request DELETE \
  --url https://api.spidra.io/api/batch/scrape/{batchId} \
  --header 'x-api-key: <api-key>'
{
  "status": "cancelled",
  "cancelledItems": 8,
  "creditsRefunded": 16
}

Overview

Cancels a batch that is currently pending or running. Credits reserved for items that have not yet started are refunded automatically. Items already being processed will complete normally.
curl -X DELETE https://api.spidra.io/api/batch/scrape/YOUR_BATCH_ID \
  -H "x-api-key: YOUR_API_KEY"

Response

{
  "status": "cancelled",
  "cancelledItems": 8,
  "creditsRefunded": 16
}
FieldTypeDescription
status"cancelled"Confirms the batch was cancelled
cancelledItemsnumberNumber of pending items that were stopped. Items already running are not counted
creditsRefundednumberCredits returned to your balance. Calculated as cancelledItems × reservedCreditsPerItem
Items that were already running when you cancelled will finish processing and consume their credits. Only pending items are cancelled and refunded.

Errors

CodeReason
401Missing x-api-key header
403Invalid or expired API key
404No batch found with this ID, or it belongs to a different user
409The batch is already in a terminal state (completed, failed, or cancelled) and cannot be cancelled
Already terminal:
{
  "status": "error",
  "message": "Cannot cancel a batch that is already completed.",
  "code": "ALREADY_TERMINAL"
}

Retry Failed Batch Scrapes

Re-queue failed items instead of cancelling

Get Batch Status

Check current status before cancelling

Authorizations

x-api-key
string
header
required

Path Parameters

batchId
string<uuid>
required

The batch ID to cancel

Response

Batch cancelled successfully

status
enum<string>
Available options:
cancelled
cancelledItems
integer

Number of pending items that were stopped

creditsRefunded
integer

Credits returned to your balance