Skip to main content

Overview

Monei supports api key authentication method

API Key Authentication

The simplest and most common authentication method for server-side applications.

Getting Your API Key

1

Navigate to Dashboard

Go to monei.cc
2

Create New Key

Click Create New Key and provide:
  • Key name (for identification)
  • Environment (sandbox or production)
  • Permissions (optional scoping)
3

Save Securely

Copy your API key immediately - it won’t be shown again
Store API keys in environment variables, never commit them to source control.

Using API Keys

Include your API key in the x-api-key header:

API Key Permissions

Control what your API keys can access:
Always use the minimum required permissions for each API key to enhance security.

Security Best Practices

Do:
  • Store keys in environment variables
  • Use different keys for development and production
  • Rotate keys regularly (every 90 days)
  • Use scoped permissions
  • Monitor key usage
Don’t:
  • Commit keys to version control
  • Share keys via email or chat
  • Use production keys in development
  • Hardcode keys in client-side code
Storage:
  • Server-side: Environment variables, secure vaults
  • Client-side: httpOnly cookies, secure storage APIs
  • Never in localStorage or sessionStorage
Transmission:
  • Always use HTTPS
  • Never include tokens in URLs
  • Use secure headers only
Lifecycle:
  • Implement token refresh before expiration
  • Clear tokens on logout
  • Revoke compromised tokens immediately
Transport:
  • Always use TLS 1.2 or higher
  • Verify SSL certificates
  • Use certificate pinning in mobile apps
Rate Limiting:
  • Implement client-side rate limiting
  • Handle 429 responses gracefully
  • Use exponential backoff
IP Whitelisting:
  • Restrict API access to known IPs (enterprise)
  • Use VPN for sensitive operations
Track:
  • All authentication attempts
  • Failed login attempts
  • API key usage patterns
  • Unusual activity
Alerts:
  • Multiple failed logins
  • API calls from new locations
  • Suspicious transaction patterns
  • Key usage spikes
Logging:
  • Log all authentication events
  • Monitor access patterns
  • Review logs regularly
  • Set up automated alerts

Authentication Errors

Common authentication errors and how to resolve them:
Cause: Invalid or missing credentialsSolutions:
  • Verify API key is correct
  • Check token hasn’t expired
  • Ensure proper header format
  • Confirm environment (sandbox vs production)

Environment Variables

Recommended environment variable structure:
Never commit your .env file to version control. Add it to .gitignore.

Testing Authentication

Test your authentication setup:

Next Steps

Core Concepts

Learn about wallets, transactions, and networks

Security Guidelines

Comprehensive security best practices

API Reference

Explore all available endpoints

Webhooks

Set up secure webhook integrations