{"openapi":"3.1.0","info":{"title":"Parkinson's Pathways TrialPath Agent API","version":"1.0.0","description":"Agent-facing read API over the universal ClinicalTrials.gov mirror. Free tier via X-API-Key (request one at POST /api/agent/v1/keys/request). Otherwise pay per call in USDC over the x402 protocol.","contact":{"name":"Parkinson's Pathways","url":"https://parkinsonspathways.com/agents"}},"servers":[{"url":"/"}],"x-x402":{"payTo":"0x3ecFe6030AeD6d101e0C72Af2f2c0e7CfF781d69","network":"base","asset":"USDC","protocol":"x402","humanIndex":"/agents","machineIndex":"/api/agent/v1/llms-index"},"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"},"x402":{"type":"apiKey","in":"header","name":"X-PAYMENT","description":"x402 payment header. See https://x402.org"}},"schemas":{"Cursor":{"type":"string","description":"Opaque base64url cursor; pass back as ?cursor= to paginate."},"TrialSummary":{"type":"object","properties":{"nctId":{"type":"string"},"primaryCondition":{"type":"string","nullable":true},"sponsor":{"type":"string","nullable":true},"phase":{"type":"string","nullable":true},"overallStatus":{"type":"string","nullable":true},"studyType":{"type":"string","nullable":true},"countries":{"type":"array","items":{"type":"string"}},"drugClassTags":{"type":"array","items":{"type":"string"}},"interventionKinds":{"type":"array","items":{"type":"string"}},"ctLastUpdatePostDate":{"type":"string","nullable":true},"lastChangedAt":{"type":"string","format":"date-time"},"brief":{"type":"string","description":"Path to the per-trial brief endpoint."}}},"TrialBrief":{"type":"object","properties":{"nctId":{"type":"string"},"primaryCondition":{"type":"string","nullable":true},"conditions":{"type":"array","items":{"type":"string"}},"sponsor":{"type":"string","nullable":true},"phase":{"type":"string","nullable":true},"overallStatus":{"type":"string","nullable":true},"studyType":{"type":"string","nullable":true},"countries":{"type":"array","items":{"type":"string"}},"drugClassTags":{"type":"array","items":{"type":"string"}},"interventionKinds":{"type":"array","items":{"type":"string"}},"mechanismKeywords":{"type":"array","items":{"type":"string"}},"briefDescription":{"type":"string","nullable":true},"detailedDescription":{"type":"string","nullable":true},"eligibilityCriteria":{"type":"string","nullable":true},"arms":{"type":"array","items":{"type":"object","additionalProperties":true}},"interventions":{"type":"array","items":{"type":"object","additionalProperties":true}},"outcomes":{"type":"object","properties":{"primary":{"type":"array","items":{"type":"object","additionalProperties":true}},"secondary":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"sites":{"type":"array","items":{"type":"object","additionalProperties":true}},"pdOverlay":{"type":"object","nullable":true,"description":"Present only when the same NCT id is in the curated PD trials table.","properties":{"aiSummary":{"type":"string","nullable":true},"fiveWordGoal":{"type":"string","nullable":true}}},"recentChanges":{"type":"array","items":{"$ref":"#/components/schemas/FieldChange"}},"sources":{"type":"object","properties":{"ctgov":{"type":"string","format":"uri"},"mirrorMarkdown":{"type":"string"}}}}},"FieldChange":{"type":"object","properties":{"id":{"type":"integer"},"nctId":{"type":"string"},"fieldPath":{"type":"string"},"changeKind":{"type":"string","enum":["added","removed","modified"]},"oldValue":{},"newValue":{},"primaryCondition":{"type":"string","nullable":true},"sponsor":{"type":"string","nullable":true},"countries":{"type":"array","items":{"type":"string"}},"changedAt":{"type":"string","format":"date-time"},"brief":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"PaymentRequiredBody":{"type":"object","description":"x402 payment-requirements payload. Pay any of the listed accepts and replay with X-PAYMENT.","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"accepts":{"type":"array","items":{"type":"object","additionalProperties":true}}}}},"responses":{"PaymentRequired":{"description":"Payment required (no API key, free quota exhausted, and no/invalid X-PAYMENT supplied). Always machine-readable JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredBody"},"example":{"x402Version":1,"error":"X-PAYMENT header is required","accepts":[{"scheme":"exact","network":"base","maxAmountRequired":"5000","resource":"https://parkinsonspathways.com/api/agent/v1/trials/search","description":"Search the universal CT.gov mirror.","mimeType":"application/json","payTo":"0x3ecFe6030AeD6d101e0C72Af2f2c0e7CfF781d69","maxTimeoutSeconds":60,"asset":"USDC"}]}}}},"RateLimited":{"description":"Rate limited. Back off and retry after the window indicated in standard rate-limit headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"rate_limited","message":"Too many requests. Please slow down."}}}}}},"security":[{"apiKeyAuth":[]},{"x402":[]}],"paths":{"/api/agent/v1/catalysts":{"get":{"summary":"Catalyst Calendar. Forward-looking trial milestones. $0.05 per call.","description":"Returns upcoming trial catalysts (primary completion dates, recent status changes, stale signals) over the universal CT.gov mirror.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Default: today."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Default: today + 180 days."},{"name":"kind","in":"query","schema":{"type":"string"},"description":"Comma-separated: primary_completion, status_change, stale."},{"name":"condition","in":"query","schema":{"type":"string"}},{"name":"sponsor","in":"query","schema":{"type":"string"}},{"name":"phase","in":"query","schema":{"type":"string"}},{"name":"drug_class","in":"query","schema":{"type":"string"}},{"name":"country","in":"query","schema":{"type":"string"}},{"name":"min_enrollment","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}},{"name":"cursor","in":"query","schema":{"$ref":"#/components/schemas/Cursor"}}],"responses":{"200":{"description":"OK"},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/credits/tiers":{"get":{"summary":"List prepaid credit top-up tiers (free, public).","security":[],"responses":{"200":{"description":"OK"}}}},"/api/agent/v1/credits/balance":{"get":{"summary":"Get prepaid credits balance for the calling key (free with key).","responses":{"200":{"description":"OK"},"401":{"description":"Missing X-API-Key"}}}},"/api/agent/v1/credits/transactions":{"get":{"summary":"List prepaid credit ledger entries for the calling key (free with key).","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":200}}],"responses":{"200":{"description":"OK"},"401":{"description":"Missing X-API-Key"}}}},"/api/agent/v1/credits/topup":{"post":{"summary":"Top up prepaid credits over x402. Per-tier price; bonus credit added on top.","description":"Pick a tier and the server demands the EXACT USDC amount registered for that tier. Tier prices: trial $10 (0% bonus), builder $50 (+10%), growth $200 (+25%, ⭐ most popular), scale $1000 (+30%), enterprise $5000 (+33%). On-chain tx hashes are unique-constrained, so a replayed payment is rejected with 409.","parameters":[{"name":"tier","in":"query","required":true,"schema":{"type":"string","enum":["trial","builder","growth","scale","enterprise"]}}],"responses":{"200":{"description":"Credits added"},"400":{"description":"Invalid tier"},"401":{"description":"Missing X-API-Key"},"402":{"$ref":"#/components/responses/PaymentRequired"},"409":{"description":"Duplicate payment_tx_hash (already credited)"}}}},"/api/agent/v1/llms-index":{"get":{"summary":"Free machine-readable index of endpoints + pricing.","security":[],"responses":{"200":{"description":"OK"}}}},"/api/agent/v1/openapi.json":{"get":{"summary":"This document.","security":[],"responses":{"200":{"description":"OK"}}}},"/api/agent/v1/keys/request":{"post":{"summary":"Request a free-tier API key. The raw key is shown ONCE in the response. Gated by Cloudflare Turnstile: request from a real browser using the widget on /agents, or pass a valid Turnstile token obtained out-of-band.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","turnstileToken"],"properties":{"email":{"type":"string","format":"email"},"turnstileToken":{"type":"string","minLength":10,"description":"Cloudflare Turnstile response token. Obtained client-side from the cf-turnstile widget (see /agents) and passed through to the server, which verifies it against challenges.cloudflare.com/turnstile/v0/siteverify."}}}}}},"responses":{"200":{"description":"Key issued.","content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"type":"string","description":"The raw key. Store it securely; it is not retrievable."},"keyPrefix":{"type":"string"},"freeTierDailyLimit":{"type":"integer"}}}}}},"400":{"description":"Invalid request body or Turnstile challenge failed (error: 'invalid_request' or 'captcha_failed')."},"429":{"description":"Rate limited (5 keys/hour/IP)."}}}},"/api/agent/v1/trials/search":{"get":{"summary":"Search the universal CT.gov mirror. Requires an API key (401 without one); free tier or $0.005 per call.","security":[{"apiKeyAuth":[]}],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"condition","in":"query","schema":{"type":"string"}},{"name":"sponsor","in":"query","schema":{"type":"string"}},{"name":"country","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"phase","in":"query","schema":{"type":"string"}},{"name":"drug_class","in":"query","schema":{"type":"string"},"description":"Comma-separated tag list."},{"name":"intervention","in":"query","schema":{"type":"string"},"description":"Comma-separated CT.gov intervention kinds."},{"name":"lat","in":"query","schema":{"type":"number"},"description":"Latitude for radius filtering. Requires lng + radius_km."},{"name":"lng","in":"query","schema":{"type":"number"},"description":"Longitude for radius filtering. Requires lat + radius_km."},{"name":"radius_km","in":"query","schema":{"type":"number","default":100,"maximum":20000},"description":"Radius in kilometers around lat/lng."},{"name":"limit","in":"query","schema":{"type":"integer","default":25,"maximum":50}},{"name":"cursor","in":"query","schema":{"$ref":"#/components/schemas/Cursor"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"nextCursor":{"type":"string","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/TrialSummary"}}}},"example":{"count":2,"nextCursor":"MjAyNi0wNS0wOCAyMToyNTowMi43NTd8TkNUMDI0Mjg4MTY","results":[{"nctId":"NCT02071459","primaryCondition":"Multiple System Atrophy","sponsor":"University Hospital, Toulouse","phase":"PHASE2, PHASE3","overallStatus":"COMPLETED","studyType":"INTERVENTIONAL","countries":["France"],"drugClassTags":[],"interventionKinds":["DRUG"],"ctLastUpdatePostDate":"2026-04-08","lastChangedAt":"2026-05-08T21:25:02.962Z","brief":"/api/agent/v1/trials/NCT02071459/brief"}]}}}},"401":{"description":"Missing X-API-Key. This endpoint requires a key even for paid (x402) calls."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/trials/{nctId}/brief":{"get":{"summary":"Single-trial brief. Requires an API key (401 without one); free tier or $0.02 per call.","security":[{"apiKeyAuth":[]}],"parameters":[{"name":"nctId","in":"path","required":true,"schema":{"type":"string","example":"NCT04201093"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialBrief"},"example":{"nctId":"NCT04201093","primaryCondition":"Parkinson's Disease","conditions":["Parkinson's Disease"],"sponsor":"Example Sponsor Inc","phase":"PHASE2","overallStatus":"RECRUITING","studyType":"INTERVENTIONAL","countries":["United States"],"drugClassTags":["LRRK2"],"interventionKinds":["DRUG"],"mechanismKeywords":["inhibitor"],"briefDescription":"A study of an investigational LRRK2 inhibitor in PD.","eligibilityCriteria":"INCLUSION CRITERIA: ...","arms":[],"interventions":[],"outcomes":{"primary":[],"secondary":[]},"sites":[],"pdOverlay":{"aiSummary":"Plain-language summary…","fiveWordGoal":"Slow Parkinson disease progression safely"},"recentChanges":[],"sources":{"ctgov":"https://clinicaltrials.gov/study/NCT04201093","mirrorMarkdown":"/agent/trials/NCT04201093.md"}}}}},"400":{"description":"Invalid NCT id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"invalid_nct_id","message":"Expected NCT followed by 8 digits."}}}},"401":{"description":"Missing X-API-Key. This endpoint requires a key even for paid (x402) calls (applies to both basic and full briefs)."},"402":{"$ref":"#/components/responses/PaymentRequired"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"not_found","message":"No mirror record for NCT99999999."}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/field-changes":{"get":{"summary":"Filterable field-change feed with dynamic pricing. Requires an API key (401 without one); free tier OR $0.02 basic / $0.05 premium per call.","security":[{"apiKeyAuth":[]}],"description":"Pricing tiers are determined per-request from the `field` query parameter:\n\n- **Basic ($0.02):** no `field` filter, or only non-premium paths (e.g. `status.overallStatus`, `sponsor.lead`, `locations.*`, `design.*`). Responses never include premium fields.\n- **Premium ($0.05):** the `field` filter includes any of the premium prefixes `eligibility`, `outcomes`, `armsInterventions`, `results`, `whyStopped` (matched exactly or as `<prefix>.*`, e.g. `eligibility.criteria`, `outcomes.primary`). Responses include those diffs.\n\nx402 settlement uses the corresponding price; the 402 challenge issued by the server tells the client the exact amount required for the request as submitted.","parameters":[{"name":"since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Lower bound on change time. Cannot be more than 90 days in the past (400 since_too_old otherwise) — page forward with the cursor for older changes."},{"name":"until","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"field","in":"query","schema":{"type":"string"},"description":"Comma-separated list of field paths. Including any premium prefix (eligibility, outcomes, armsInterventions, results, whyStopped) escalates the call to the $0.05 premium tier."},{"name":"change_kind","in":"query","schema":{"type":"string"},"description":"Comma-separated: added, removed, modified."},{"name":"condition","in":"query","schema":{"type":"string"}},{"name":"sponsor","in":"query","schema":{"type":"string"}},{"name":"country","in":"query","schema":{"type":"string"}},{"name":"nct_id","in":"query","schema":{"type":"string"},"description":"Comma-separated NCT IDs."},{"name":"lat","in":"query","schema":{"type":"number"}},{"name":"lng","in":"query","schema":{"type":"number"}},{"name":"radius_km","in":"query","schema":{"type":"number","default":100,"maximum":20000}},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}},{"name":"cursor","in":"query","schema":{"$ref":"#/components/schemas/Cursor"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"nextCursor":{"type":"string","nullable":true},"changes":{"type":"array","items":{"$ref":"#/components/schemas/FieldChange"}}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing X-API-Key. This endpoint requires a key even for paid (x402) calls."},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/match":{"post":{"summary":"Rank trials for a structured patient profile across ANY condition. Free tier or $0.10 per call.","description":"Universal trial matcher over the CT.gov mirror. Hard disqualifiers (age, sex, healthy-volunteer, exclusion-criteria conflicts on comorbidities/priorTreatments/excludeTerms) drop trials entirely. Remaining trials are scored across the dimensions the caller supplies and reported with a normalized 0..1 fit score. PD-curated AI summary + five-word goal are merged in as a read-only overlay when the trial also lives in the PD `trials` table.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["condition","age"],"properties":{"condition":{"type":"string","description":"Disease name. ILIKE-matched against the mirror's primary_condition AND conditions[]."},"age":{"type":"integer","minimum":0,"maximum":120},"sex":{"type":"string","enum":["male","female","all"]},"stage":{"type":"string","enum":["recently_diagnosed","living_with_it","advanced"],"description":"Only scored when condition matches Parkinson's disease."},"locationRegion":{"type":"string","enum":["us","canada","international","postcode","any"]},"state":{"type":"string"},"travelPreference":{"type":"string","enum":["can_travel","local_only","virtual_only"]},"postcodeLat":{"type":"number"},"postcodeLng":{"type":"number"},"postcodeRadiusMiles":{"type":"integer"},"country":{"type":"string","description":"Restrict to trials with a site in this country."},"meds":{"type":"array","items":{"type":"string"},"description":"Current medications. Soft caution if found in exclusion criteria."},"comorbidities":{"type":"array","items":{"type":"string"},"description":"HARD disqualifier if found in the trial's exclusion-criteria block."},"priorTreatments":{"type":"array","items":{"type":"string"},"description":"HARD disqualifier if found in exclusion-criteria block."},"biomarkers":{"type":"array","items":{"type":"string"},"description":"Genetic / biomarker status (LRRK2, GBA, EGFR, HER2+, BRCA1, ...). Boosts score; flags caution when trial mentions biomarker requirements but no match."},"performanceStatus":{"type":"string","description":"e.g. 'ECOG 0-1', 'Karnofsky >=70'."},"acceptsPlacebo":{"type":"boolean"},"healthyVolunteer":{"type":"boolean","description":"HARD disqualifier when trial's eligibility.healthyVolunteers contradicts."},"phasePreference":{"type":"array","items":{"type":"string","enum":["EARLY_PHASE1","PHASE1","PHASE2","PHASE3","PHASE4","NA"]}},"studyType":{"type":"string","enum":["INTERVENTIONAL","OBSERVATIONAL","EXPANDED_ACCESS"]},"sponsorPreference":{"type":"array","items":{"type":"string"}},"drugClasses":{"type":"array","items":{"type":"string"},"description":"Mirror enrichment tags (drug_class_tags)."},"interventionKinds":{"type":"array","items":{"type":"string"},"description":"CT.gov intervention kinds (DRUG, DEVICE, BEHAVIORAL, ...)."},"requireTerms":{"type":"array","items":{"type":"string"},"description":"Free-text terms that MUST appear in eligibility or title."},"excludeTerms":{"type":"array","items":{"type":"string"},"description":"HARD disqualifier when present in eligibility text."},"status":{"type":"string","enum":["RECRUITING","NOT_YET_RECRUITING","ACTIVE_NOT_RECRUITING","ENROLLING_BY_INVITATION","ANY"],"default":"RECRUITING"},"minScore":{"type":"number","minimum":0,"maximum":1,"default":0.5,"description":"Minimum normalized fit score (0..1)."},"limit":{"type":"integer","minimum":1,"maximum":100,"default":25}}},"example":{"condition":"breast cancer","age":54,"sex":"female","biomarkers":["HER2+","BRCA1"],"priorTreatments":["trastuzumab"],"phasePreference":["PHASE2","PHASE3"],"acceptsPlacebo":false,"locationRegion":"us","state":"California","travelPreference":"can_travel","limit":10}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"profile":{"condition":"breast cancer","conditionFamily":"general","age":54,"sex":"female","stage":null,"stageLabel":null,"locationRegion":"us","state":"California","travelPreference":"can_travel","filtersSupplied":{"biomarkers":2,"priorTreatments":1,"meds":0,"comorbidities":0,"sponsorPreference":0,"drugClasses":0,"interventionKinds":0,"requireTerms":0,"excludeTerms":0}},"minScore":0.5,"statusFilter":"RECRUITING","candidatesEvaluated":142,"candidatesEvaluatedCappedAt":500,"count":1,"matches":[{"nctId":"NCT05123456","title":"HER2+ breast cancer Phase 3","primaryCondition":"Breast Cancer","sponsor":"Genentech","phase":"PHASE3","status":"RECRUITING","studyType":"INTERVENTIONAL","countries":["United States"],"score":7,"maxScore":8,"normalizedScore":0.875,"fit":"strong","matched":["condition matches","site near patient","travel-compatible","female eligible","no placebo arm","phase PHASE3","biomarker match: HER2+"],"cautions":[],"matchedSites":3,"nearestKm":12.4,"aiSummary":null,"fiveWordGoal":null,"brief":"/api/agent/v1/trials/NCT05123456/brief","ctgov":"https://clinicaltrials.gov/study/NCT05123456"}]}}}},"400":{"description":"Invalid match payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/trials/{nctId}/snapshot":{"get":{"summary":"Replay a trial as it appeared at-or-before a date. Free tier or $0.01 per call.","parameters":[{"name":"nctId","in":"path","required":true,"schema":{"type":"string","example":"NCT04201093"}},{"name":"at","in":"query","schema":{"type":"string"},"description":"ISO timestamp or YYYY-MM-DD. Latest snapshot if omitted."}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"nctId":"NCT04201093","snapshotAt":"2026-04-08T12:00:00.000Z","contentHash":"ab12cd…","requestedAt":"2026-04-15T23:59:59.999Z","snapshot":{"protocolSection":{}},"sources":{"ctgov":"https://clinicaltrials.gov/study/NCT04201093","brief":"/api/agent/v1/trials/NCT04201093/brief"}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"$ref":"#/components/responses/PaymentRequired"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/sponsors/{slug}/activity":{"get":{"summary":"Sponsor activity rollup. Free tier or $0.005 per call.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","example":"biogen"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"slug":"biogen","sponsorKey":"biogen","sponsorName":"Biogen","trialCount":42,"countsByPhase":{"PHASE2":12},"countsByStatus":{"RECRUITING":18},"newTrialsLast30d":3,"newSitesLast30d":8,"topConditions":["Parkinson's Disease"],"refreshedAt":"2026-05-08T02:15:00.000Z","recentChanges":[],"trials":[]}}}},"402":{"$ref":"#/components/responses/PaymentRequired"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/investigators/{slug}/activity":{"get":{"summary":"Investigator rollup. Free tier or $0.005 per call.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"402":{"$ref":"#/components/responses/PaymentRequired"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/agent/v1/subscriptions":{"post":{"summary":"Register a webhook or SSE subscription. Free tier or $0.05 per call. Requires X-API-Key.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["filters"],"properties":{"name":{"type":"string","maxLength":120},"deliveryUrl":{"type":"string","format":"uri","description":"If omitted, use SSE at /subscriptions/{id}/stream."},"filters":{"type":"object","properties":{"fieldPaths":{"type":"array","items":{"type":"string"}},"conditions":{"type":"array","items":{"type":"string"}},"sponsors":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"type":"string"}},"nctIds":{"type":"array","items":{"type":"string","pattern":"^NCT\\d{8}$"}}}}}},"example":{"name":"PD status changes US","deliveryUrl":"https://example.com/hooks/pp","filters":{"fieldPaths":["overallStatus"],"conditions":["Parkinson"],"countries":["United States"]}}}}},"responses":{"201":{"description":"Created. The `secret` field is shown once; use it to verify X-PP-Signature on webhook deliveries (sha256=<hex of HMAC-SHA256(secret, body)>)."},"400":{"description":"Invalid payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"X-API-Key required"},"402":{"$ref":"#/components/responses/PaymentRequired"}}},"get":{"summary":"List subscriptions owned by the calling X-API-Key (free with key).","security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"X-API-Key required"}}}},"/api/agent/v1/subscriptions/{id}":{"delete":{"summary":"Delete a subscription owned by the calling X-API-Key (free with key).","security":[{"apiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Deleted"},"401":{"description":"X-API-Key required"},"404":{"description":"Not found"}}}},"/api/agent/v1/subscriptions/{id}/stream":{"get":{"summary":"Server-Sent Events stream of matching field changes (free with key, alternative to webhook).","security":[{"apiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"text/event-stream of `change` events with each row as JSON. Each event includes the row id."},"401":{"description":"X-API-Key required"}}}},"/api/agent/v1/since":{"get":{"summary":"Field-level change feed. Free tier or $0.005 per call.","parameters":[{"name":"since","in":"query","schema":{"type":"string","format":"date-time"},"example":"2026-05-01T00:00:00Z"},{"name":"cursor","in":"query","schema":{"$ref":"#/components/schemas/Cursor"}},{"name":"field","in":"query","schema":{"type":"string"},"description":"Comma-separated list of field paths to include.","example":"overallStatus,enrollmentInfo.count"},{"name":"condition","in":"query","schema":{"type":"string"}},{"name":"sponsor","in":"query","schema":{"type":"string"}},{"name":"country","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"count":1,"nextCursor":null,"changes":[{"id":8421,"nctId":"NCT04201093","fieldPath":"overallStatus","changeKind":"modified","oldValue":"RECRUITING","newValue":"ACTIVE_NOT_RECRUITING","primaryCondition":"Parkinson's Disease","sponsor":"Example Sponsor Inc","countries":["United States"],"changedAt":"2026-05-07T18:42:11.000Z","brief":"/api/agent/v1/trials/NCT04201093/brief"}]}}}},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"$ref":"#/components/responses/RateLimited"}}}}}}