API Documentation

GPTFinancial provides a RESTful JSON API for real-time market data, technical indicators, and AI-powered financial analysis. All endpoints return JSON responses.

Contents

Authentication

All API requests require authentication via an API key. Include your key in one of these ways:

Header (Recommended)

X-API-Key: your_api_key_here

Bearer Token

Authorization: Bearer your_api_key_here

Query Parameter

GET /api/v1/quote/AAPL?api_key=your_api_key_here

Get your free API key at gptfinancial.co (100 calls/month free).

Base URL

https://api.gptfinancial.co

Rate Limits

Plan Calls/Month Requests/Minute
Free 100 5
Starter ($49/mo) 5,000 30
Professional ($199/mo) 50,000 100
Enterprise ($499/mo) Unlimited 500

When rate limited, you'll receive a 429 status with retry_after in seconds.

Endpoints

POST/api/v1/register

Register for a free API key. No authentication required.

Free

Request Body

FieldTypeDescription
email requiredstringYour email address
companystringCompany name (optional)

Example

curl -X POST https://api.gptfinancial.co/api/v1/register \
  -H "Content-Type: application/json" \
  -d '{"email": "your@email.com"}'

Response

{
  "success": true,
  "customer_id": "cust_abc123",
  "email": "your@email.com",
  "tier": "free",
  "api_key": "gptfin_live_xxx...",
  "calls_per_month": 100,
  "message": "Save your API key securely!"
}

GET/api/v1/quote/{symbol}

Get real-time price quote for any stock or cryptocurrency.

1 API call

Path Parameters

ParameterDescription
symbol requiredStock ticker (AAPL, TSLA) or crypto (BTC, ETH)

Example

curl https://api.gptfinancial.co/api/v1/quote/AAPL \
  -H "X-API-Key: your_api_key"

Response

{
  "success": true,
  "symbol": "AAPL",
  "price": 277.55,
  "change_24h": 0.58,
  "change_pct_24h": 0.21,
  "timestamp": "2025-11-27T19:17:26Z",
  "response_time_ms": 45
}

GET/api/v1/technicals/{symbol}

Get technical indicators including RSI, MACD, Bollinger Bands, and moving averages.

2 API calls

Response Fields

FieldDescription
rsi_1414-day Relative Strength Index (0-100)
macdMACD line value
macd_signalMACD signal line
macd_histogramMACD histogram
sma_20/50/200Simple Moving Averages
ema_12/26Exponential Moving Averages
bollinger_upper/middle/lowerBollinger Bands
atr_1414-day Average True Range
trendOverall trend: BULLISH, BEARISH, or NEUTRAL
signalsArray of buy/sell signals

Example

curl https://api.gptfinancial.co/api/v1/technicals/TSLA \
  -H "X-API-Key: your_api_key"

GET/api/v1/analyze/{symbol}Starter+

Deep AI-powered analysis combining market data, technicals, fundamentals, and macro factors.

10 API calls

Query Parameters

ParameterDescription
typeAsset type: auto, stock, crypto (default: auto)

Example

curl "https://api.gptfinancial.co/api/v1/analyze/BTC?type=crypto" \
  -H "X-API-Key: your_api_key"

Response includes

POST/api/v1/multiStarter+

Analyze multiple assets in a single request.

5 API calls per symbol

Request Body

{
  "symbols": ["AAPL", "MSFT", "GOOGL", "BTC"]
}

Maximum 20 symbols per request.

GET/api/v1/report/{symbol}Starter+

Generate a professional PDF analysis report. Returns binary PDF data.

15 API calls

Response Headers

Content-Type: application/pdf
Content-Disposition: attachment; filename="AAPL_report.pdf"

Example

curl -H "X-API-Key: your_api_key" \
  https://api.gptfinancial.co/api/v1/report/AAPL \
  -o aapl_report.pdf

Report Contents

GET/api/v1/usage

Check your API usage and remaining quota.

Free

Response

{
  "tier": "free",
  "calls_used": 42,
  "calls_limit": 100,
  "calls_remaining": 58,
  "reset_at": "2025-12-01T00:00:00Z",
  "rate_limit_per_minute": 5,
  "features": ["quote", "technicals"]
}

Error Handling

All errors return JSON with an error field:

StatusDescription
400Bad request - invalid parameters
401Unauthorized - invalid or missing API key
403Forbidden - endpoint not available on your plan
404Not found - symbol or endpoint not found
429Rate limited - too many requests
500Server error

Error Response Example

{
  "valid": false,
  "error": "Monthly API limit exceeded",
  "calls_used": 100,
  "calls_limit": 100,
  "upgrade_url": "https://gptfinancial.co/#pricing"
}

Code Examples

Python

import requests

API_KEY = "your_api_key"
BASE_URL = "https://api.gptfinancial.co"

headers = {"X-API-Key": API_KEY}

# Get quote
response = requests.get(f"{BASE_URL}/api/v1/quote/AAPL", headers=headers)
data = response.json()
print(f"AAPL: ${data['price']}")

# Get technicals
response = requests.get(f"{BASE_URL}/api/v1/technicals/AAPL", headers=headers)
technicals = response.json()
print(f"RSI: {technicals['indicators']['rsi_14']}")
print(f"Trend: {technicals['trend']}")

JavaScript (Node.js)

const API_KEY = 'your_api_key';
const BASE_URL = 'https://api.gptfinancial.co';

async function getQuote(symbol) {
  const response = await fetch(`${BASE_URL}/api/v1/quote/${symbol}`, {
    headers: { 'X-API-Key': API_KEY }
  });
  return response.json();
}

// Usage
const quote = await getQuote('AAPL');
console.log(`AAPL: $${quote.price}`);

cURL

# Get quote
curl -H "X-API-Key: your_api_key" \
  https://api.gptfinancial.co/api/v1/quote/AAPL

# Get technicals
curl -H "X-API-Key: your_api_key" \
  https://api.gptfinancial.co/api/v1/technicals/TSLA

# Register (no auth required)
curl -X POST https://api.gptfinancial.co/api/v1/register \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'