StockUp Quan API Developer Hub
Build finance-native applications with server-verified stock context, SEC filing workflows, citations, portfolio risk analysis, streaming responses, and explicit unavailable-data handling.
Read API Docs
Learn endpoints, connection details, headers, model variations, and response schemas to get started.
Enterprise Setup Guide
Run Quan from an Enterprise workspace, use Enterprise model aliases, manage employee quotas, and prepare production rollouts.
Enterprise Financial AI
Explore company, team, fintech, bank, and financial-institution use cases for Quan API Enterprise.
Model Context Protocol
Hook up StockUp Quan tools to Claude Desktop, Cursor, and other agent systems using our public MCP server.
Developer Credentials
Generate secure API keys, check limits, test connection queries in real-time, and manage account credits.
Trending Discussions
StockUp API Integration Guide
Integrate and use the StockUp Quan API in your own client and backend systems.
Step 1: Obtain your API Key
- Navigate to the developer console (or log in on production).
- Click New Key under API Credentials.
- Provide a description label (e.g. "Slack Bot Integration") and generate the key.
- Copy the key immediately and save it securely. It will not be shown again.
Step 2: Connection Details
- Production Endpoint Base:
https://stockup.cc/v1/query - Local Testing Endpoint:
http://127.0.0.1:5001/stockup-4ab83/us-central1/quanPublicApi - HTTP Request Method:
POST - Required Headers:
Content-Type: application/json
x-api-key: YOUR_API_KEY
Step 3: Choose a Model Variant
The StockUp API supports four model variations tailored for specific financial tasks:
quan-3.0(Lite): Optimized for raw speed and minimal latencies. Powered by StockUp's lightweight reasoning engine. Best for quick summaries, basic definitions, and rapid stock stats.quan-3.3(Standard Legacy): Previous flagship model for high-precision reasoning and numerical calculations.quan-3.4-l: Lightweight Quan 3.4 for faster, lower-cost grounded market analysis. It uses the Quan 3.4 reasoning contract and costs $0.75/M input and $4.50/M output tokens.quan-3.4(Standard Flagship): Brand new flagship model for high-precision reasoning, numerical calculations, and next-generation LBO and DCF estimates. Powered by StockUp's latest flagship reasoning architecture.quan-3.4-deep-research(Deep Thinking): Advanced deep reasoning model for massive audits, competitor catalysts, and deep portfolio modeling. Powered by StockUp's deep reasoning architecture.
Step 4: Request Payload Structure
All payloads are structured as standard JSON. We support standard OpenAI-compatible message matrices:
Response budgets: API keys have configurable defaultMaxOutputTokens and maxOutputTokensCap settings. They default to 65,536. Set maxOutputTokens per request for a lower budget; requests above the key cap or provider maximum are rejected, and requests that cannot be funded are rejected before generation rather than silently truncated. Thinking tokens count toward usage and billing.
{
"model": "quan-3.4",
"messages": [
{ "role": "user", "content": "Compare Apple and Microsoft valuation." }
],
"googleSearch": true,
"stream": true,
"temperature": 0.2
}
Request Parameters Table
| Parameter | Type | Description |
|---|---|---|
model |
string |
Identifies the model variant (quan-3.0, quan-3.3, quan-3.4-l, quan-3.4, or quan-3.4-deep-research). Defaults to quan-3.4. |
messages |
array |
An array of conversation objects: [{"role": "user" | "assistant", "content": "string"}]. |
stream |
boolean |
Enable Server-Sent Events (SSE) streaming for real-time text delivery. Defaults to true. |
googleSearch |
boolean |
Enable live web grounding for up-to-date context. Defaults to true. |
temperature |
number |
Model temperature value between 0.0 and 2.0. Lower values are recommended for math. |
Step 5: Code Integration Examples
curl -X POST "https://stockup.cc/v1/query" \
-H "Content-Type: application/json" \
-H "x-api-key: sk_quan_your_secret_key" \
-d '{
"model": "quan-3.4",
"messages": [
{ "role": "user", "content": "How does compound interest work?" }
],
"stream": false
}'
const apiKey = "sk_quan_your_secret_key";
const url = "https://stockup.cc/v1/query";
async function streamResponse() {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": apiKey
},
body: JSON.stringify({
model: "quan-3.4",
messages: [{ role: "user", content: "Analyze Apple stock setup." }],
stream: true
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop(); // Keep partial line in buffer
for (const line of lines) {
if (line.startsWith("data: ")) {
const payload = line.slice(6).trim();
if (payload === "[DONE]") {
console.log("\n--- Stream Finished ---");
break;
}
try {
const chunk = JSON.parse(payload);
const text = chunk.candidates?.[0]?.content?.parts?.[0]?.text || "";
process.stdout.write(text);
} catch (err) {
// Skip non-JSON chunks or log metadata
}
}
}
}
}
streamResponse();
import requests
url = "https://stockup.cc/v1/query"
headers = {
"Content-Type": "application/json",
"x-api-key": "sk_quan_your_secret_key"
}
payload = {
"model": "quan-3.4",
"messages": [
{"role": "user", "content": "Explain the difference between P/E and forward P/E."}
],
"stream": False
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
data = response.json()
text = data['candidates'][0]['content']['parts'][0]['text']
print(text)
else:
print(f"Error {response.status_code}: {response.text}")
Note on CORS: When calling this endpoint from web browsers, standard CORS preflight requests apply. Be sure to configure safe headers, or run calls through your own server to avoid exposing your secret API key on client-side browsers.
Integrating Quan Visual Elements
Quan Visual Elements are frontend components for turning trusted financial values into app-ready visual cards. They are useful for DCA projections, forensic audit summaries, risk radar panels, and analyst split panels.
Important: public API responses are plain text/JSON response streams today. Do not expect raw [QUAN_VISUALS] or [CHART_DATA] blocks from the public API. Use Quan for analysis, use your own backend/provider data for verified values, then map those values into the visual data object below.
1. Add the visual renderer files
Copy the shared visual files into your public assets folder, then load the CSS and JavaScript on the page where the visual should appear.
<link rel="stylesheet" href="/assets/quan-visual-demo.css"> <script src="/assets/quan-visual-demo.js" defer></script>
2. Add the visual shell
The renderer initializes every .quan-visual-demo section on the page. The stock buttons, visual buttons, and view hooks are required. The explanation hook is optional.
<section class="quan-visual-demo"
data-default-stock="VOO"
data-default-visual="dca"
data-demo-context="api"
data-demo-guide-href="/docs#visual-elements"
data-demo-stocks="VOO,NVDA,AMZN,MSFT">
<div class="qvd-showcase">
<div class="qvd-visual-column">
<div class="qvd-shell">
<div class="qvd-controls">
<div class="qvd-control-group">
<div class="qvd-control-label">Stock</div>
<div class="qvd-button-row" data-demo-stock-buttons></div>
</div>
<div class="qvd-control-group">
<div class="qvd-control-label">Visual element</div>
<div class="qvd-button-row" data-demo-visual-buttons></div>
</div>
</div>
<div class="qvd-view" data-demo-view aria-live="polite"></div>
</div>
</div>
<div class="qvd-copy">
<span class="qvd-kicker">Interactive visual elements</span>
<h2>Quan visual elements</h2>
<p>Use trusted backend values to render app-ready financial visuals.</p>
<div class="qvd-explain-card" data-demo-explanation aria-live="polite"></div>
</div>
</div>
</section>
3. Supply your own ticker data
Define window.QuanVisualDemoData before loading or re-initializing the renderer. The data shape below is intentionally plain JavaScript so it can be generated from any backend.
window.QuanVisualDemoData = {
VOO: {
name: "Vanguard S&P 500 ETF",
dca: {
monthly: 1000,
years: 10,
annualReturn: 7.4,
cagr: 3.73
},
audit: {
verdict: "Clean broad-market exposure with macro sensitivity",
confidence: "High",
checks: [
["Source coverage", "Broad ETF data is easy to cross-check", "good"],
["Narrative risk", "Mostly index-level claims", "good"],
["Key watch", "Multiple compression if rates stay elevated", "warn"]
]
},
risk: {
score: 42,
summary: "Balanced",
factors: [
["Valuation", 48, "Market multiple is the main sensitivity."],
["Concentration", 36, "Diversified, with mega-cap weight."],
["Volatility", 40, "Lower than most single-name equities."],
["Earnings sensitivity", 44, "Index EPS revisions matter."],
["Macro exposure", 52, "Rate and growth expectations matter."]
]
},
analyst: {
consensus: "Broad market proxy",
asOf: "Provider snapshot",
buy: 65,
hold: 30,
sell: 5,
low: 455,
average: 520,
high: 585
}
}
};
// Use this when you update data after the page has already loaded.
window.initQuanVisualDemos?.();
4. Call Quan through a safe backend proxy
Keep your StockUp API key server-side. Your backend can call Quan for a written analysis, then combine that analysis with verified values from your market-data provider before sending visual data to your frontend.
import express from "express";
const app = express();
app.use(express.json());
app.post("/api/quan-visual", async (req, res) => {
const ticker = String(req.body.ticker || "VOO").toUpperCase();
const quanResponse = await fetch("https://stockup.cc/v1/query", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.STOCKUP_API_KEY
},
body: JSON.stringify({
model: "quan-3.4",
stream: false,
googleSearch: true,
temperature: 0.2,
messages: [{
role: "user",
content: `Summarize ${ticker} risk, DCA assumptions, audit concerns, and analyst context. Separate confirmed facts from judgment.`
}]
})
});
const quanJson = await quanResponse.json();
const analysisText =
quanJson?.candidates?.[0]?.content?.parts?.[0]?.text || "";
// Replace these placeholders with verified values from your own provider.
const providerValues = await loadVerifiedMarketValues(ticker);
res.json({
ticker,
analysisText,
visualData: mapToQuanVisualData(ticker, providerValues)
});
});
function mapToQuanVisualData(ticker, values) {
return {
[ticker]: {
name: values.name,
dca: {
monthly: values.monthlyContribution,
years: values.projectionYears,
annualReturn: values.assumedAnnualReturn,
cagr: values.estimatedCagr
},
audit: {
verdict: values.auditVerdict,
confidence: values.auditConfidence,
checks: values.auditChecks
},
risk: {
score: values.riskScore,
summary: values.riskSummary,
factors: values.riskFactors
},
analyst: {
consensus: values.consensus,
asOf: values.asOf,
buy: values.buyCount,
hold: values.holdCount,
sell: values.sellCount,
low: values.targetLow,
average: values.targetAverage,
high: values.targetHigh
}
}
};
}
5. Render backend data in your frontend
Fetch your proxy output, assign the returned visualData, and re-run the renderer.
async function loadQuanVisual(ticker) {
const response = await fetch("/api/quan-visual", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ticker })
});
const payload = await response.json();
window.QuanVisualDemoData = payload.visualData;
window.initQuanVisualDemos?.();
// Optional: display Quan's written analysis beside the visual.
document.querySelector("#analysisText").textContent = payload.analysisText;
}
loadQuanVisual("VOO");
Production checklist
- Never expose
x-api-keyin browser JavaScript. - Use verified provider data for exact prices, analyst counts, targets, and financial metrics.
- Label projections as assumptions and include a disclaimer near DCA outputs.
- Sanitize or validate any values generated by an LLM before rendering them into a visual.
- Prefer concise labels on mobile so buttons, stat cards, and tables do not overflow.