GitHub
GitHub

The Lightfast Memory API provides real-time semantic search across all your company's data sources. It enables AI tools, custom agents, and applications to access company knowledge through a unified, type-safe API.

API Endpoints

Base URL

https://api.lightfast.ai/v1

Authentication

All API requests require authentication via API keys:

Authorization: Bearer lf_sk_live_abc123...

Key Types

TypePrefixPermissionsUse Case
Secret Keylf_sk_Full access (read, write, delete)Server-side applications
Publishable Keylf_pk_Read-only accessClient-side search UIs
Restricted Keylf_rk_Custom scopesScoped integrations

Core Concepts

Collections

Collections are logical groupings of related memories (e.g., github-org-name, discord-server-id). Data is automatically partitioned by source and organization.

Memories

A memory is an indexed piece of content with associated metadata. Each memory has:

  • ID: Unique identifier within the collection
  • Content: The text content to search
  • Metadata: Structured data for filtering and context
  • Embedding: Vector representation for semantic search

Unlike keyword search, semantic search understands meaning and context. Searching for "authentication refactor" will find related PRs, issues, and discussions even if they don't contain those exact words.

Rate Limiting

TierSearches/minWrites/minQuota
Free601010K vectors
Pro600100100K vectors
Team3,000500500K vectors
EnterpriseCustomCustomUnlimited

Rate limit information is included in response headers:

X-RateLimit-Limit: 600
X-RateLimit-Remaining: 542
X-RateLimit-Reset: 1642694400

Error Handling

All errors follow a consistent format:

{
  "error": "rate_limit_exceeded",
  "message": "Rate limit exceeded. Retry after 42 seconds.",
  "details": {
    "retryAfter": 42
  },
  "requestId": "req_abc123"
}

Common Error Codes

CodeStatusDescription
invalid_request400Malformed request or invalid parameters
authentication_failed401Invalid or missing API key
permission_denied403Insufficient permissions for operation
resource_not_found404Memory or collection does not exist
conflict409Resource already exists
rate_limit_exceeded429Too many requests
internal_error500Unexpected server error

SDKs

TypeScript/JavaScript

npm install @lightfast/memory
import { createMemory } from '@lightfast/memory'

const memory = createMemory({
  apiKey: process.env.LIGHTFAST_API_KEY,
  provider: 'chroma',
  config: {
    host: 'http://localhost:8000'
  }
})

Python

pip install lightfast-memory
from lightfast_memory import Memory

memory = Memory(
    api_key=os.getenv("LIGHTFAST_API_KEY"),
    provider="chroma",
    config={"host": "http://localhost:8000"}
)

Go

go get github.com/lightfastai/lightfast-go
import "github.com/lightfastai/lightfast-go/memory"

client := memory.NewClient(
    memory.WithAPIKey(os.Getenv("LIGHTFAST_API_KEY")),
    memory.WithProvider("chroma"),
)

Quick Start

1. Get your API key

Sign up at lightfast.ai and get your API key from the dashboard.

2. Index your first memory

await memory.addMemory({
  collection: 'my-project',
  id: 'doc-1',
  content: 'Your content here...',
  metadata: {
    type: 'doc',
    source: 'custom',
    createdAt: new Date().toISOString()
  }
})

3. Search your memories

const results = await memory.searchMemory({
  query: 'your search query',
  collections: ['my-project'],
  limit: 10
})

Next Steps