JavaScript/TypeScript SDK
Installation
- npm
- yarn
- pnpm
Quick Start
Authentication
Get your API key from your Plugged.in Profile and configure the client:Core Features
Document Management
List Documents
Get Document
Search Documents
Create AI-Generated Document
Update Document
RAG Operations
Simple Query
Query with Sources
Find Relevant Documents
File Uploads
Important: Direct file uploads are no longer exposed via the public API. Theclient.uploadshelpers now throw descriptive errors so existing code fails fast. Use the Plugged.in web interface or the forthcoming ingestion workflow for binary files. AI-generated content can still be created withclient.documents.createorclient.uploads.uploadDocument.
Error Handling
The SDK provides typed error classes for better error handling:TypeScript Support
The SDK is written in TypeScript and provides comprehensive type definitions:Advanced Configuration
Environment Variables
Custom HTTP Client
Rate Limiting
The SDK automatically handles rate limiting with exponential backoff:- API Endpoints: 60 requests per minute
- Document Search: 10 requests per hour for AI document creation
- RAG Queries: Subject to plan limits
Browser Support
The SDK works in both Node.js and browser environments:Examples
Complete working examples are available in the GitHub repository:API Reference
Client Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your Plugged.in API key |
baseUrl | string | https://plugged.in | API base URL |
timeout | number | 60000 | Request timeout in milliseconds |
maxRetries | number | 5 | Maximum retry attempts |
debug | boolean | false | Enable debug logging |
Document Methods
| Method | Description |
|---|---|
list(filters) | List documents with optional filters |
get(id, options) | Get a specific document |
search(query, filters, limit, offset) | Search documents |
create(title, content, metadata) | Create a new document |
update(id, request) | Update an existing document |
delete(id) | Delete a document |
RAG Methods
| Method | Description |
|---|---|
query(question) | Returns RagResponse with answer, sources, and document IDs |
queryWithSources(question) | Returns answer plus structured source metadata |
findRelevantDocuments(query, limit?) | Returns matched document references |
getStorageStats(userId) | Fetch aggregated storage metrics for the authenticated user |
checkAvailability() | Lightweight availability check |
Upload Methods
All binary upload helpers now throw descriptive errors because the public API no longer exposes direct upload endpoints. Use the web interface or upcoming ingestion pipeline for file uploads.Support
- NPM Package: https://www.npmjs.com/package/pluggedinkit-js
- GitHub Issues: Report bugs and request features
- Documentation: https://docs.plugged.in
- Discord: Join our community

