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
1
Get API Key
Navigate to API Keys in your dashboard
2
Create New Key
Click “Generate New API Key” and save it securely
3
Use in Requests
Include the key in your Authorization header:
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
1
Redirect to Authorization
2
User Approves
User logs in and approves the requested permissions
3
Receive Authorization Code
4
Exchange for Access Token
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
Regular key rotation is recommended for security. Rotate keys:
- Every 90 days for production environments
- Immediately if a key is compromised
- When team members leave
Rotation Process
1
Generate New Key
Create a new API key while keeping the old one active
2
Update Applications
Deploy your applications with the new key
3
Verify
Ensure all systems are using the new key
4
Revoke Old Key
Delete the old key from the dashboard
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
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:1
Update Authentication Header
2
Update Endpoints
3
Handle New Response Format
Responses now include consistent error objects and pagination
Support
For authentication issues or questions:- Documentation: API Reference
- Status Page: status.plugged.in
- Support Email: api-support@plugged.in
- GitHub Issues: Report issues