Overview
Strike Protocol uses API key authentication for accessing protected endpoints. This system supports two authentication methods to accommodate different use cases:- Personal API Keys - For individual traders and bot developers
- Service API Keys - For frontend applications (with wallet address)
Authentication Methods
Method 1: Personal API Keys
Personal API keys are the recommended method for individual traders and automated trading systems. Each wallet can have one active API key at a time. Format:stk_
followed by a secure random string
Headers Required:
Method 2: Service API Keys
Service keys are used by the Strike Protocol frontend and other authorized applications. They require an additional wallet address header. Headers Required:Getting Your API Key
Step 1: Access the Strike Protocol Interface
- Visit strike.markets
- Connect your Ethereum wallet (MetaMask, WalletConnect, etc.)
- Navigate to your account settings
Step 2: Generate Your API Key
- Click on your wallet address in the top navigation
- Select the “API Keys” tab
- Click “Generate API Key”
- Save the key immediately - it will only be shown once
Step 3: Secure Storage
Critical: API keys are shown only once during generation. Store them securely:
- Use environment variables in production
- Never commit keys to version control
- Consider using key management services for enterprise applications
Authentication Examples
Personal API Key Authentication
Service Key Authentication (Frontend Applications)
Authenticated Endpoints
Trading Operations
All trading operations require authentication:POST /long
- Create long positionPOST /short
- Create short positionPOST /close
- Close positionPOST /emergency-exit
- Emergency exit position
Account Management
POST /deposit
- Record deposit transactionPOST /withdraw
- Record withdrawal transaction
API Key Management
POST /api-key/generate
- Generate new API keyGET /api-key/status
- Check API key statusDELETE /api-key/revoke
- Revoke API key
Referral System
POST /referral/edit
- Edit referral codePOST /referral/register
- Register with referral code
Public Endpoints
These endpoints do not require authentication:Market Data
GET /markets
- Get available marketsGET /market/{symbol}
- Get market details
Account Information (Read-Only)
GET /positions/{wallet}
- Get positions for walletGET /positions/{wallet}/queue-positions
- Get queue positionsGET /dashboard/{wallet}
- Get dashboard dataGET /balances/{wallet}
- Get account balances
Referrals & Analytics
GET /referral/{wallet}
- Get referral statsGET /analytics
- Get protocol analytics
System
GET /health
- Health checkGET /
- API information
API Key Management
Testing Your API Key
Before making trading requests, test your API key:Checking Key Validity
You can also use the test authentication endpoint:Key Rotation
For security, regularly rotate your API keys:- Revoke your current key:
DELETE /api-key/revoke
- Generate a new key:
POST /api-key/generate
- Update your applications with the new key
Rate Limiting
API endpoints have different rate limits based on endpoint type:Trading Endpoints
- Limit: 10 requests per minute per wallet
- Applies to:
/long
,/short
,/close
,/emergency-exit
General Endpoints
- Limit: 60 requests per minute per IP address
- Applies to: All other authenticated endpoints
Rate Limit Headers
All responses include rate limit information:Service Key Bypass
Service API keys bypass rate limiting for frontend applications.Error Handling
Authentication Errors
Missing API Key
Invalid API Key
Service Key Missing Wallet
Rate Limit Errors
Security Best Practices
API Key Security
- Never expose keys in client-side code
- Use environment variables for key storage
- Rotate keys regularly (every 90 days recommended)
- Revoke compromised keys immediately
- Use HTTPS only for all API requests
Production Considerations
Key Monitoring
Implement monitoring to detect:- Unusual API usage patterns
- Failed authentication attempts
- Rate limit violations
- Key age and rotation needs
Troubleshooting
Common Issues
-
“No API key provided”
- Ensure the
X-API-Key
header is included - Check header name spelling and casing
- Ensure the
-
“Invalid or revoked API key”
- Verify your key was copied correctly (no extra spaces)
- Check if the key has been revoked
- Generate a new key if needed
-
“Service key requires wallet address”
- Add the
X-Wallet-Address
header when using service keys - Ensure the wallet address format is correct (0x prefix)
- Add the
-
Rate limit exceeded
- Wait for the rate limit window to reset
- Implement proper request spacing in your application
- Check the
X-RateLimit-Reset
header for reset time
Testing Authentication
Use the dedicated test endpoint to verify your setup:Migration from Legacy Systems
If you’re migrating from an older authentication system:- Generate a new API key through the web interface
- Update your application code to use
X-API-Key
header instead ofAuthorization: Bearer
- Test thoroughly with the new authentication method
- Remove old authentication code once migration is complete