Skip to content
Get started

Bulk delete documents

client.documents.deleteBulk(DocumentDeleteBulkParams { containerTags, filepath, ids } body, RequestOptionsoptions?): DocumentDeleteBulkResponse { deletedCount, success, containerTags, errors }
DELETE/v3/documents/bulk

Bulk delete documents by IDs or container tags

ParametersExpand Collapse
body: DocumentDeleteBulkParams { containerTags, filepath, ids }
DeprecatedcontainerTags?: Array<string>

Array of container tags - all documents in these containers will be deleted

filepath?: string

Delete documents matching this filepath. Exact match for full paths, prefix match if ending with /

ids?: Array<string>

Array of document IDs to delete (max 100 at once)

ReturnsExpand Collapse
DocumentDeleteBulkResponse { deletedCount, success, containerTags, errors }

Response for bulk document deletion

deletedCount: number

Number of documents successfully deleted

success: boolean

Whether the bulk deletion was successful

DeprecatedcontainerTags?: Array<string>

Container tags that were processed (only applicable when deleting by container tags)

errors?: Array<Error>

Array of errors for documents that couldn’t be deleted (only applicable when deleting by IDs)

id: string
error: string

Bulk delete documents

import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env['SUPERMEMORY_API_KEY'], // This is the default and can be omitted
});

const response = await client.documents.deleteBulk();

console.log(response.deletedCount);
{
  "deletedCount": 2,
  "success": true,
  "containerTags": [
    "string"
  ],
  "errors": [
    {
      "id": "id",
      "error": "error"
    }
  ]
}
Returns Examples
{
  "deletedCount": 2,
  "success": true,
  "containerTags": [
    "string"
  ],
  "errors": [
    {
      "id": "id",
      "error": "error"
    }
  ]
}