Document: List v1

The list document API endpoint allows you to list documents in a memory on Langbase dynamically with API. This endpoint requires a User or Org API key.


Generate a User/Org API key

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


GET/v1/memory/{memoryName}/documents

Get a list of memory documents

Get a list of documents in a memory by sending a GET request to this endpoint.

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 memory name.

    Replace {memoryName} with the memory name.

Usage example

Install the SDK

npm i langbase

Environment variables

.env file

LANGBASE_API_KEY="<YOUR_API_KEY>"

Get memory documents

GET
/v1/memory/{memoryName}/documents
curl https://api.langbase.com/v1/memory/{memoryName}/documents \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer <YOUR_API_KEY>"

Response

  • Name
    MemoryDocument[]
    Type
    array
    Description

    The response array returned by the API endpoint.

    MemoryDocument

    interface MemoryDocument { name: string; status: | 'queued' | 'in_progress' | 'completed' | 'failed'; status_message: string | null; metadata: { size: number; type: | 'application/pdf' | 'text/plain' | 'text/markdown' | 'text/csv' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'application/vnd.ms-excel'; }; enabled: boolean; chunk_size: number; chunk_overlap: number; owner_login: string; }
    • Name
      name
      Type
      string
      Description

      Name of the document.

    • Name
      status
      Type
      string
      Description

      Current processing status of the document. Can be one of:

      • queued: Document is waiting to be processed
      • in_progress: Document is currently being processed
      • completed: Document has been successfully processed
      • failed: Document processing failed
    • Name
      status_message
      Type
      string | null
      Description

      Additional details about the document's status, particularly useful when status is 'failed'.

    • Name
      metadata
      Type
      object
      Description

      Document metadata including:

      • size: Size of the document in bytes
      • type: MIME type of the document
    • Name
      enabled
      Type
      boolean
      Description

      Whether the document is enabled for retrieval.

    • Name
      chunk_size
      Type
      number
      Description

      Size of text chunks used for document processing.

    • Name
      chunk_overlap
      Type
      number
      Description

      Overlap size between consecutive text chunks.

    • Name
      owner_login
      Type
      string
      Description

      Login of the document owner.

API Response

[ { "name": "product-manual.pdf", "status": "completed", "status_message": null, "metadata": { "size": 1156, "type": "application/pdf" }, "enabled": true, "chunk_size": 10000, "chunk_overlap": 2048, "owner_login": "user123" }, { "name": "technical-specs.md", "status": "in_progress", "status_message": null, "metadata": { "size": 1156, "type": "text/markdown" }, "enabled": true, "chunk_size": 10000, "chunk_overlap": 2048, "owner_login": "user123" } ]