Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions www/docs/rest-api/bulk-delete-corpus-documents.api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
id: bulk-delete-corpus-documents
title: "Bulk delete documents from a corpus"
description: "Initiates an asynchronous bulk delete operation for documents in a corpus."
sidebar_label: "Bulk delete documents from a corpus"
hide_title: true
hide_table_of_contents: true
api: eJztWXtv20YS/yqDxQFtXVGS3abo6drDubUDuK8EiXPANQ6sFXcobkTuMrtLyaqh736YWVKkHnGTpj0Uxf1Jcneev3nyXgQ592LyUlzYtC7RBC9eDcRd4uuqsi6gSmSlkwWuk7CukA5eGYV3z9EtdYpiIJ6i89bIgq4p9KnTVdDWiIm4MjpoGdCDNCD92qS5s8bWHmZ1sQCFBQYEW6GTdAMy60C1UoA2ICG1rqr98MZc59r3jso0xSp4kFBikEoGCZkuAroBSCi0D2Az8BWmOtPplihcXfgBWAczG/LhjbkxJydXJakpTTg5mQBz0UR2hj4kmGXWhY7t8MY8R4SQIzj0lTUewac5lnLLoqcJBqkLD9bwhRnmcqnpvc4ydGhS9DDDsEI0MG21uI1aTEEaBdOW6K1WfgqVdLLEgM6z6Nd533auNh4kSy7TxdzZ2ihYWbfICrsa3pgXvpU71M6ggulrO7vVagrBQnAyXUDl7Nyh97DUks9+Z2cezp9eDW+MGIgtryslJoI8eMEO/JZd1KFnIDpBxeTlvdCEhRylQicGwsgSxUQ8wzc1mfhal2jrIPaxQ9qdP72ClS4KKOUCG59A45NgIbVlxQiKejE9Qg09Nq5HBR5Ta5QnrwddItg6DMVARLeJyb2IsBbaBJyzhKU2uqxLMTndDATR1Q6VmGSy8LgZvJs+yY+6KLT/49Qqmf6H6LZVpZIh7xSJEXe7wPVR4Wuj39QIC1yDVmiCztbazFm4eBNSa4LUht52wRxsE+4kX2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zDUxTlhez03MFzMkPWsd9DIWzcxy9ZY0LhklnWIbZnUBPrg6pd6atxoJi8l1zwSau3jlpT2cnCzPTk6GdGLaV2zakKYFR67R8aKL5qYtXRqMePa2K3Sp9FGgfF3lyCYGoLmrKZMDmG7DbNKFWRdl0zgGNZJRCz4cD8eU9NCV/knW5pAOs61XUluOCpzLYsRHE5slPh4ecYIr7JzBthu4yqZ+2Cehy3lL8nZlnSqlWwwrLvWyCNd4FzqgCs6uSrrFh1C/LfQ8Dw/x4O485dqLpdTEIUNU9L/hXz3qHFOV9aGUXJObmOvv3bopilc37T53P8ruu3L//39Jf6l/SU2WDngXRlUhtSF8MWjvm1L4UnDWbaJUDMRk98dE/2dlbn2gG/f3lF1fuGKzoddxQ011T2lPe8Ruh/xWmP3JtvVH7RSbjsOfEG23wZ3Ju6v8+6/sH5B6709CJ/IrenC87n1Pl338rNmCfAK/1w+qowq0nYVZ9wVvFeuhc/NqM2hbjvdT5Y/+6fmAYw7/x/5GOP1P/nC+uyLdj9gdfeLZc878vW8HM+VOt35x+cPl9aXYbP4Ly+vBkA==
sidebar_class_name: "delete api-method"
info_path: docs/rest-api/vectara-rest-api-v-2
custom_edit_url: null
---

import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";

<Heading
as={"h1"}
className={"openapi__heading"}
children={"Bulk delete documents from a corpus"}
>
</Heading>

<MethodEndpoint
method={"delete"}
path={"/v2/corpora/{corpus_key}/documents"}
context={"endpoint"}
>

</MethodEndpoint>



Initiates an asynchronous bulk delete operation for documents in a corpus.
This operation accepts a metadata filter, a list of specific document IDs, or both.

**Important**: This is a best-effort operation.
See the response schema documentation for details on the behavior differences between `metadata_filter` and `document_ids` parameters.

The operation runs as a background workflow.
Use the returned `job_id` to track progress via the Jobs API.


