Skip to main content
DELETE
/
v1
/
projects
/
{project_id}
/
indexes
/
{index_id}
/
files
Batch Delete Files From Index
curl --request DELETE \
  --url https://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --header 'x-selected-account-id: <api-key>' \
  --data '
{
  "file_ids": [
    "<string>"
  ]
}
'
import requests

url = "https://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files"

payload = { "file_ids": ["<string>"] }
headers = {
"x-api-key": "<api-key>",
"x-selected-account-id": "<api-key>",
"Content-Type": "application/json"
}

response = requests.delete(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'DELETE',
headers: {
'x-api-key': '<api-key>',
'x-selected-account-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({file_ids: ['<string>']})
};

fetch('https://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files', 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://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'file_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-selected-account-id: <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"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files"

payload := strings.NewReader("{\n \"file_ids\": [\n \"<string>\"\n ]\n}")

req, _ := http.NewRequest("DELETE", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-selected-account-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files")
.header("x-api-key", "<api-key>")
.header("x-selected-account-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file_ids\": [\n \"<string>\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/projects/{project_id}/indexes/{index_id}/files")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<api-key>'
request["x-selected-account-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_ids\": [\n \"<string>\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "project_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "object": "job",
  "source_id": "<string>",
  "correlation_id": "<string>",
  "started_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "result": {},
  "progress": {
    "total": 123,
    "succeeded": 123,
    "failed": 123,
    "cancelled": 123,
    "pending": 123,
    "child_jobs": [
      {
        "source_document_id": "<string>",
        "job_id": "<string>",
        "parse_result_id": "<string>",
        "error": "<string>"
      }
    ]
  },
  "error": "<string>",
  "history": [
    {
      "step": "<string>",
      "timestamp": "2023-11-07T05:31:56Z",
      "duration_ms": 123,
      "status": "<string>",
      "details": {}
    }
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

x-api-key
string
header
required

API key for authentication

x-selected-account-id
string
header
required

Selected Account ID

Path Parameters

project_id
string
required
index_id
string
required

Body

application/json

Request body for DELETE /indexes/{index_id}/files.

file_ids
string[]
required
Required array length: 1 - 1000 elements

Response

Successful Response

Job response model representing an asynchronous operation.

id
string
required

ID of the entity

project_id
string
required

ID of the project

operation
enum<string>
required

Operation type (e.g., 'parse')

Available options:
parse,
batch_parse,
extract,
research,
vector_store,
chunk,
summarization,
create_index,
update_index
status
enum<string>
required

Current job status

Available options:
pending,
running,
succeeded,
partially_succeeded,
failed,
cancelled
created_at
string<date-time>
required

When the job was created

object
string
default:job
Allowed value: "job"
source_id
string | null

Source document/file ID

correlation_id
string | null

Request correlation ID for tracing

started_at
string<date-time> | null

When the job started processing

completed_at
string<date-time> | null

When the job completed

result
Result · object | null

Job result payload when completed

progress
BatchParseProgress · object | null

Live progress payload (used by batch jobs)

error
string | null

Error message if job failed

history
JobHistoryEvent · object[] | null

Timeline of job execution events