AutomationFlowsWeb Scraping › Claude API - Structured Output

Claude API - Structured Output

Claude API - Structured Output. Uses httpRequest. Webhook trigger; 10 nodes.

Webhook trigger★★★★☆ complexity10 nodesHTTP Request
Web Scraping Trigger: Webhook Nodes: 10 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Claude API - Structured Output",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "claude-structured-output",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "01-webhook-trigger",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -900,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const body = $json.body || $json;\nconst text = String(body.text || '').trim();\nif (!text) {\n  return [{ json: { ok: false, error: 'Missing required field: text', statusCode: 400 } }];\n}\nreturn [{ json: { ok: true, text, source: body.source || 'webhook', request_id: body.request_id || $execution.id } }];"
      },
      "id": "01-normalize-input",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -680,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json.ok}}",
              "value2": true
            }
          ]
        }
      },
      "id": "01-input-valid",
      "name": "Input Valid?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        -460,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "return [{ json: { request_id: $json.request_id, source: $json.source, payload: { model: 'claude-placeholder-model', max_tokens: 700, messages: [{ role: 'user', content: `Return only valid JSON with fields title, priority, category, summary, action_items. Text: ${$json.text}` }] } } }];"
      },
      "id": "01-build-claude-request",
      "name": "Build Claude Request",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -220,
        -120
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.example.com/endpoint",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{$json.payload}}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "01-http-request-to-claude-api",
      "name": "HTTP Request to Claude API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        20,
        -120
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "const content = $json.content?.[0]?.text || $json.message || $json.response || JSON.stringify($json);\nlet parsed;\ntry {\n  parsed = typeof content === 'string' ? JSON.parse(content) : content;\n} catch (error) {\n  return [{ json: { ok: false, error: 'Claude response was not valid JSON', raw: content, statusCode: 502 } }];\n}\nreturn [{ json: { ok: true, data: parsed } }];"
      },
      "id": "01-parse-json-response",
      "name": "Parse JSON Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        260,
        -120
      ]
    },
    {
      "parameters": {
        "jsCode": "const required = ['title', 'priority', 'category', 'summary', 'action_items'];\nconst data = $json.data || {};\nconst missing = required.filter((field) => data[field] === undefined || data[field] === null || data[field] === '');\nif (missing.length) {\n  return [{ json: { ok: false, error: `Missing required fields: ${missing.join(', ')}`, data, statusCode: 422 } }];\n}\nreturn [{ json: { ok: true, structured_output: data } }];"
      },
      "id": "01-validate-required-fields",
      "name": "Validate Required Fields",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        500,
        -120
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json.ok}}",
              "value2": true
            }
          ]
        }
      },
      "id": "01-output-valid",
      "name": "Output Valid?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        720,
        -120
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{$json.structured_output}}",
        "options": {
          "responseCode": 200
        }
      },
      "id": "01-respond-success",
      "name": "Respond Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        960,
        -220
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { ok: false, error: $json.error, details: $json.data || $json.raw || null } }}",
        "options": {
          "responseCode": "={{$json.statusCode || 500}}"
        }
      },
      "id": "01-respond-error",
      "name": "Respond Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        960,
        80
      ]
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Input Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input Valid?": {
      "main": [
        [
          {
            "node": "Build Claude Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Claude Request": {
      "main": [
        [
          {
            "node": "HTTP Request to Claude API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request to Claude API": {
      "main": [
        [
          {
            "node": "Parse JSON Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse JSON Response": {
      "main": [
        [
          {
            "node": "Validate Required Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Required Fields": {
      "main": [
        [
          {
            "node": "Output Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Valid?": {
      "main": [
        [
          {
            "node": "Respond Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true
  },
  "versionId": "placeholder-01"
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Claude API - Structured Output. Uses httpRequest. Webhook trigger; 10 nodes.

Source: https://github.com/gharisj3/n8n-workflow-library/blob/main/workflows/01-claude-structured-output/workflow.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di

n8n, Execute Workflow Trigger, HTTP Request +1
Web Scraping

This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .

HTTP Request, Ssh
Web Scraping

eek-Go v2 (Batch-Then-Review). Uses httpRequest. Webhook trigger; 75 nodes.

HTTP Request
Web Scraping

This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia

HTTP Request
Web Scraping

This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c

HTTP Request