# Demandex API — Full Agent Reference (v0.1.0) > Extended reference: every endpoint with full description, parameters, and an example JSON > body. Compact version: https://api.demandex.dev/llms.txt · OpenAPI: https://api.demandex.dev/openapi.json ## Base URL & discovery surface - API base: https://api.demandex.dev - /llms.txt (compact) · /llms-full.txt (this) · /discovery (JSON enumeration) - /openapi.json (OpenAPI 3.1) · /.well-known/x402 · /.well-known/agent-card.json - Payment: x402 V2 · Networks: eip155:8453 · Asset: USDC · Scheme: exact ## GET /v1/categories (FREE) Free, no payment. Returns the category index — every active category with its opportunity count, top opportunity score, and last-updated time. A cheap change-detection funnel an agent can poll to learn which categories to buy into. Shape: { categories: [{ slug, opportunityCount, topScore, lastUpdated }], generatedAt }. Rate limit: 30/min. Example response: ```json { "categories": [ { "slug": "audio", "opportunityCount": 12, "topScore": 87.4, "lastUpdated": "2026-07-18T11:30:00.000Z" } ], "generatedAt": "2026-07-18T11:45:00.000Z" } ``` ## GET /v1/sample/opportunity (FREE) Free, no payment. Returns one REAL, fixed sample opportunity card in the SAME full shape as the paid GET /v1/opportunity — all score components, productAngle, summary, and verbatim evidence — plus { sample: true, note, cardAsOf }. It is a stable teaching sample (real data) so an agent can learn the exact card shape before paying. Returns 503 corpus_warming only while the index is empty (no cards mined yet). Rate limit: 10/min. Example response: ```json { "sample": true, "note": "fixed sample card — same shape as paid /v1/opportunity", "cardAsOf": "2026-07-18T09:00:00.000Z", "slug": "sony-wh1000xm5-replacement-headband", "title": "Sony WH-1000XM5 replacement headband", "category": "audio", "score": 87.4 } ``` ## GET /v1/opportunities/trending ($0.01) Paid ($0.01 USDC via x402). Returns the top 20 active opportunity cards by score as TEASERS — { id, slug, title, category, score, signalCount, lastSeen } only. No evidence and no productAngle (buy GET /v1/opportunity for the full card). While the index is still warming and no active cards exist yet, you get a no-charge 503 corpus_warming (never an empty charged list) — poll the free GET /v1/categories to see when cards go live. Compute-first / settle-after — you are not charged on any error. Response carries fetchedAt. Settlement: compute-first. Example response: ```json { "opportunities": [ { "id": "ckxxxx", "slug": "sony-wh1000xm5-replacement-headband", "title": "Sony WH-1000XM5 replacement headband", "category": "audio", "score": 87.4, "signalCount": 34, "lastSeen": "2026-07-18T10:00:00.000Z" } ], "fetchedAt": "2026-07-18T11:45:00.000Z", "charged": true } ``` ## GET /v1/opportunities ($0.02) Paid ($0.02 USDC via x402). Returns up to 50 active opportunity cards in a category, each as a teaser ({ id, slug, title, category, score, signalCount, lastSeen }) plus its summary. Requires ?category=; ?minScore= optionally filters. A missing or unknown category returns a no-charge 400 that lists the valid categories; a valid category with no active cards yet (index still warming) returns a no-charge 503 corpus_warming instead of an empty charged list. Compute-first / settle-after — you are not charged on any error. Response carries fetchedAt. Parameters: - `category` (string, query, required) — Category slug (required). Unknown/missing → no-charge 400 listing valid categories. - `minScore` (number, query, optional) — Optional minimum composite score (0-100) filter. Settlement: compute-first. Example response: ```json { "category": "audio", "opportunities": [ { "id": "ckxxxx", "slug": "sony-wh1000xm5-replacement-headband", "title": "Sony WH-1000XM5 replacement headband", "category": "audio", "score": 87.4, "signalCount": 34, "lastSeen": "2026-07-18T10:00:00.000Z", "summary": "Owners repeatedly seek an aftermarket replacement headband after the OEM band cracks." } ], "fetchedAt": "2026-07-18T11:45:00.000Z", "charged": true } ``` ## GET /v1/opportunity ($0.05) Paid ($0.05 USDC via x402). Returns one full opportunity card by ?id= or ?slug= (exactly one required, else a no-charge 400): all score components (freqScore, intensityScore, wtpScore), productAngle, summary, evidence[] (verbatim quotes with subreddit, upvotes, permalink), builderMomentum, firstSeen, lastSeen, signalCount, distinctAuthors. Compute-first / settle-after — you are not charged when the id/slug is missing, ambiguous, or not found. Response carries fetchedAt. Parameters: - `id` (string, query, optional) — Opportunity id (provide exactly one of id or slug). - `slug` (string, query, optional) — Opportunity slug (provide exactly one of id or slug). Settlement: compute-first. Example response: ```json { "id": "ckxxxx", "slug": "sony-wh1000xm5-replacement-headband", "title": "Sony WH-1000XM5 replacement headband", "category": "audio", "score": 87.4, "freqScore": 90, "intensityScore": 82, "wtpScore": 88, "productAngle": "Sell a durable aftermarket replacement headband for the Sony WH-1000XM5.", "summary": "Owners repeatedly seek an aftermarket replacement headband after the OEM band cracks.", "signalCount": 34, "distinctAuthors": 29, "firstSeen": "2026-06-01T00:00:00.000Z", "lastSeen": "2026-07-18T10:00:00.000Z", "evidence": [ { "quote": "My XM5 headband cracked after 8 months and Sony wants $90 for a repair — where can I just buy the band?", "permalink": "https://reddit.com/r/headphones/comments/abc123", "upvotes": 214, "subreddit": "headphones" } ], "builderMomentum": null, "fetchedAt": "2026-07-18T11:45:00.000Z", "charged": true } ``` ## POST /v1/gauge ($0.03) Paid ($0.03 USDC via x402). POST { "query": "...", "category"?: "..." } to get a demand verdict for any physical-product query. Answers are cached 7 days by normalized query; on a cache miss Demandex matches the query against the mined corpus (signals and cards by keyword) and runs one LLM synthesis call. query must be 3..200 chars. Reads the JSON body first, falling back to ?query=. Verdict shape: { query, verdictScore (0-100), demandTemperature (cold|warm|hot), rationale, topEvidence[] (≤5, each { quote, permalink, upvotes }), relatedOpportunities[] (≤5, each { slug, score }), cache (hit|miss), fetchedAt }. A zero-match query is a real cold verdict (chargeable), not an error. If the LLM is unavailable you get a 503 and are not charged. Compute-first / settle-after. Parameters: - `query` (string, body, required) — The product/demand query to gauge (3..200 chars). Required. - `category` (string, body, optional) — Optional category slug to scope the corpus match. Settlement: compute-first. Example response: ```json { "query": "sony xm5 replacement headband", "verdictScore": 84, "demandTemperature": "hot", "rationale": "Frequent owner complaints about the OEM headband cracking, with buyers actively hunting for aftermarket replacements.", "topEvidence": [ { "quote": "My XM5 headband cracked after 8 months and Sony wants $90 for a repair — where can I just buy the band?", "permalink": "https://reddit.com/r/headphones/comments/abc123", "upvotes": 214 } ], "relatedOpportunities": [ { "slug": "sony-wh1000xm5-replacement-headband", "score": 87.4 } ], "cache": "miss", "fetchedAt": "2026-07-18T11:45:00.000Z", "charged": true } ``` ## POST /v1/gauge/live ($0.1) Paid ($0.10 USDC via x402). Same body as /v1/gauge — POST { "query": "...", "category"?: "..." } (query 3..200 chars; body-first, ?query= fallback). Combines the mined corpus with a LIVE Reddit search run at request time (up to 50 posts, subreddits unrestricted) and one LLM synthesis call. Total compute budget is 45 seconds; on timeout you get a 504 and are not charged. Returns the same verdict shape as /v1/gauge (cache is always miss). A zero-match, empty-search query is a real cold verdict (chargeable), not an error. If the LLM is unavailable you get a 503 and are not charged. Compute-first / settle-after. Parameters: - `query` (string, body, required) — The product/demand query to gauge with live research (3..200 chars). Required. - `category` (string, body, optional) — Optional category slug to scope the corpus match. Settlement: compute-first. Example response: ```json { "query": "sony xm5 replacement headband", "verdictScore": 86, "demandTemperature": "hot", "rationale": "Live Reddit search plus mined signals show sustained, recent demand for an aftermarket XM5 headband.", "topEvidence": [ { "quote": "Just found out the XM5 band is glued in — anyone selling a replacement?", "permalink": "https://reddit.com/r/headphones/comments/def456", "upvotes": 58 } ], "relatedOpportunities": [ { "slug": "sony-wh1000xm5-replacement-headband", "score": 87.4 } ], "cache": "miss", "fetchedAt": "2026-07-18T11:45:00.000Z", "charged": true } ``` ## Payment Strictly pay-per-call. An unpaid paid-route request returns a 402 challenge whose accepts[] lists one exact USDC rail per network (Base). Sign one rail and retry with PAYMENT-SIGNATURE (x402 V2) or X-PAYMENT (legacy).