Authentication
All requests to the Gale API must be authenticated using a valid API key.Base URL
API Keys
Getting Your API Key
- Log in to Gale Dashboard
- Navigate to Settings → API Keys
- Copy your API key
- Test keys (prefix:
glm_test_) - For development and testing - Live keys (prefix:
glm_live_) - For production
Using Your API Key
Include your API key in theAuthorization header of every request:
Authentication Errors
Missing or invalid API keys return a401 Unauthorized response:
Idempotency
Prevent duplicate operations by using idempotency keys for state-changing requests.How It Works
Add anIdempotency-Key header to prevent duplicate processing:
- Key format: Use a unique UUID (v4 recommended)
- Validity: Keys are stored for 24 hours
- Behavior: Requests with the same key within 24 hours return the original response without reprocessing
When to Use
Use idempotency keys for:- Creating checkout sessions (
POST /v2/checkout) - Creating refunds (
POST /v2/refunds) - Creating payment links (
POST /v2/payment-links) - Any POST request that creates or modifies data
Best Practices
- Generate a new UUID for each operation
- Retry failed requests with the same idempotency key
- Store the key with your request for retry scenarios
- Don’t reuse keys across different operations
Security Best Practices
- Never expose API keys in client-side code or public repositories
- Use environment variables to store API keys
- Rotate keys regularly in production
- Use test keys for development and staging environments
- Monitor API key usage in your dashboard
Related
- Rate Limits - API request limits
- Errors - Error handling
