Skip to main content

API Documentation

Everything you need to integrate StockAlert.pro into your applications

Authentication

API Keys

Getting your API Key

  1. Sign in to your StockAlert.pro account
  2. Navigate to Account Settings → API Keys
  3. Click "Generate New API Key"
  4. Give your key a descriptive name (e.g., "Production App", "Development")
  5. Copy and securely store your API key - it won't be shown again!

Important: Treat your API keys like passwords. Never commit them to version control or expose them in client-side code.

API Key Format

API keys follow a specific format for easy identification:

sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • sk_ - Identifies this as a secret key
  • xxxxxxx... - Unique 64-character identifier

Using Your API Key

Header Authentication

Include your API key in the X-API-Key header of every request:

Example: cURL
curl -X GET https://stockalert.pro/api/public/v1/alerts \
  -H "X-API-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Example: JavaScript (Fetch)
const response = await fetch('https://stockalert.pro/api/public/v1/alerts', {
  headers: {
    'X-API-Key': 'sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
});

const data = await response.json();

Security Best Practices

  • Environment Variables - Store API keys in environment variables, never in code
  • Server-side Only - Only use API keys in server-side code, never in browser JavaScript
  • Rotate Regularly - Generate new keys periodically and revoke old ones
  • Limit Scope - Use different keys for different environments (dev, staging, production)
  • Monitor Usage - Regularly check your API key usage in Account Settings and review rate limits