Request cancellation of a parse or extraction job
curl --request POST \
--url https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel \
--header 'unstructured-api-key: <api-key>'import requests
url = "https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel"
headers = {"unstructured-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'unstructured-api-key': '<api-key>'}};
fetch('https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel', 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://transform.unstructured.io/api/v2/jobs/{jobId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"unstructured-api-key: <api-key>"
],
]);
$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://transform.unstructured.io/api/v2/jobs/{jobId}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("unstructured-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel")
.header("unstructured-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["unstructured-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "9eb6c914-02a5-4c5d-8490-a06476946a38",
"status": "queued",
"file_id": "<string>",
"request_source": "transform-ui",
"filename": "<string>",
"cancellation_requested": false,
"source": {
"file_id": "<string>",
"filename": "<string>",
"mimetype": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
},
"error": {
"code": "invalid_input",
"message": "<string>"
},
"configuration": {
"profile": "balanced",
"advanced_options": {
"enrichments": {
"image_description": true
}
}
},
"result": {
"id": "<string>",
"status": "processing",
"profile": "balanced",
"markdown": "<string>",
"format_version": "<string>",
"metadata": {
"page_count": 123
},
"extracted_data": [
{
"data": "<unknown>",
"field_metadata": {}
}
],
"elements": [
{
"element_id": "<string>",
"type": "<string>",
"text": "<string>",
"metadata": {
"page_number": 123,
"coordinates": "<unknown>",
"text_as_html": "<string>",
"parse_confidence": 0.5,
"start_time": 1,
"end_time": 1,
"speaker": "<string>",
"speaker_scope": "<string>",
"language": "<string>"
}
}
],
"source": {
"file_id": "<string>",
"filename": "<string>",
"mimetype": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
},
"warnings": [],
"failed_pages": [],
"degraded_pages": []
},
"parse_id": "9eb6c914-02a5-4c5d-8490-a06476946a38",
"page_count": 1
}API endpoints
Request cancellation of a job
Request cancellation of a queued or processing job. Read the returned job snapshot and keep polling until the job reaches a final status.
POST
/
api
/
v2
/
jobs
/
{jobId}
/
cancel
Request cancellation of a parse or extraction job
curl --request POST \
--url https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel \
--header 'unstructured-api-key: <api-key>'import requests
url = "https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel"
headers = {"unstructured-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'unstructured-api-key': '<api-key>'}};
fetch('https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel', 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://transform.unstructured.io/api/v2/jobs/{jobId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"unstructured-api-key: <api-key>"
],
]);
$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://transform.unstructured.io/api/v2/jobs/{jobId}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("unstructured-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel")
.header("unstructured-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://transform.unstructured.io/api/v2/jobs/{jobId}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["unstructured-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "9eb6c914-02a5-4c5d-8490-a06476946a38",
"status": "queued",
"file_id": "<string>",
"request_source": "transform-ui",
"filename": "<string>",
"cancellation_requested": false,
"source": {
"file_id": "<string>",
"filename": "<string>",
"mimetype": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
},
"error": {
"code": "invalid_input",
"message": "<string>"
},
"configuration": {
"profile": "balanced",
"advanced_options": {
"enrichments": {
"image_description": true
}
}
},
"result": {
"id": "<string>",
"status": "processing",
"profile": "balanced",
"markdown": "<string>",
"format_version": "<string>",
"metadata": {
"page_count": 123
},
"extracted_data": [
{
"data": "<unknown>",
"field_metadata": {}
}
],
"elements": [
{
"element_id": "<string>",
"type": "<string>",
"text": "<string>",
"metadata": {
"page_number": 123,
"coordinates": "<unknown>",
"text_as_html": "<string>",
"parse_confidence": 0.5,
"start_time": 1,
"end_time": 1,
"speaker": "<string>",
"speaker_scope": "<string>",
"language": "<string>"
}
}
],
"source": {
"file_id": "<string>",
"filename": "<string>",
"mimetype": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
},
"warnings": [],
"failed_pages": [],
"degraded_pages": []
},
"parse_id": "9eb6c914-02a5-4c5d-8490-a06476946a38",
"page_count": 1
}Request cancellation of a queued or processing job. The response returns its current status; keep polling to confirm the outcome.
Start with Parse your first document.
Authorizations
ApiKeyAuthBearerAuth
Path Parameters
Response
The current job state after the cancellation request.
A job's state, carrying parsed content as soon as it is available.
Was this page helpful?

