Batch
Batch tasks
Some answers don't fit in one request. A product with 8,000 reviews is 400 pages; asking for all of them is a job, not a call. Queue a task, and collect the result when it's done.
The lifecycle
| Call | What it does |
|---|---|
| POST /v1/tasks | Queues the job. Answers 202 with a taskId. Bad parameters come back here as a 400, not as a failed task minutes later. |
| GET /v1/tasks/{id} | Status and progress: completedPages of totalPages, items so far, credits spent. |
| GET /v1/tasks?status=done | Your finished jobs. Also queued, running, failed, cancelled, exhausted. |
| GET /v1/tasks/{id}/result | The data, a slice of pages at a time. Readable while the task is still running — start consuming page 0 before page 400 exists. |
| DELETE /v1/tasks/{id} | Cancels. A running task stops at its next page boundary; the pages it already fetched stay readable and stay charged. |
Queue a task
curl --request POST 'https://data-api.roketfy.com/v1/tasks' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"platform": "trendyol",
"endpoint": "reviews",
"params": { "contentId": "444174053" },
"maxPages": 50
}'params is exactly what the endpoint itself takes — the same validation, the same defaults. maxPages caps the run; leave it out and the task walks every page the endpoint reports.
Read the result
curl 'https://data-api.roketfy.com/v1/tasks/TASK_ID/result?limit=10' \
--header 'Authorization: Bearer YOUR_TOKEN'Pages come back in upstream order. Feed the response's nextAfter back as ?after= to walk the rest.
Credits and retention
- One page, one charge, at the endpoint's own rate. A 400-page review run costs 400 credits. Pages that fail cost nothing, exactly as with a live request.
- A failed task keeps what its finished pages cost — it is not refunded, and it is not charged for the pages it never fetched.
- A run stops when your credits do. The balance is checked before every page, so a long job can never spend past your monthly ceiling. The task ends as
exhausted— notfailed— and the pages it did fetch stay readable. Queueing a task with no credits left is refused outright with402 insufficient_credits, the same answer a live call gets. - Results stay readable for 7 days, then expire with the task.
- Batch runs have their own concurrency ceiling, separate from the live one — a long job never eats the slots your real-time calls need.