API Authentication
The Plugged.in API uses Bearer token authentication to secure endpoints and identify users. This guide covers how to obtain and use API keys.Quick Start
Get API Key
Navigate to API Keys in your dashboard
Authentication Methods
Bearer Token (Recommended)
The primary authentication method for the Plugged.in API.OAuth 2.0
For third-party applications that need to access user data on their behalf.Authorization Flow
Token Response:
Device Authorization (CLI)
For CLI tools and headless environments that cannot directly handle browser redirects. Inspired by RFC 8628.Direct User to Browser
Open
verification_url in the user’s browser. The user logs in (if needed), verifies the code, selects a Hub, and clicks Authorize.Poll for Result
Poll every Possible statuses:
Stop polling on any terminal status (
interval seconds (returned in step 1, default 5). Do not poll faster — requests that exceed the rate limit receive a 429 response with a Retry-After header.| Status | Meaning |
|---|---|
authorization_pending | User hasn’t acted yet — wait interval seconds and poll again |
approved | User approved — response includes api_key |
denied | User denied the request |
expired | Code expired (5-minute TTL) |
approved, denied, expired) or when expires_in seconds have elapsed since initiation.The Plugged.in CLI plugin (
/pluggedin:setup) automates this entire flow — it initiates, opens the browser, polls, and saves the key automatically.Session Authentication
For browser-based applications using cookies.API Key Management
Creating API Keys
API keys can be created through the dashboard or API.Via Dashboard
- Navigate to API Keys
- Click “Generate New API Key”
- Set optional expiration date
- Add description for reference
- Copy and save the key securely
Via API
Key Formats
API keys follow a consistent format for easy identification:| Environment | Prefix | Example |
|---|---|---|
| Production | pk_live_ | pk_live_abc123... |
| Test | pk_test_ | pk_test_xyz789... |
| Secret | sk_live_ | sk_live_def456... |
Key Rotation
Rotation Process
Revoking Keys
Permissions & Scopes
API keys can have different permission scopes:Available Scopes
| Scope | Description |
|---|---|
read:servers | Read MCP server configurations |
write:servers | Create and modify MCP servers |
delete:servers | Remove MCP servers |
read:documents | Access document library |
write:documents | Upload and modify documents |
read:profile | View profile information |
write:profile | Update profile settings |
read:collections | View collections |
write:collections | Create and modify collections |
admin | Full administrative access |
Scope Examples
Security Best Practices
Storage
- Environment Variables
- Secrets Manager
- Key Vault
Recommended for server applications
Security Guidelines
Never Expose Keys in Code
Never Expose Keys in Code
Use HTTPS Only
Use HTTPS Only
Always use HTTPS when making API requests to prevent key interception.
Implement Rate Limiting
Implement Rate Limiting
Respect rate limits to avoid key suspension:
Monitor Key Usage
Monitor Key Usage
Track API key usage for unusual patterns:
Error Handling
Common Authentication Errors
| Error Code | Description | Solution |
|---|---|---|
401 UNAUTHORIZED | Missing or invalid API key | Check key is included in header |
403 FORBIDDEN | Key lacks required scope | Generate key with correct permissions |
429 RATE_LIMITED | Too many requests | Implement exponential backoff |
410 GONE | API key revoked | Generate a new API key |
Error Response Example
Handling Errors
Testing
Test API Keys
Use test API keys for development and testing:Mock Authentication
For unit tests, mock the authentication:Migration Guide
From API v1 to v2
If you’re migrating from an older API version:Support
For authentication issues or questions:- Documentation: API Reference
- Status Page: status.plugged.in
- Support Email: api-support@plugged.in
- GitHub Issues: Report issues

