API Request Node
Pull data from a REST API straight into your ComfyUI graph
- API_RESPONSE
- LENGTH
- API_KEY
Most ComfyUI custom nodes exist to make pixels better. This one doesn't touch a single pixel - it goes and fetches data. If you've ever wanted a workflow to pull records from some external system (a product catalog, a CMS, whatever spits out JSON) and use that data to drive generation, APIRequestNode is the node that goes and gets it. It's part of a tiny three-node pack called ComfyUI_API_Manager, built by a dev who wanted exactly this for his own project and shared it before it was really polished for anyone else's - worth knowing going in, so read the field names carefully and test against your actual API rather than assuming it'll just work.
How it works
The node does two jobs, chained together. First it authenticates: it POSTs auth_body_text to auth_url, then pulls the access token out of that response using whatever field name you give it in token_attribute_name - that becomes the API_KEY output, ready to hand to another node (the pack's PostImageToAPI, for instance, which needs exactly that). Then it hits your real data endpoint at api_url and walks into the JSON response using array_path, a dotted path for drilling into nested objects - handy when the array you actually want is buried a few levels down instead of sitting at the root.
Because the API_RESPONSE output is a single JSON object rather than a list, iteration_index picks which item of the array at array_path you want on this particular run. LENGTH tells you how many items are in that array in total - the number you'd feed a loop or batch count with if you're planning to work through the whole thing instead of pulling one record at a time.
The inputs and outputs that matter
You set five things: auth_url and auth_body_text (how to log in), token_attribute_name (where the token lives in that response), api_url and array_path (where the real data is and how to find it). iteration_index starts at 0 and you bump it as you iterate.
Three outputs come back: API_RESPONSE (the JSON object at your chosen index - wire this into TextPromptCombinerNode's api_response input), LENGTH (item count of the array), and API_KEY (the token, ready to pass to any node in the pack that needs auth).
How to install it
Through ComfyUI Manager: search "ComfyUI_API_Manager" and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/CC-BryanOttho/ComfyUI_API_Manager.git
then restart ComfyUI. No pip installs, no model downloads - the README is explicit that there are no external dependencies. One thing to watch: the README's own clone command is git clone <url> custom_nodes, which - pasted literally from your ComfyUI root - tries to clone into a directory named custom_nodes instead of making a subfolder inside the one you already have. Since that folder already exists and isn't empty, git just refuses. cd into custom_nodes first and drop the trailing argument, like above.
Common issues & troubleshooting
Nothing comes back, or you get an auth error. Nine times out of ten this is auth_body_text not matching what your API actually expects - it's a raw text field, so if your API wants specific JSON key names or a particular content type, you have to type that out exactly.
array_path finds nothing. The path has to match your API's real response shape, not what you assume it is. Dump the raw response once with curl or Postman before wiring the node up blind.
iteration_index throws or comes back empty. It doesn't clamp to your array's length - if LENGTH says 12 and the index is still sitting at 50 from a previous test, you'll get nothing. Reset it after switching endpoints.
Since this pack is arbitrary Python hitting arbitrary URLs with whatever credentials you type into it, treat auth_body_text and any tokens the same way you'd treat a .env file - don't leave them sitting in a workflow JSON you share publicly.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| api_url | STRING | — | |
| auth_url | STRING | — | |
| token_attribute_name | STRING | — | |
| auth_body_text | STRING | — | |
| array_path | STRING | — | |
| iteration_index | INT | 00–9999 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| API_RESPONSE | JSON | — |
| LENGTH | INT | — |
| API_KEY | STRING | — |