curl -X DELETE "https://api.moorcheh.ai/v1/namespaces/my-namespace/delete-file" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"file_name": "document.pdf"}'
curl -X DELETE "https://api.moorcheh.ai/v1/namespaces/my-namespace/delete-file" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"file_names": ["doc1.pdf", "doc2.docx", "notes.txt"]}'
{
"success": true,
"message": "File deletion process completed.",
"namespace": "my-namespace",
"results": [
{ "file_name": "document.pdf", "status": "deleted", "message": "File deletion initiated successfully" },
{ "file_name": "missing.pdf", "status": "error", "message": "File not found" }
]
}
{
"error": "Missing namespace in path or no file_name/file_names provided"
}
{
"error": "Missing or invalid API key"
}
{
"error": "Namespace not found or you do not own it"
}
{
"error": "API/credit limit exceeded"
}
File storage
Delete File
Delete one or more files from a namespace in document storage (S3).
DELETE
/
v1
/
namespaces
/
{namespace_name}
/
delete-file
curl -X DELETE "https://api.moorcheh.ai/v1/namespaces/my-namespace/delete-file" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"file_name": "document.pdf"}'
curl -X DELETE "https://api.moorcheh.ai/v1/namespaces/my-namespace/delete-file" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"file_names": ["doc1.pdf", "doc2.docx", "notes.txt"]}'
{
"success": true,
"message": "File deletion process completed.",
"namespace": "my-namespace",
"results": [
{ "file_name": "document.pdf", "status": "deleted", "message": "File deletion initiated successfully" },
{ "file_name": "missing.pdf", "status": "error", "message": "File not found" }
]
}
{
"error": "Missing namespace in path or no file_name/file_names provided"
}
{
"error": "Missing or invalid API key"
}
{
"error": "Namespace not found or you do not own it"
}
{
"error": "API/credit limit exceeded"
}
Overview
Deletes one or more files from a namespace in document storage (S3). The namespace must belong to the authenticated user. Supports single-file or multiple-file deletion in one request.Deletion is permanent (S3 DeleteObject). Deleted files are not moved to a trash. You can only delete files in namespaces you own.
Authentication
string
required
Your API key for authentication
string
required
Must be
application/json when using a JSON bodyPath Parameters
string
required
The namespace that contains the file(s). You must own this namespace.
Body Parameters
You can specify files in the body and/or via query; all are collected and deleted in one call. At least one of: bodyfile_name, body file_names, or query file_name is required.
string
Single file to delete (e.g.
"document.pdf"). Can be combined with file_names.array
Multiple files to delete (e.g.
["a.pdf", "b.docx"]). Can be combined with file_name.Query Parameters
string
Alternative way to specify a single file (e.g.
?file_name=report.pdf). Can be combined with body.Preferred field names are snake_case. Legacy camelCase (
fileName, fileNames) is still accepted for backward compatibility and returns deprecation headers (Deprecation, Sunset, Warning). CamelCase support is deprecated and scheduled for removal on 1 May 2026.Request Examples
curl -X DELETE "https://api.moorcheh.ai/v1/namespaces/my-namespace/delete-file" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"file_name": "document.pdf"}'
curl -X DELETE "https://api.moorcheh.ai/v1/namespaces/my-namespace/delete-file" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"file_names": ["doc1.pdf", "doc2.docx", "notes.txt"]}'
{
"success": true,
"message": "File deletion process completed.",
"namespace": "my-namespace",
"results": [
{ "file_name": "document.pdf", "status": "deleted", "message": "File deletion initiated successfully" },
{ "file_name": "missing.pdf", "status": "error", "message": "File not found" }
]
}
{
"error": "Missing namespace in path or no file_name/file_names provided"
}
{
"error": "Missing or invalid API key"
}
{
"error": "Namespace not found or you do not own it"
}
{
"error": "API/credit limit exceeded"
}
Success Response (200 OK)
boolean
Always
true when the request completesstring
Human-readable confirmation message
string
Name of the namespace the files were deleted from
array
One entry per file. Each has
file_name, status ("deleted" or "error"), and message. If a file does not exist, that entry has status: "error" and message: "File not found"; other files are still processed.Notes
- Only DELETE is supported for this action.
- Files are stored under
userId/namespace_name/file_name; you can only delete files in namespaces you own. - Each request counts as one API call for usage and credit limits, even when deleting multiple files.
- Deleting multiple files in one request is more efficient than separate calls.
Related Endpoints
- List Files - List file objects in storage for a namespace
- Get Upload URL - Upload files to a namespace
- Get Documents - Retrieve text documents items by ID
- Delete Data - Delete documents/vectors by ID
Was this page helpful?