cURL icon

cURL

Makes an HTTP request by calling cURL and returns the response

Overview

This custom n8n node allows you to execute HTTP requests using the cURL command-line tool directly from your workflow. It is particularly useful when you need to replicate complex or non-standard HTTP requests that are easier to express with cURL syntax, such as those involving custom headers, cookies, or authentication methods not easily handled by standard HTTP request nodes.

Common scenarios:

  • Testing APIs with specific headers or cookies.
  • Reproducing requests captured from browser developer tools.
  • Interacting with endpoints requiring precise cURL options for authentication or session management.

Practical example:
You can use this node to send a GET request with a custom cookie:

'https://example.com' -H 'Cookie: Yummy=1'

Properties

Name Meaning
Command line Command line arguments to pass to cURL (avoid those that alter visualization of data; only pass URL, method, login, and headers). Example: 'https://example.com' -H 'Cookie: Yummy=1'. This field is required.

Output

The node outputs a JSON object containing the parsed HTTP response:

  • statusCode: The HTTP status code returned by the server (e.g., 200).
  • statusMessage: The HTTP status message (e.g., "OK").
  • headers: An object containing all response headers (header names are lowercased).
  • setCookie (if present):
    • array: Array of individual cookie strings.
    • string: All cookies concatenated as a single string.
    • object: Key-value pairs of cookie names and their attributes.
  • data: The body of the HTTP response as a string.
  • error (only if an error occurred and "Continue On Fail" is enabled): Contains the error message.

Example output:

{
  "statusCode": 200,
  "statusMessage": "OK",
  "headers": {
    "content-type": "application/json",
    "set-cookie": [
      "sessionid=abc123; Path=/; HttpOnly"
    ]
  },
  "setCookie": {
    "array": ["sessionid=abc123"],
    "string": "sessionid=abc123",
    "object": {
      "sessionid": {
        "value": "abc123",
        "path": "/",
        "httponly": true
      }
    }
  },
  "data": "{\"success\":true}"
}

Dependencies

  • External Service: Downloads a precompiled cURL binary from GitHub (https://github.com/n-octo-n/n8n-nodes-curl/raw/static-curl/bin/curl/).
  • Node.js Modules: Uses built-in modules like child_process, fs, stream/promises, and zlib.
  • n8n Configuration: No special configuration required, but the node must have permission to download files and execute binaries in the environment.

Troubleshooting

Common issues:

  • Permission errors: If the node cannot write to the file system or execute the downloaded cURL binary, ensure the n8n process has appropriate permissions.
  • Network errors: If the cURL binary cannot be downloaded (e.g., due to firewall restrictions), the node will fail on first use.
  • Invalid command line: Supplying invalid or unsupported cURL arguments may result in errors or unexpected results.

Error messages:

  • "spawn ... ENOENT": Indicates the cURL binary could not be found or executed. Check file permissions and download success.
  • "Command failed: ...": The cURL command itself failed. Review your command line arguments for correctness.
  • "Cannot read property ... of undefined": Likely caused by malformed responses or unexpected output from cURL.

Resolution steps:

  • Double-check the command line input for typos or unsupported flags.
  • Ensure network access to GitHub for downloading the cURL binary.
  • Verify file system permissions for the n8n process.

Links and References

Discussion