Skip to main content

Overview

Magpipe supports two authentication methods. Both use Bearer token authentication via the Authorization header.
We recommend API keys for most integrations. They don’t expire and are easier to manage.
API keys are long-lived tokens that persist until you revoke them. They start with the mgp_ prefix.

Generating an API Key

  1. Log in to magpipe.ai
  2. Go to SettingsAPI
  3. Click Generate New Key
  4. Give the key a descriptive name (e.g., “Production Server”, “CI Pipeline”)
  5. Copy the key immediately — it won’t be shown again
The full API key is only displayed once at creation time. Store it securely. If you lose it, you’ll need to generate a new one.

Using an API Key

Node.js
Python

Key Properties

  • Prefix: All keys start with mgp_ followed by 40 hex characters
  • Display: In the dashboard, keys show as mgp_abc12345... (first 8 characters only)
  • Tracking: Each key tracks its last_used_at timestamp
  • Limit: Maximum 10 active keys per account

Revoking a Key

  1. Go to SettingsAPI
  2. Find the key you want to revoke
  3. Click Revoke
  4. Confirm the action
The key will immediately stop working. This cannot be undone.

Session Tokens

Session tokens are short-lived JWTs obtained by authenticating with email and password. They expire after 1 hour and can be refreshed.

Obtaining a Session Token

Response:

Using a Session Token

Refreshing Session Tokens

Session tokens expire after 1 hour. Use the refresh token to get a new one:

Error Responses

If authentication fails, you’ll receive a 401 response:
Common causes:
  • Missing Authorization header
  • Invalid or expired token
  • Revoked API key

Security Best Practices

Never hardcode tokens in source code. Use environment variables instead.
API keys are ideal for backend services and scripts. Use session tokens only for browser-based apps where you authenticate with user credentials.
Use names like “Production Server” or “Staging CI” so you know which key is used where.
Generate new keys and revoke old ones regularly to limit exposure.
Check your API key last_used_at timestamps in the dashboard to detect unauthorized usage.