Cancel job
Table of contents
Important
We will be officially sunsetting v1. Starting from March 1, 2024 all calls will be routed to v2 endpoints. Although this change will be transparent to our customers we strongly advise you to update your code to use the v2 endpoints as they provide many more options.
Cancel execution of job created by
https://api.useapi.net/v1/jobs/cancel/?jobid=
jobid
Request Headers
Authorization: Bearer {API token}
API token
is required, see Setup useapi.net for details.
Query Parameters
jobid
is required, use value returned by jobs/imagine or jobs/button
Responses
-
{ "jobid": "<jobid>", "status": "cancelled" } "code": 200
-
{ "error": "Query param jobid not provided", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Unable to locate job <jobid>", "code": 404 }
Examples
-
curl https://api.useapi.net/v1/jobs/cancel/?jobid=… \ -H "Accept: application/json" \ -H "Authorization: Bearer …"
-
const token = "API token"; const jobid = "jobid returned by jobs/imagine or jobs/button"; const apiUrl = `https://api.useapi.net/v1/jobs/cancel/?jobid=${jobid}`; const response = await fetch(apiUrl, { headers: { "Authorization": `Bearer ${token}`, }, }); const result = await response.json(); console.log("response", {response, result});
-
import requests token = "API token" jobid = "jobid returned by jobs/imagine or jobs/button" apiUrl = f"https://api.useapi.net/v1/jobs/cancel/?jobid={jobid}" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } response = requests.get(apiUrl, headers=headers) print(response, response.json())