Build a usage dashboard
Show your balance, spend, success rate, failing sites and recent jobs in your own dashboard with the analytics, list and transactions endpoints.
Five read-only calls cover a full usage dashboard for the account behind your API key. None of them costs credits.
| Widget | Call |
|---|---|
| Credits left | GET /users/@me/balance |
| Spend, success rate, charts, top sites | GET /task/analytics/dashboard |
| Recent jobs and crawls | GET /job |
| Failed tasks to look into | GET /task?status=failed |
| Purchases, usage and refunds | GET /users/@me/transactions |
Dates are YYYY-MM-DD in UTC. end_date is inclusive, so start_date=2026-09-01&end_date=2026-09-30 covers all of September.
Balance
curl https://scraping-api.datafuel.ai/api/v1/users/@me/balance \
--header "X-API-Key: df_key_your_key_here"
{ "balance": 4820 }
Totals and charts
curl "https://scraping-api.datafuel.ai/api/v1/task/analytics/dashboard?start_date=2026-09-01&end_date=2026-09-30&interval=daily" \
--header "X-API-Key: df_key_your_key_here"
Without dates you get the last 30 days. The range can span up to 365 days. interval is hourly, daily (default), weekly or monthly, and module=unlocker limits everything to one task type.
The response has five parts:
summary:total_tasks,credits_used,success_rate(percent of tasks that completed),avg_credits_per_request,avg_duration_ms, andprevious_periodwith the same figures for the equally long period before, plus the change in percent. Use it for the headline tiles and their trend arrows.timeseries: one entry per bucket withtotal,completed,failedandcredits_used. Plot it as a stacked bar or line chart.by_module: one entry per task type with its ownsuccess_rate,avg_credits_per_request,avg_duration_msand astatus_codesbreakdown.top_targets: the hosts you scrape most, with their completed and failed counts. A host with many failures is the first place to tryjs_renderingor a Premium proxy.by_status_code: how many tasks got each HTTP status from the target, withcompleted,failedandcredits_used.status_code0 means there was no HTTP response at all, usually a timeout or a DNS failure.
credits_used is the net charge: failed tasks are refunded and count 0. The figures are cached for 2 minutes, so a dashboard that refreshes every minute or two costs you nothing extra.
Recent jobs and crawls
curl "https://scraping-api.datafuel.ai/api/v1/job?limit=20" \
--header "X-API-Key: df_key_your_key_here"
{
"jobs": [
{
"id": "9f1d3c2a-4b6e-4f8a-9c7d-2e5b8a1f0d43",
"type": "crawl",
"status": "completed",
"tasks_count": 120,
"tasks_done": 120,
"tasks_remaining": 0,
"total_cost": 120,
"created_at": "2026-09-29T10:00:00Z",
"updated_at": "2026-09-29T10:04:31Z"
}
],
"next_cursor": "MTc1OTEzOTYwMDAwMDAwMDAwMHw5ZjFkM2MyYS0…"
}
Filter with status (pending, processing, completed, completed_with_errors, failed, cancelled), type (unlocker, llm_scraping, serp, crawl) and start_date / end_date. total_cost is charged at queue time and does not subtract refunds; the transactions below do.
Tasks that failed
curl "https://scraping-api.datafuel.ai/api/v1/task?status=failed&start_date=2026-09-29" \
--header "X-API-Key: df_key_your_key_here"
Each task has id, job_id (null for a single scrape), type, status, url, credit_cost, created_at and processed_at or failed_at. Add job_id=… to list the tasks of one job or crawl. The list never includes the scraped content; open a task with GET /task/{id} to see its result, status_code and error.
Paging through lists
GET /job and GET /task return newest first, 50 per call by default (limit up to 200). When there are more, the response has next_cursor: send it back as cursor with the same filters. The last page has no next_cursor.
curl "https://scraping-api.datafuel.ai/api/v1/task?status=failed&cursor=MTc1OTEzOTYwMDAwMDAwMDAwMHw5ZjFkM2MyYS0…" \
--header "X-API-Key: df_key_your_key_here"
Credit movements
curl "https://scraping-api.datafuel.ai/api/v1/users/@me/transactions?start_date=2026-09-01&end_date=2026-09-30&limit=50" \
--header "X-API-Key: df_key_your_key_here"
{
"transactions": [
{
"id": 48213,
"amount": 100,
"operation": "refund",
"reference_type": "task_id",
"reference_id": "9c1f2e3d-4b5a-4c6d-8e7f-a0b1c2d3e4f5",
"balance_after": 4820,
"created_at": "2026-09-29T09:58:40Z"
}
],
"total_count": 312,
"sums": [
{ "operation": "usage", "total": -2240, "count": 290 },
{ "operation": "refund", "total": 380, "count": 21 },
{ "operation": "purchase", "total": 5000, "count": 1 }
]
}
amount is positive for credits in (purchase, topup, plan_assignment, refund) and negative for credits out (usage, expiry). balance_after is your balance right after the movement, ready for a balance-over-time chart. sums totals each operation over the whole range, not just this page, so usage plus refund is your net spend. This list pages with page (from 1) and limit (default 10, max 200); total_count tells you how many pages there are. Filter with operation=refund and the same dates.
Errors
A malformed limit, page or job_id answers 400 INVALID_QUERY_PARAM, a bad date 400 INVALID_DATE_FORMAT, an end before the start 400 INVALID_DATE_RANGE, and a cursor that was edited or cut 400 INVALID_CURSOR. See Errors and how to handle them.