{
  "openapi": "3.1.0",
  "info": {
    "title": "ToolMint ClinicalTrials.gov JSON",
    "version": "0.1.0",
    "description": "ClinicalTrials.gov studies as flat JSON for AI agents. Pay per call with USDC on Base via x402. Not an official NLM/NIH product; not medical advice.",
    "x-guidance": "GET /trials with at least one of condition, intervention, term, location, sponsor or lat+lon; optional status, phase (comma lists), radiusMi, pageSize (1-50), pageToken. GET /trials/{nctId} for one study. Unpaid calls receive HTTP 402 (USDC on Base). Bad params 400 and unknown NCT 404 are not charged. Zero results is a valid 200. Free: /, /health, /openapi.json, /.well-known/x402.",
    "contact": {
      "email": "toolmint.dev@gmail.com",
      "name": "ToolMint"
    }
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Liveness",
        "security": [],
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/trials": {
      "get": {
        "operationId": "clinicaltrials_search",
        "summary": "Search ClinicalTrials.gov studies",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "network": "eip155:8453",
          "payTo": "0xfbF7413bcB3a604936775C96FDbe0b0C9c9E37F5",
          "asset": "USDC",
          "scheme": "exact",
          "amountAtomic": "10000"
        },
        "parameters": [
          {
            "name": "condition",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "intervention",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "term",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "sponsor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "ACTIVE_NOT_RECRUITING,COMPLETED,ENROLLING_BY_INVITATION,NOT_YET_RECRUITING,RECRUITING,SUSPENDED,TERMINATED,WITHDRAWN,AVAILABLE,NO_LONGER_AVAILABLE,TEMPORARILY_NOT_AVAILABLE,APPROVED_FOR_MARKETING,WITHHELD,UNKNOWN"
            }
          },
          {
            "name": "phase",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "EARLY_PHASE1,PHASE1,PHASE2,PHASE3,PHASE4,NA"
            }
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "radiusMi",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            }
          },
          {
            "name": "pageToken",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Flat study JSON with provenance + attribution"
          },
          "400": {
            "description": "Bad parameters (not charged)"
          },
          "402": {
            "description": "Payment Required"
          },
          "502": {
            "description": "Upstream ClinicalTrials.gov error (not charged)"
          }
        }
      }
    },
    "/trials/{nctId}": {
      "get": {
        "operationId": "clinicaltrials_study",
        "summary": "One study by NCT number",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "network": "eip155:8453",
          "payTo": "0xfbF7413bcB3a604936775C96FDbe0b0C9c9E37F5",
          "asset": "USDC",
          "scheme": "exact",
          "amountAtomic": "10000"
        },
        "parameters": [
          {
            "name": "nctId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^NCT\\d{8}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Flat study JSON with provenance + attribution"
          },
          "400": {
            "description": "Bad parameters (not charged)"
          },
          "402": {
            "description": "Payment Required"
          },
          "404": {
            "description": "NCT number not on ClinicalTrials.gov (not charged)"
          },
          "502": {
            "description": "Upstream ClinicalTrials.gov error (not charged)"
          }
        }
      }
    }
  }
}