jobId. This is useful if you submitted a job with wrong parameters or no longer need the data.
Stop Request
Only active jobs (
in_progress)curl --request DELETE \
--url 'https://api.hasdata.com/scrapers/jobs/:jobId' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>'
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: 'https://api.hasdata.com/scrapers/jobs/:jobId',
headers: {'Content-Type': 'application/json', 'x-api-key': '<your-api-key>'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
import requests
url = "https://api.hasdata.com/scrapers/jobs/:jobId"
headers = {
"Content-Type": "application/json",
"x-api-key": "<your-api-key>"
}
response = requests.delete(url, headers=headers)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hasdata.com/scrapers/jobs/:jobId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <your-api-key>",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.hasdata.com/scrapers/jobs/:jobId")
.delete()
.addHeader("Content-Type", "application/json")
.addHeader("x-api-key", "<your-api-key>")
.build();
Response response = client.newCall(request).execute();
using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("DELETE"), "https://api.hasdata.com/scrapers/jobs/:jobId");
request.Headers.Add("x-api-key", "<your-api-key>");
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
require 'net/http'
require 'uri'
uri = URI("https://api.hasdata.com/scrapers/jobs/:jobId")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(uri)
request["Content-Type"] = 'application/json'
request["x-api-key"] = '<your-api-key>'
response = http.request(request)
puts response.read_body
use reqwest::blocking::Client;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client
.delete("https://api.hasdata.com/scrapers/jobs/:jobId")
.header("Content-Type", "application/json")
.header("x-api-key", "<your-api-key>")
.send()?
.text()?;
println!("{}", res);
Ok(())
}
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("DELETE", "https://api.hasdata.com/scrapers/jobs/:jobId", nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("x-api-key", "<your-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Behavior
If the job is still running, all in-progress pages will finish scraping, but no new pages will be started.
- Any data collected up to that point is preserved and can still be fetched.
- Credits are only charged for successfully scraped pages, even if the job was stopped early.
- If the job has already finished or failed, the stop request has no effect.
Response Example
{
"jobId": "dd1a8c53-2d47-4444-977d-8d653a6a3c82",
"status": "stopped",
"creditsSpent": 200,
"dataRowsCount": 20,
"input": {
/* job parameters */
}
}