Docs / Authentication

Authentication

Learn about API authentication and security

Authentication Guide

APIMW uses a two-step authentication process for security: API credentials for token generation, and JWT tokens for API access.

Authentication Flow

┌─────────────┐    API Key/Secret    ┌─────────────┐
│  Your App   │ ──────────────────► │   APIMW     │
└─────────────┘                      │   /auth     │
       │                             └─────────────┘
       │                                    │
       │          Access Token              │
       │ ◄──────────────────────────────────┘
       │
       │         Bearer Token
       ▼
┌─────────────┐
│  APIMW API  │
└─────────────┘

API Credentials

Creating API Keys

  1. Log in to the Console at console.apimw.com
  2. Go to API Keys section
  3. Click Create New API Key
  4. Give your key a descriptive name
  5. Copy and securely store both the Key and Secret

Best Practices

  • Never expose secrets in client-side code
  • Use environment variables for credentials
  • Rotate keys periodically
  • Use separate keys for development and production

Access Tokens

Access tokens are JWT (JSON Web Tokens) that authenticate your API requests.

Token Properties

Property Description
access_token The JWT token string
token_type Always "Bearer"
expires_in Token lifetime in seconds (default: 3600)
refresh_token Token to get a new access token

Using Access Tokens

Include the token in the Authorization header:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Token Expiration

  • Access tokens expire after 1 hour
  • Use the refresh token to get a new access token
  • If both expire, re-authenticate with API credentials

Security Recommendations

  1. Use HTTPS - All API requests must use HTTPS
  2. Secure Storage - Store credentials in environment variables
  3. Token Refresh - Implement automatic token refresh
  4. IP Whitelisting - Restrict API access by IP (Enterprise plan)
  5. Audit Logs - Monitor API usage in the Console