Delete several files
Deletes 1 to 100 files and returns a result for each. Pages that use a deleted file show it as missing. Requires admin role.
curl -X POST "https://api.documentationai.app/api/v1/media/bulk-delete" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"mediaIds": [
"123e4567-e89b-12d3-a456-426614174000"
]
}'
import requests
import json
url = "https://api.documentationai.app/api/v1/media/bulk-delete"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"mediaIds": [
"123e4567-e89b-12d3-a456-426614174000"
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.documentationai.app/api/v1/media/bulk-delete", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"mediaIds": [
"123e4567-e89b-12d3-a456-426614174000"
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"mediaIds": [
"123e4567-e89b-12d3-a456-426614174000"
]
}`)
req, err := http.NewRequest("POST", "https://api.documentationai.app/api/v1/media/bulk-delete", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.documentationai.app/api/v1/media/bulk-delete')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"mediaIds": [
"123e4567-e89b-12d3-a456-426614174000"
]
}'
response = http.request(request)
puts response.body
{
"deleted": [
"123e4567-e89b-12d3-a456-426614174000"
],
"failed": [
{
"source": "4c1d8a2e-7b3f-4f0a-9d6e-2a5b8c7e1f03",
"error": "File not found"
}
],
"reclaimedBytes": 184233
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Please try again later",
"code": 429,
"retryAfter": 3600
}
/media/bulk-delete
Target server for requests. Edit to use your own host.
API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Authorization: Bearer dai_...The media type of the request body
The id of each file to delete
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. API key generated from the Documentation.AI dashboard (Settings → API Keys). Pass as Authorization: Bearer dai_...
Body
The id of each file to delete
Responses
Identifiers of the files that were deleted
Files that were not deleted, each with the reason
Storage freed by this request, in bytes