TypeScript SDK Reference
The lightfast npm package provides a type-safe client for the Lightfast API.
Installation
Client Configuration
LightfastConfig
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | - | API key (starts with sk-lf-) |
baseUrl | string | No | https://lightfast.ai | API base URL |
timeout | number | No | 30000 | Request timeout in milliseconds |
Methods
search()
Search through your organization's knowledge — decisions, observations, and documents.
SearchInput & Response
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
SearchFilters
| Property | Type | Description |
|---|---|---|
sourceTypes | string[] | Source types to include (e.g., ["github", "linear"]) |
observationTypes | string[] | Observation types to include (e.g., ["commit", "issue"]) |
sources | string[] | Source identifiers to filter by |
entityTypes | string[] | Entity types to filter by |
dateRange | { start?: string; end?: string } | Date range filter with ISO datetime strings |
Example
proxySearch()
Discover connected providers, their resources, and available actions. Returns connection IDs, resource names with pre-computed action params, and the full action catalog.
Example
proxyCall()
Execute a provider API action. Use action strings from proxySearch() and pass a flat params object — resource params from the search response can be spread directly into the call. Auth is handled automatically.
ProxyCall
| Property | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action to execute (e.g. github.list-pull-requests) |
params | Record<string, unknown> | No | Action parameters — spread resource params and add extras |
connection | string | No | Connection ID (optional, for future multi-connection support) |
Example
Error Classes
The SDK exports typed error classes for handling specific error conditions.
| Error Class | HTTP Status | Description |
|---|---|---|
AuthenticationError | 401 | Invalid or expired API key |
ValidationError | 400 | Invalid request parameters. Access error.details for field-specific errors |
NotFoundError | 404 | Resource not found |
RateLimitError | 429 | Too many requests. Access error.retryAfter for retry delay in seconds |
ServerError | 500, 502, 503, 504 | Internal server error or service unavailable |
NetworkError | - | Connection or timeout error |
Type Exports
All request and response types are exported:
Related
- TypeScript SDK Tutorial - Getting started guide with examples
- POST /v1/search - REST API endpoint reference
- GitHub Repository - SDK source code