Skip to main content
Learn how to use the Orchata SDK to manage spaces, documents, and query your knowledge base.

Client Configuration

Create a client instance with optional configuration:

Spaces

Spaces are knowledge bases that contain your documents.

List Spaces

Filter spaces by metadata:

Create a Space

Get a Space

Update a Space

Delete a Space

Deleting a space archives it (soft delete). The space and its documents remain accessible but hidden.

Get Space Limits

Check document usage and limits for a space based on your plan:

Documents

Documents contain the content in your spaces. Orchata automatically handles chunking and embedding.

List Documents

Filter documents by metadata:

Upload a Document

Documents start with status: "processing". Wait a few seconds for embedding to complete before querying.

Upload Multiple Documents

Upload multiple documents in a single operation:

Get Document Content

Retrieve the full processed content of a document:

Upsert a Document

Create a document if it doesn’t exist, or update it if a document with the same filename already exists in the space:

Append to a Document

Add content to the end of an existing document:

Get Document by Filename

Look up a document by its filename within a space:

Update a Document

Delete a Document

Queries

Query your knowledge base using semantic search.

Simple Query

Query Multiple Spaces

Filter by Metadata

Group Results by Space

Query Options

string | string[]
required
One or more space IDs to search.
string
required
Natural language search query.
integer
default:"10"
Maximum number of results to return (1-100).
number
default:"0.0"
Minimum similarity score (0-1). Higher values return more relevant but fewer results.
object
Filter results by document metadata key-value pairs.
boolean
default:"false"
Group results by space ID instead of returning a flat array.

Smart Query

Discover which spaces are most relevant for a query without knowing which spaces to search.

Find Relevant Spaces

Relevance Methods

Choose how spaces are matched to your query:

Complete Workflow

Use Smart Query to discover spaces, then query them:
Smart Query is especially useful for AI agents that need to discover which knowledge bases to search without hardcoded space IDs.

Runtime Support

The SDK works across different JavaScript runtimes:

Next Steps

AI Integration

Integrate with Vercel AI SDK for AI-powered applications.

Error Handling

Handle errors gracefully with typed error classes.

Quickstart

Review the quickstart guide.

API Reference

Explore the REST API documentation.