Delete an uploaded file
curl --request DELETE \
--url https://transform.unstructured.io/api/v2/upload/{fileId} \
--header 'unstructured-api-key: <api-key>'import requests
url = "https://transform.unstructured.io/api/v2/upload/{fileId}"
headers = {"unstructured-api-key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'unstructured-api-key': '<api-key>'}};
fetch('https://transform.unstructured.io/api/v2/upload/{fileId}', 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/upload/{fileId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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/upload/{fileId}"
req, _ := http.NewRequest("DELETE", 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.delete("https://transform.unstructured.io/api/v2/upload/{fileId}")
.header("unstructured-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://transform.unstructured.io/api/v2/upload/{fileId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["unstructured-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "unauthorized",
"message": "Authentication required: send either an 'unstructured-api-key' header or 'Authorization: Bearer <token>'."
}{
"code": "internal_error",
"message": "The file operation could not be completed. Retry the request."
}API endpoints
Delete an uploaded file
Delete an uploaded file before it expires. Review the HTTP 204 response, including when the file ID is already deleted or was never valid.
DELETE
/
api
/
v2
/
upload
/
{fileId}
Delete an uploaded file
curl --request DELETE \
--url https://transform.unstructured.io/api/v2/upload/{fileId} \
--header 'unstructured-api-key: <api-key>'import requests
url = "https://transform.unstructured.io/api/v2/upload/{fileId}"
headers = {"unstructured-api-key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'unstructured-api-key': '<api-key>'}};
fetch('https://transform.unstructured.io/api/v2/upload/{fileId}', 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/upload/{fileId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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/upload/{fileId}"
req, _ := http.NewRequest("DELETE", 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.delete("https://transform.unstructured.io/api/v2/upload/{fileId}")
.header("unstructured-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://transform.unstructured.io/api/v2/upload/{fileId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["unstructured-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "unauthorized",
"message": "Authentication required: send either an 'unstructured-api-key' header or 'Authorization: Bearer <token>'."
}{
"code": "internal_error",
"message": "The file operation could not be completed. Retry the request."
}Delete an uploaded file before it expires. The response is HTTP 204, including when the file ID is already deleted or was never valid.
Start with Parse your first document.
Authorizations
ApiKeyAuthBearerAuth
Path Parameters
The ID of the uploaded file.
Response
File deleted, or already absent. No body. Deletion is idempotent, so a repeated or unknown file id is not distinguishable from a first successful delete.
Was this page helpful?

