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 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.
import {Langbase} from 'langbase';
const langbase = new Langbase({
apiKey: '<YOUR_API_KEY>', // Replace with your API key
});
const documents = await langbase.memory.documents.list({
memoryName: 'knowledge-base'
});
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 processedin_progress
: Document is currently being processedcompleted
: Document has been successfully processedfailed
: 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 bytestype
: 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": 1024,
"chunk_overlap": 256,
"owner_login": "user123"
},
{
"name": "technical-specs.md",
"status": "in_progress",
"status_message": null,
"metadata": {
"size": 1156,
"type": "text/markdown"
},
"enabled": true,
"chunk_size": 1024,
"chunk_overlap": 256,
"owner_login": "user123"
}
]