Get Run Stats
curl --request GET \
--url https://api.lobstr.io/v1/runs/{run_hash}/stats \
--header 'Authorization: <authorization>'import requests
url = "https://api.lobstr.io/v1/runs/{run_hash}/stats"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.lobstr.io/v1/runs/{run_hash}/stats', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lobstr.io/v1/runs/{run_hash}/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.lobstr.io/v1/runs/{run_hash}/stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.lobstr.io/v1/runs/{run_hash}/stats")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/runs/{run_hash}/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"duration": "<string>",
"started_at": "<string>",
"ended_at": {},
"is_done": true,
"percent_done": "<string>",
"eta": "<string>",
"total_tasks": 123,
"total_tasks_done": 123,
"total_tasks_left": 123,
"total_results": 123,
"results_total": 123,
"results_done": 123,
"current_task": "<string>",
"updated_at": "<string>"
}Run
Get Run Stats
Retrieve detailed statistics about a specific run
GET
/
v1
/
runs
/
{run_hash}
/
stats
Get Run Stats
curl --request GET \
--url https://api.lobstr.io/v1/runs/{run_hash}/stats \
--header 'Authorization: <authorization>'import requests
url = "https://api.lobstr.io/v1/runs/{run_hash}/stats"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.lobstr.io/v1/runs/{run_hash}/stats', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lobstr.io/v1/runs/{run_hash}/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.lobstr.io/v1/runs/{run_hash}/stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.lobstr.io/v1/runs/{run_hash}/stats")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/runs/{run_hash}/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"duration": "<string>",
"started_at": "<string>",
"ended_at": {},
"is_done": true,
"percent_done": "<string>",
"eta": "<string>",
"total_tasks": 123,
"total_tasks_done": 123,
"total_tasks_left": 123,
"total_results": 123,
"results_total": 123,
"results_done": 123,
"current_task": "<string>",
"updated_at": "<string>"
}This endpoint retrieves detailed real-time statistics about a specific run, including progress information, estimated time remaining, and task completion status.
Headers
string
required
Your API authentication token. Value:
Token YOUR_API_KEYPath Parameters
string
required
The unique identifier (hash) of the run. Example:
300e9c5c127d421c90f431478d9a2cfbResponse Field Explanations
string
The run’s unique identifier. Example:
"300e9c5c127d421c90f431478d9a2cfb"string
Always “run”. Example:
"run"string
Human-readable duration (HH:MM:SS format). Example:
"0:00:15.175532"string
When the run started. Example:
"2025-02-10T14:30:55"string | null
When the run ended (null if still running). Example:
"2025-02-10T14:31:10"boolean
Whether the run has completed. Example:
truestring
Completion percentage. Example:
"100%"string
Estimated time remaining (”∞” if unknown). Example:
"∞"integer
Total number of tasks in the run. Example:
10integer
Number of tasks completed. Example:
10integer
Number of tasks remaining. Example:
0integer
Total results collected in this run. Example:
6integer
Expected total results (if known). Example:
138integer
Results collected so far. Example:
6string
Currently executing task (empty if none). Example:
""string
Last update timestamp. Example:
"2025-02-10T14:31:10"Poll this endpoint periodically to display real-time progress in your application.
The eta field provides an estimate but may show ”∞” for runs with unpredictable completion times.
Use percent_done for progress bars and total_tasks_left to show remaining work.
Code Examples
curl -X GET "https://api.lobstr.io/v1/runs/300e9c5c127d421c90f431478d9a2cfb/stats" \
-H "Authorization: Token YOUR_API_KEY"
import requests
import time
run_hash = "300e9c5c127d421c90f431478d9a2cfb"
url = f"https://api.lobstr.io/v1/runs/{run_hash}/stats"
headers = {
"Authorization": "Token YOUR_API_KEY"
}
# Poll for progress updates
while True:
response = requests.get(url, headers=headers)
stats = response.json()
print(f"Progress: {stats['percent_done']}")
print(f"Tasks: {stats['total_tasks_done']}/{stats['total_tasks']} completed")
print(f"Results: {stats['results_done']}/{stats['results_total']}")
print(f"Duration: {stats['duration']}")
print(f"ETA: {stats['eta']}")
print("---")
if stats['is_done']:
print("Run completed!")
break
time.sleep(5) # Poll every 5 seconds
Response
200
{
"id": "300e9c5c127d421c90f431478d9a2cfb",
"object": "run",
"duration": "0:00:15.175532",
"ended_at": "2025-02-10T14:31:10",
"eta": "∞",
"is_done": true,
"percent_done": "100%",
"started_at": "2025-02-10T14:30:55",
"total_requests": null,
"total_results": 6,
"total_tasks": 10,
"total_tasks_done": 10,
"total_tasks_left": 0,
"current_task": "",
"results_total": 138,
"results_done": 6,
"updated_at": "2025-02-10T14:31:10"
}
404
{
"error": {
"message": "Run not found",
"type": "not_found_error",
"param": "run_hash"
}
}