Delete a job
Deletes the job with all its tasks and files right away.
DELETE
https://api.switchfile.io/v2/jobs/{id}Example
Request
curl -X DELETE "https://api.switchfile.io/v2/jobs/6e2c1b1f-3c1a-4d4e-9a57-0d7b2f6a8e10" \
-H "Authorization: Bearer $SWITCHFILE_API_KEY"const res = await fetch("https://api.switchfile.io/v2/jobs/6e2c1b1f-3c1a-4d4e-9a57-0d7b2f6a8e10", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.SWITCHFILE_API_KEY}`,
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(res.status);<?php
$ch = curl_init('https://api.switchfile.io/v2/jobs/6e2c1b1f-3c1a-4d4e-9a57-0d7b2f6a8e10');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWITCHFILE_API_KEY'),
],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
echo $status, PHP_EOL;import os
import requests
res = requests.delete(
"https://api.switchfile.io/v2/jobs/6e2c1b1f-3c1a-4d4e-9a57-0d7b2f6a8e10",
headers={"Authorization": f"Bearer {os.environ['SWITCHFILE_API_KEY']}"},
)
res.raise_for_status()
print(res.status_code)Parameters
Path parameters
idstring (uuid)requiredID of the job
Responses
- 204Deleted
401The API key is missing or not valid
UNAUTHENTICATED401 application/json{ "message": "Missing or invalid API key.", "code": "UNAUTHENTICATED" }404Does not exist for this account
NOT_FOUND404 application/json{ "message": "Job not found.", "code": "NOT_FOUND" }411The request has a body but no Content-Length header
LENGTH_REQUIRED411 application/json{ "message": "A Content-Length header is required for this request.", "code": "LENGTH_REQUIRED" }413The request or the file is too large
PAYLOAD_TOO_LARGE413 application/json{ "message": "The request body is larger than the allowed maximum.", "code": "PAYLOAD_TOO_LARGE" }422Invalid data. errors names the fields
INVALID_DATA422 application/json{ "message": "id: Expected string to match 'uuid' format", "code": "INVALID_DATA", "errors": { "id": [ "Expected string to match 'uuid' format" ] } }429Too many requests or a daily quota is used up. See Retry-After
RATE_LIMIT_EXCEEDED429 application/json{ "message": "Too many requests. Try again in 12 seconds.", "code": "RATE_LIMIT_EXCEEDED" }