Skip to main content
DELETE
https://api.moorcheh.ai
/
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 '{"fileName": "document.pdf"}'
{
  "success": true,
  "message": "File deletion process completed.",
  "namespace": "my-namespace",
  "results": [
    { "fileName": "document.pdf", "status": "deleted", "message": "File deletion initiated successfully" },
    { "fileName": "missing.pdf", "status": "error", "message": "File not found" }
  ]
}

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

x-api-key
string
required
Your API key for authentication
Content-Type
string
required
Must be application/json when using a JSON body

Path Parameters

namespace_name
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: body fileName, body fileNames, or query fileName is required.
fileName
string
Single file to delete (e.g. "document.pdf"). Can be combined with fileNames.
fileNames
array
Multiple files to delete (e.g. ["a.pdf", "b.docx"]). Can be combined with fileName.

Query Parameters

fileName
string
Alternative way to specify a single file (e.g. ?fileName=report.pdf). Can be combined with body.

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 '{"fileName": "document.pdf"}'
{
  "success": true,
  "message": "File deletion process completed.",
  "namespace": "my-namespace",
  "results": [
    { "fileName": "document.pdf", "status": "deleted", "message": "File deletion initiated successfully" },
    { "fileName": "missing.pdf", "status": "error", "message": "File not found" }
  ]
}

Success Response (200 OK)

success
boolean
Always true when the request completes
message
string
Human-readable confirmation message
namespace
string
Name of the namespace the files were deleted from
results
array
One entry per file. Each has fileName, 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/fileName; 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.