Use the Stock Trends API with x402
The Stock Trends API supports x402 machine-native payment for premium AI-agent workflows and financial intelligence execution.
x402 allows agents to execute premium requests using permissionless per-request payment on Base using USDC — no subscription or API key required.
The API combines ST-IM forward return intelligence, portfolio workflows, market regime analysis, breadth and leadership data, and structured financial decision endpoints.
What is x402 agent pay?
x402 is an HTTP-native payment protocol for machine-to-machine payment workflows.
When an agent calls a premium endpoint without a subscription API key, the Stock Trends API returns HTTP 402 Payment Required with payment requirements for that request.
The agent submits payment on Base using USDC, then retries the request with payment proof headers.
The API validates the payment proof and returns the premium response.
Paid workflows use long-horizon Stock Trends signals
Premium ST-IM, screener, portfolio, regime, breadth, and leadership responses are built around Stock Trends classification semantics with historical records extending back to 1980 and 16M+ structured observations. They are market-intelligence workflows, not shallow market-data wrappers.
Treat paid responses as research provenance for probabilistic and agentic workflows. They are not investment advice, price targets, direct buy/sell commands, or guarantees of future performance.
Premium endpoint coverage
x402 payment support is active across premium endpoint families including:
- ST-IM intelligence endpoints
- Portfolio workflows
- Decision workflows
- Market regime intelligence
- Leadership and breadth analysis
- Agent screening workflows
The live pricing catalog remains authoritative for current premium coverage and endpoint cost behavior.
Pricing clarity: STC and USD cost
Stock Trends Credits (STC) are the API pricing unit.
Current billing presentation: 1 STC = $1.00 USD
| Endpoint price | Current USD cost |
|---|---|
| 0.15 STC | $0.15 USD |
| 0.50 STC | $0.50 USD |
| 1.25 STC | $1.25 USD |
The live pricing catalog and payment-required responses remain authoritative.
Recommended discovery workflow for AI agents
-
Discover workflows:
GET /v1/ai/tools -
Review indicator definitions:
GET /v1/ai/context -
Inspect live pricing:
GET /v1/pricing/catalog -
Estimate workflow cost:
GET /v1/cost-estimate - Execute a premium workflow
Recommended first premium endpoint
GET https://api.stocktrends.com/v1/agent/screener/top
Returns top-ranked instruments filtered by trend, exchange, RSI, and ST-IM intelligence.
Current live cost: 0.50 STC ($0.50 USD)
Step-by-step x402 flow
Step 1 — Discover workflows
GET /v1/ai/tools GET /v1/pricing/catalog
Step 2 — Execute premium request
GET /v1/agent/screener/top
Step 3 — Receive HTTP 402 Payment Required
The API responds with payment requirements and current endpoint cost.
Step 4 — Submit Base USDC payment
Retain the transaction hash for the retry request.
Step 5 — Retry with payment proof headers
X-StockTrends-Payment-Method: x402 X-StockTrends-Payment-Network: base X-StockTrends-Payment-Token: USDC X-StockTrends-Payment-Reference: 0x...tx_hash
Step 6 — Receive premium response
Example requests
Initial request (no API key)
curl -i "https://api.stocktrends.com/v1/agent/screener/top"
Retry with x402 payment proof
curl "https://api.stocktrends.com/v1/agent/screener/top" \ -H "X-StockTrends-Payment-Method: x402" \ -H "X-StockTrends-Payment-Network: base" \ -H "X-StockTrends-Payment-Token: USDC" \ -H "X-StockTrends-Payment-Reference: 0x...tx_hash"
ST-IM endpoint example
curl "https://api.stocktrends.com/v1/stim/latest?symbol_exchange=IBM-N" \ -H "X-StockTrends-Payment-Method: x402" \ -H "X-StockTrends-Payment-Network: base" \ -H "X-StockTrends-Payment-Token: USDC" \ -H "X-StockTrends-Payment-Reference: 0x...tx_hash"
Optional agent identity headers
X-StockTrends-Agent-Id: your-agent-id X-StockTrends-Agent-Type: autonomous X-StockTrends-Agent-Vendor: your-vendor X-StockTrends-Request-Purpose: screening
These headers improve usage tracking and agent ledger visibility.
Next steps
- Use MPP funded sessions for repeated workflows
- Use portfolio and decision workflows for actionable outputs
- Combine regime, breadth, and leadership endpoints for market context