ComfyUI Node

Rest Api Node

Every method, retries, status codes, all of it

By ahkimkoo·Created 3 months ago·Updated 3 months ago· 1
Rest Api Node
  • headers
  • RETRY_SETTING
  • text
  • file
  • json
  • headers
  • status_code
  • any
target_urlhttps://example.com/api
request_body{}
methodGET

If you only add one node from this pack, make it this one. The Rest Api Node is the everything node: GET, POST, PUT, DELETE, PATCH, HEAD, and OPTIONS all from one dropdown, with configurable retries and six outputs including the HTTP status code. It's the one you'd reach for when a workflow talks to a real API that has failure modes - polling a job, retrying a flaky service, checking what a server actually returned.

It ships in ComfyUI-HttpRequestNodes, ahkimkoo's fork of felixszeto's ComfyUI-RequestNodes. The fork's whole point is extending the original image-only request nodes to audio and video, but Rest Api Node is the "grown-up" core node that predates the fork and does more than the simple Get Request Node or Post Request Node ever will.

The inputs that matter

  • target_url - the endpoint. Note this one is set to forceInput, so it presents as a socket you can wire from another node, not just a text field.
  • method - the dropdown. Pick anything from GET to OPTIONS.
  • request_body - for POST/PUT/PATCH this is parsed as JSON and becomes the body. For GET, the same field is parsed as a JSON dict and becomes query parameters. For HEAD/OPTIONS/DELETE the node hides the field entirely via HIDE_INPUTS.
  • headers (KEY_VALUE) - merged over the default Content-Type: application/json.
  • RETRY_SETTING - the interesting one, fed by a Retry Settings Node.

Retries, explained

Without a RETRY_SETTING, you get one shot. With one, the logic is: max_retry attempts (default 3) with retry_interval in milliseconds (default 1000), and you can keep going until you hit (or stop hitting) a specific status code via retry_until_status_code / retry_until_not_status_code. If you only set max_retry with no specific condition, it retries on any non-2xx response. Fun detail from the source: set a specific retry condition with max_retry = 0 and it retries forever (Python's maxint as the attempt cap) - handy for long-polling, terrifying if you forget the node is attached. When retries happen, the node tucks a retry_info dict (retry count and conditions) into the JSON output so you can see what happened.

The outputs

Six of them: text, file (bytes), json (parsed, or an error dict), headers (the response headers as a dict - this is where a redirect target or rate-limit info shows up), status_code (the real status, or 0 when the request failed outright), and any. For HEAD requests, json is actually the response headers, which is a neat trick for existence checks. Like the rest of this pack's request nodes, it ignores system proxies.

Install

ComfyUI Manager → search ComfyUI-HttpRequestNodes → Install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/ahkimkoo/ComfyUI-HttpRequestNodes
pip install soundfile imageio imageio-ffmpeg

Node appears under RequestNode/REST API. No models, no keys, no heavy dependencies - just the requests library that ComfyUI already ships. The pack's example workflow rest_node.json shows the intended setup: a few Key/Value nodes for headers, a couple of Retry Settings nodes, and this node in the middle.

CategoryRequestNode/REST API

Inputs (5)

NameTypeDefaultDescription
target_urlSTRINGhttps://example.com/api
request_bodySTRING{}
methodCOMBOGET7 options: GET, POST, PUT, DELETE, PATCH, HEAD, +1
headersoptKEY_VALUE
RETRY_SETTINGoptRETRY_SETTING

Outputs (6)

NameTypeDescription
textSTRING
fileBYTES
jsonJSON
headersDICT
status_codeINT
anyANY