Overview
The Mighty Networks Admin API uses Bearer token authentication to secure all API requests. Each request must include a valid API token in theAuthorization header.
Getting Your API Token
Step 1: Access Your Network Admin Panel
Navigate to your network and access the admin settings:- Log in to your Mighty Network
- Go to Admin from the main navigation
- Navigate to Settings > API Keys
Step 2: Generate a New API Token
1
Create API Key
Click the “Generate New API Key” button in the API Keys section.
2
Name Your Token
Give your API token a descriptive name (e.g., “Production Integration”, “Development”, “Analytics Script”).
3
Set Permissions
Configure the permissions and scopes for your API token based on your use case.
4
Copy and Store
Copy the generated token immediately and store it securely. You won’t be able to see it again.
Making Authenticated Requests
Include your API token in theAuthorization header of every request:
Authentication Errors
The API returns specific error codes for authentication issues:| Status Code | Error | Description |
|---|---|---|
| 401 | unauthorized | Missing or invalid API token |
| 403 | forbidden | Valid token but insufficient permissions |
| 401 | token_expired | API token has been revoked or expired |
Example Error Response
Security Best Practices
1. Store Tokens Securely
Use environment variables to store your tokens:.env
2. Use HTTPS Only
All API requests must use HTTPS. HTTP requests will be rejected.3. Monitor Token Usage
- Log all API requests for audit trails
- Monitor for unusual patterns or unauthorized access
- Set up alerts for authentication failures
Managing API Tokens
Viewing Active Tokens
Navigate to Admin > Settings > API Keys to see all active tokens for your network.Revoking Tokens
To revoke a token:- Go to Admin > Settings > API Keys
- Find the token you want to revoke
- Click “Revoke” next to the token
- Confirm the revocation
Rate Limiting
API tokens are subject to rate limits based on your plan:- Standard: 100 requests per minute
- Premium: 300 requests per minute
Testing Your Authentication
Use this simple test to verify your token is working:Troubleshooting
”Invalid API token” Error
Problem: Getting 401 unauthorized errors Solutions:- Verify the token is copied correctly (no extra spaces or characters)
- Check that the token hasn’t been revoked
- Ensure you’re using the correct
Authorization: Bearerformat - Verify the token has not expired
”Forbidden” Error
Problem: Getting 403 forbidden errors Solutions:- Check that your token has the required permissions/scopes
- Verify you have admin access to the network
- Ensure you’re using the correct network ID
Token Not Working After Creation
Problem: Newly created token returns errors Solutions:- Wait a few seconds - tokens may take a moment to propagate
- Verify you’re using the full token string
- Check that you copied the token immediately after creation