Document: Delete v1

The delete document API endpoint allows you to delete an existing document from a memory on Langbase dynamically with the API. This endpoint requires an Org or User API key.


Generate an Org/User API key

You will need to generate an API key to authenticate your requests. For more information, visit the Org/User API key documentation.


DELETE/v1/memory/{memoryName}/documents/{documentName}

Delete a document

Delete a document by specifying the memory name and document name in the path.

Headers

  • Name
    Content-Type
    Type
    string
    Required
    Required
    Description

    Request content type. Needs to be application/json.

  • Name
    Authorization
    Type
    string
    Required
    Required
    Description

    Replace <YOUR_API_KEY> with your user/org API key.

Path Parameters

  • Name
    memoryName
    Type
    string
    Required
    Required
    Description

    The name of the memory containing the document.

    Replace {memoryName} with the name of the memory.

  • Name
    documentName
    Type
    string
    Required
    Required
    Description

    The name of the document to delete.

    Replace {documentName} with the name of the document.

DELETE
/v1/memory/{memoryName}/documents/{documentName}
import {Langbase} from 'langbase';

const langbase = new Langbase({
  apiKey: '<YOUR_API_KEY>', // Replace with your API key
});

const response = await langbase.memory.documents.delete({
  memoryName: 'knowledge-base',
  documentName: 'old-report.pdf'
});

Response

  • Name
    Response
    Type
    object
    Description

    The response object returned by the API endpoint.

    Response

    interface Response {
      success: boolean;
    }
    
    • Name
      success
      Type
      boolean
      Description

      Indicates whether the deletion was successful.

API Response

{
  "success": true
}