Skip to main content

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

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

Token Response:

Device Authorization (CLI)

For CLI tools and headless environments that cannot directly handle browser redirects. Inspired by RFC 8628.
1

Initiate

Response:
2

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.
3

Poll for Result

Poll every 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.
Possible statuses:Stop polling on any terminal status (approved, denied, expired) or when expires_in seconds have elapsed since initiation.
4

Use the API Key

On approved, the response includes a ready-to-use API key:
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

  1. Navigate to API Keys
  2. Click “Generate New API Key”
  3. Set optional expiration date
  4. Add description for reference
  5. Copy and save the key securely

Via API

Key Formats

API keys follow a consistent format for easy identification:

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 Examples

Security Best Practices

Storage

Recommended for server applications

Security Guidelines

Always use HTTPS when making API requests to prevent key interception.
Respect rate limits to avoid key suspension:
Track API key usage for unusual patterns:

Error Handling

Common Authentication Errors

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: