Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vectrade.io/llms.txt

Use this file to discover all available pages before exploring further.

Authentication

All VecTrade API requests require authentication via Bearer token.

API Key Types

Key PrefixEnvironmentUse Case
vq_live_ProductionReal-time data, production apps
vq_test_SandboxDevelopment, testing, CI

Setting Your API Key

export VECTRADE_API_KEY="vq_live_your_key_here"
The SDK automatically reads VECTRADE_API_KEY:
from vectrade import VecTrade
client = VecTrade()  # reads from environment

Explicit Configuration

client = VecTrade(api_key="vq_live_your_key_here")
Never hardcode API keys in source code. Use environment variables or secret managers.

Key Security Best Practices

  1. Rotate regularly — Generate new keys and revoke old ones monthly
  2. Use scoped keys — Create keys with minimum required permissions
  3. Separate environments — Use different keys for dev/staging/production
  4. Monitor usage — Check the dashboard for unexpected activity
  5. Use secrets managers — Store keys in Vault, AWS Secrets Manager, etc.

Key Permissions (Scopes)

ScopeAccess
quotes:readReal-time and historical quotes
fundamentals:readCompany financials and profiles
technicals:readTechnical indicators and candles
news:readFinancial news articles
screener:readStock screener
ai:readAI analysis (streaming)
webhooks:writeCreate/delete webhooks
options:readOptions chain data

Error Responses

Missing or invalid keys return 401 Unauthorized:
{
  "error": {
    "type": "authentication_error",
    "message": "Missing or invalid API key",
    "docs_url": "https://docs.vectrade.io/guides/authentication"
  }
}
Insufficient permissions return 403 Forbidden:
{
  "error": {
    "type": "permission_error",
    "message": "API key does not have permission. Required scope: ai:read"
  }
}

SDK Error Handling

from vectrade import VecTrade, AuthenticationError

try:
    client = VecTrade(api_key="invalid_key")
    client.quotes.get("AAPL")
except AuthenticationError as e:
    print(f"Auth failed: {e.message}")
    print(f"Request ID: {e.request_id}")