Skip to main content
POST
/
v1
/
stock-report
Generate Stock Report
curl --request POST \
  --url https://api.chicago.global/v1/stock-report \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "symbol": "AAPL.O",
  "force": false
}
'
{
  "job_id": "stock-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "status": "pending",
  "symbol": "AAPL.O",
  "force": false,
  "check_url": "/v1/jobs/stock-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "estimated_duration_seconds": 600,
  "message": "Stock report generation started for AAPL.O. Poll the check_url to get results."
}

How It Works

This endpoint uses async job processing for generating comprehensive stock reports:
  1. Submit Request: POST the stock symbol to /v1/stock-report
  2. Receive Job ID: Get a job ID and polling URL immediately
  3. Poll for Status: Check /v1/jobs/{job_id} until status is completed
  4. Get Report URLs: The completed job contains URLs to PDF, HTML, and JSON reports
Report generation typically takes 5-10 minutes. Reports include financial analysis, valuation metrics, AI-generated insights, and more.

Request Body

FieldTypeRequiredDefaultDescription
symbolstringYes-Stock symbol (e.g., AAPL.O for Apple Inc)
forcebooleanNofalseForce regeneration even if recent report exists
If force is false and a recent report exists (generated within the last 30 days), the cached report URLs will be returned immediately.

Response (202 Accepted)

When the job is created:
{
  "job_id": "stock-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "status": "pending",
  "symbol": "AAPL.O",
  "force": false,
  "check_url": "/v1/jobs/stock-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "estimated_duration_seconds": 600,
  "message": "Stock report generation started for AAPL.O. Poll the check_url to get results."
}

Completed Response

When the job completes, GET /v1/jobs/{job_id} returns:
{
  "job_id": "stock-a3522a92-87ed-4be0-a912-ad56ed6a8806",
  "job_type": "stock_report",
  "status": "completed",
  "result": {
    "success": true,
    "symbol": "AAPL.O",
    "pdf_url": "https://storage.example.com/reports/AAPL.O/report.pdf",
    "html_url": "https://storage.example.com/reports/AAPL.O/report.html",
    "json_url": "https://storage.example.com/reports/AAPL.O/report.json"
  }
}

Example: Polling for Results

const response = await fetch('https://api.chicago.global/v1/stock-report', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ symbol: 'AAPL.O' })
});

const { job_id } = await response.json();

// Poll every 10 seconds (reports take ~15 minutes)
const interval = setInterval(async () => {
  const status = await fetch(
    `https://api.chicago.global/v1/jobs/${job_id}`,
    { headers: { 'Authorization': `Bearer ${API_KEY}` } }
  ).then(r => r.json());

  if (status.status === 'completed') {
    clearInterval(interval);
    console.log('PDF:', status.result.pdf_url);
    console.log('HTML:', status.result.html_url);
    console.log('JSON:', status.result.json_url);
  } else if (status.status === 'failed') {
    clearInterval(interval);
    console.error('Failed:', status.error);
  } else {
    console.log(`Status: ${status.status}, Progress: ${status.progress}`);
  }
}, 10000);

Error Responses

StatusDescription
400Invalid symbol - no company data found
401Invalid or missing API key
500Internal server error
{
  "detail": "Invalid symbol 'INVALID': No company data found for this symbol."
}

Authorizations

Authorization
string
header
required

API key passed as Bearer token

Body

application/json

Request body for stock report generation

symbol
string
required

Stock symbol (e.g., AAPL.O for Apple Inc)

Example:

"AAPL.O"

force
boolean
default:false

Force regeneration even if recent report exists

Example:

false

Response

Job created successfully. Poll the check_url for results.

job_id
string

Unique job identifier

status
enum<string>

Initial job status

Available options:
pending
symbol
string

Stock symbol being processed

force
boolean

Whether force regeneration was requested

check_url
string

URL to poll for job status

estimated_duration_seconds
integer

Estimated processing time in seconds

message
string

Human-readable status message