> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. # Delete Documents DELETE https://fai.buildwithfern.com/document/{domain} Delete the documents of a domain, narrowed by the provided filters. Filters are combined with AND, so a document is only deleted when it matches all of them. At least one filter is required, or pass `all=true` to delete every document. The `x-fern-basepath` header narrows the deletion to a single basepath. Reference: https://buildwithfern.com/learn/docs/ai-features/ask-fern/api-reference/document/delete-documents ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://fai.buildwithfern.com` (Production, default) - `https://fai-dev.buildwithfern.com` (Development) - `http://localhost:8080` (Local) ## Request ### Path parameters - `domain` (string, required) ### Query parameters - `product` (string, optional, nullable) — Only delete documents whose product matches this value exactly. - `version` (string, optional, nullable) — Only delete documents whose version matches this value exactly. - `url_prefix` (string, optional, nullable) — Only delete documents whose url starts with this value. - `all` (boolean, optional, default: false) — Delete every document in the domain and basepath. Cannot be combined with the product, version or url_prefix filters. ### Headers - `x-fern-basepath` (string, optional, nullable) — The basepath of the docs site that the document belongs to, e.g. `/plants` for a site served at `docs.example.com/plants`. Omit this for sites served at the root of the domain. Documents are only retrieved by Ask Fern on the site matching the domain and basepath they were created with. ## Response ### 200 Successful Response - `success` (boolean, required) — Whether any documents were deleted - `documents_deleted` (integer, required) — The number of documents that were deleted ## Errors ### 400 Bad Request Error No filter was provided and all was not set, or all was combined with a filter. Nothing is deleted. - `any` ### 422 Unprocessable Entity Error Validation Error - `detail` (list of object, optional) - `loc` (list of string or integer, required) - `msg` (string, required) - `type` (string, required) ## Examples **Response** ```json { "success": true, "documents_deleted": 1 } ```