{
  "name": "ClinicalTrials.gov Studies -> CSV / Google Sheets (Cost-Capped $0.25)",
  "nodes": [
    {
      "id": "55555555-5555-4555-8555-555555555555",
      "name": "Run manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "66666666-6666-4666-8666-666666666666",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -320
      ],
      "parameters": {
        "content": "## Cost-Capped ClinicalTrials.gov Scraper\n- **Cost guard:** `maxTotalChargeUsd=0.25` + `maxItems: 25` ensures max spend $0.25 per run.\n- **Estimated cost per run:** ~$0.08755 (start $0.00005 + 25 × $0.0035).\n- **Retry policy:** `retryOnFail: false` – no automatic retries to avoid unexpected charges.\n- **Auth setup:** Set environment variable `APIFY_TOKEN` in n8n. Never hardcode tokens!\n- **License:** US Government Public Domain (NIH / U.S. National Library of Medicine, zero PII). Commercial use allowed. Keep `attribution` column if redistributing.\n- **Export CSV:** Convert to CSV node is already connected. Alternatively, connect Google Sheets node directly to HTTP Request node's JSON output.\n- **RapidAPI alternative:** https://rapidapi.com/fallRainy/api/clinicaltrials-gov-studies-trials (GET /v1/clinical-trials/studies)\n- **Actor store:** https://apify.com/perceptive_city_af7/clinical-trials-scraper",
        "width": 820,
        "height": 260,
        "color": 4
      }
    },
    {
      "id": "77777777-7777-4777-8777-777777777777",
      "name": "Fetch ClinicalTrials.gov Studies (Apify)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "retryOnFail": false,
      "position": [
        280,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/KchE3qKKrwU0rCe9f/run-sync-get-dataset-items?maxTotalChargeUsd=0.25",
        "authentication": "none",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$env.APIFY_TOKEN}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            },
            {
              "name": "clean",
              "value": "true"
            },
            {
              "name": "timeout",
              "value": "60"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\"condition\":\"type 2 diabetes\",\"status\":\"RECRUITING\",\"queryTerm\":\"GLP-1\",\"maxItems\":25}",
        "options": {
          "timeout": 90000
        }
      }
    },
    {
      "id": "88888888-8888-4888-8888-888888888888",
      "name": "Convert to CSV (Google Sheets Ready)",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        560,
        0
      ],
      "parameters": {
        "operation": "csv",
        "binaryPropertyName": "data",
        "options": {
          "fileName": "clinical-trials-studies.csv",
          "headerRow": true
        }
      }
    }
  ],
  "connections": {
    "Run manually": {
      "main": [
        [
          {
            "node": "Fetch ClinicalTrials.gov Studies (Apify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch ClinicalTrials.gov Studies (Apify)": {
      "main": [
        [
          {
            "node": "Convert to CSV (Google Sheets Ready)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
