Abort Run
curl --request POST \
--url https://api.lobstr.io/v1/runs/{run_hash}/abort \
--header 'Authorization: <authorization>'import requests
url = "https://api.lobstr.io/v1/runs/{run_hash}/abort"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.lobstr.io/v1/runs/{run_hash}/abort', 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}/abort",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/abort"
req, _ := http.NewRequest("POST", 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.post("https://api.lobstr.io/v1/runs/{run_hash}/abort")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/runs/{run_hash}/abort")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"status": "<string>",
"is_done": true,
"done_reason": "<string>",
"total_results": 123,
"duration": 123,
"credit_used": 123
}Run
Abort Run
Stop an active run before completion
POST
/
v1
/
runs
/
{run_hash}
/
abort
Abort Run
curl --request POST \
--url https://api.lobstr.io/v1/runs/{run_hash}/abort \
--header 'Authorization: <authorization>'import requests
url = "https://api.lobstr.io/v1/runs/{run_hash}/abort"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.lobstr.io/v1/runs/{run_hash}/abort', 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}/abort",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/abort"
req, _ := http.NewRequest("POST", 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.post("https://api.lobstr.io/v1/runs/{run_hash}/abort")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/runs/{run_hash}/abort")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"status": "<string>",
"is_done": true,
"done_reason": "<string>",
"total_results": 123,
"duration": 123,
"credit_used": 123
}This endpoint aborts an active run using its hash ID. The run will stop collecting data and begin the export process for any results already gathered.
Headers
string
required
Your API authentication token. Value:
Token YOUR_API_KEYPath Parameters
string
required
The unique identifier (hash) of the run to abort. Example:
300e9c5c127d421c90f431478d9a2cfbResponse Field Explanations
string
The aborted run’s identifier. Example:
"300e9c5c127d421c90f431478d9a2cfb"string
Always “run”. Example:
"run"string
Run status (typically “uploading” immediately after abort). Example:
"uploading"boolean
Whether the run has fully completed. Example:
truestring
Will be “aborted” for manually stopped runs. Example:
"aborted"integer
Number of results collected before abort. Example:
6float
Run duration in seconds before abort. Example:
10.4498float
Credits consumed before abort. Example:
10.4498Aborted runs still export any results collected up to the point of abortion.
You will still be charged credits for the work done before aborting.
Use Get Run Stats to check progress before deciding to abort a run.
Code Examples
curl -X POST "https://api.lobstr.io/v1/runs/300e9c5c127d421c90f431478d9a2cfb/abort" \
-H "Authorization: Token YOUR_API_KEY"
import requests
run_hash = "300e9c5c127d421c90f431478d9a2cfb"
url = f"https://api.lobstr.io/v1/runs/{run_hash}/abort"
headers = {
"Authorization": "Token YOUR_API_KEY"
}
response = requests.post(url, headers=headers)
run = response.json()
print(f"Run aborted!")
print(f"Run ID: {run['id']}")
print(f"Status: {run['status']}")
print(f"Done Reason: {run['done_reason']}")
print(f"Results collected: {run['total_results']}")
print(f"Credits used: {run['credit_used']}")
Response
200
{
"id": "300e9c5c127d421c90f431478d9a2cfb",
"object": "run",
"squid": "e445405ef4ab41208ef7d29b92a1a9dd",
"is_done": true,
"started_at": "2025-02-10T14:30:55Z",
"total_results": 6,
"total_unique_results": 6,
"next_launch_at": null,
"ended_at": "2025-02-10T14:31:10Z",
"duration": 10.4498,
"credit_used": 10.4498,
"origin": "user",
"force_launch": false,
"status": "uploading",
"export_done": null,
"export_count": 0,
"export_time": null,
"email_done": null,
"email_time": null,
"created_at": "2025-02-10T14:30:55Z",
"done_reason": "aborted",
"done_reason_desc": null
}
404
{
"error": {
"message": "Run not found or already completed",
"type": "not_found_error",
"param": "run_hash"
}
}