<Heading
id={"request"}
as={"h2"}
className={"openapi-tabs__heading"}
children={"Request"}
>
</Heading>

<ParamsDetails
parameters={[{"in":"header","name":"Request-Timeout","description":"The API will make a best effort to complete the request in the specified seconds or time out.","schema":{"type":"integer","minimum":1},"required":false},{"in":"header","name":"Request-Timeout-Millis","description":"The API will make a best effort to complete the request in the specified milliseconds or time out.","schema":{"type":"integer","minimum":1}},{"in":"path","name":"corpus_key","description":"The unique key identifying the corpus containing documents to delete.","required":true,"schema":{"description":"A user-provided key for a corpus.","type":"string","example":"my-corpus","pattern":"[a-zA-Z0-9_\\=\\-]+$","maxLength":50,"title":"CorpusKey"}},{"name":"metadata_filter","in":"query","description":"Filter documents by metadata. Uses the same expression as a query metadata filter.\nExample: `doc.status = 'archived' AND doc.year < 2020`\n","required":false,"schema":{"type":"string"}},{"name":"document_ids","in":"query","description":"Comma-separated list of document IDs to delete. Maximum 10,000 IDs per request.","required":false,"schema":{"type":"string"}}]}
>

</ParamsDetails>

<RequestSchema
title={"Body"}
body={undefined}
>

</RequestSchema>

<StatusCodes
id={undefined}
label={undefined}
responses={{"202":{"description":"Bulk delete operation accepted and queued.","content":{"application/json":{"schema":{"description":"Response containing the job ID for tracking the bulk delete operation.\n\n**Important: Best-Effort Operation**\n\nThis is a best-effort deletion operation. The behavior differs based on which parameter you use:\n\n**Using `document_ids` (Recommended for precision)**\n- Deletes only the exact documents specified by ID\n- Most reliable option - documents are deleted from the primary storage directly\n- Use this when you know exactly which documents to delete\n\n**Using `metadata_filter` (Subject to indexing lag)**\n- Filters are applied against the search index, not the primary document store\n- Documents that have been recently indexed may not yet appear in search results due to indexing pipeline lag\n- This means recently added documents matching your filter may be missed\n- A timestamp cutoff is captured at operation start; only documents created/updated before this time are deleted\n- Due to distributed system timing, documents added very close to the operation start may still be deleted if timestamps are not perfectly synchronized\n\nFor mission-critical deletions where completeness is required, use `document_ids` or run the filter-based deletion multiple times after indexing has caught up.\n","type":"object","properties":{"job_id":{"description":"Job ID to track the bulk delete operation progress via the Jobs API.","type":"string","pattern":"job_.+$","example":"job_bulk_del_123456"},"cutoff_timestamp":{"description":"ISO 8601 timestamp captured at workflow launch. Only documents created or updated before this timestamp will be deleted.","type":"string","format":"date-time","example":"2025-12-18T15:30:00Z"}},"required":["job_id","cutoff_timestamp"],"title":"BulkDeleteDocumentsResponse"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"description":"Error returned when a request contains invalid parameters or violates schema validation.","type":"object","properties":{"field_errors":{"description":"The errors that relate to specific fields in the request.","type":"object","additionalProperties":{"type":"string"}},"messages":{"type":"array","items":{"title":"message","type":"string"}},"request_id":{"description":"The ID of the request that can be used to help Vectara support debug what went wrong.","type":"string"}},"title":"BadRequestError"}}}},"403":{"description":"Permissions do not allow bulk deleting documents.","content":{"application/json":{"schema":{"description":"A general error response with an error code and message.","type":"object","properties":{"messages":{"description":"The messages describing why the error occurred.","type":"array","items":{"title":"message","type":"string","example":"Internal server error."}},"request_id":{"description":"The ID of the request that can be used to help Vectara support debug what went wrong.","type":"string"}},"title":"Error"}}}},"404":{"description":"Corpus not found.","content":{"application/json":{"schema":{"description":"Error returned when a requested resource does not exist.","type":"object","properties":{"id":{"description":"The ID cannot be found.","type":"string"},"messages":{"type":"array","items":{"title":"message","type":"string"}},"request_id":{"description":"The ID of the request that can be used to help Vectara support debug what went wrong.","type":"string"}},"title":"NotFoundError"}}}}}}
>

</StatusCodes>



Loading
Loading