> ## Documentation Index
> Fetch the complete documentation index at: https://docs.noxus.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# APIs & Code

> HTTP requests, custom scripts, and secrets

The **APIs & Code** nodes call other systems and run your own Python. This flow fetches an order and totals its items. Press **Run** to watch it.

Node
Output in this run

| Node | What it does |
| - | - |
| **Make API Request** | Call an HTTP endpoint and read its response. |
| **Make Download Request** | Download a file from a URL. |
| **Make APIM Request** | Call an API behind Azure API Management. |
| **Run Code** | Run a Python function on values from the flow. |

## Make API Request

Pick the **Request Method** (GET, POST, PUT, DELETE or PATCH) and enter the **URL**. Variables can go anywhere in the URL.

| Setting | What it does |
| - | - |
| **Body** and **Body Type** | What to send, as JSON, XML or Plain Text. |
| **File**, **File Upload Mode** and **File Field Name** | Send a file, as Multipart Form-Data under the field name, or as a Binary Body. |
| **Headers** and **Cookies** | Sent with the request, for example an `Authorization` header with your API key. |
| **Verify SSL Certificates** | Checks the server's certificate. On by default. |
| **Use a proxy to fetch the request** | Sends the request through a proxy. |
| **Whitelisted Private Domains** | Private addresses the request may reach. Others are blocked. |
| **Fail on non-2xx status codes** | Stops the step when the server answers with an error. Turn it off to branch on **Status Code** instead. |

**Outputs:**

* **Body:** an object when the response is JSON, so later steps read its fields without parsing. A JSON list comes as an object with an `items` list, and a response that isn't JSON stays text.
* **Status Code:** a number, such as `200` or `404`.
* **Headers:** the response headers, as an object.

Node
Output in this run

## Make Download Request

Downloads the file at **URL** and gives it as its **Output**, a file ready for the Files & Documents nodes. It takes the same method, body, headers and SSL settings as Make API Request, plus a **File name** and, with a proxy, a **Proxy Country**.

Node
Output in this run

## Make APIM Request

Calls an API behind an Azure API Management gateway, signed in with a connected Azure APIM credential: a service principal token or a subscription key. Set the method and URL as in Make API Request. It gives **Body**, **Status Code** as a number, and **Headers**.

Node
Output in this run

## Run Code

Runs a Python function named `main`. It gets the **Input variables** as a dict and returns a dict:

```python theme={null}
def main(inputs):
    total = sum(item["price"] for item in inputs["order"]["items"])
    return {"total": total}
```

* **Input variables:** each one is a key of `inputs`, bound to a value from an earlier step. Files arrive as path-like file objects.
* **Output variables:** list each key `main` returns, with its type. Each becomes an output of the node.
* **Packages:** pip packages to install first, one per entry. Installing packages adds at least 5 seconds to the run.
* **Timeout:** set it on the step's **Error Handling** tab. Left empty or 0, the run stops after 120 seconds.
* **Execution slots:** the CPU and memory the run gets, from 1 to 8. One slot is 1/8 of a CPU core and 256 MB.
* **Return stdout** and **Return stderr:** add what the code printed as outputs. **Clean output** strips terminal colour codes from them.

The **Code** field highlights Python and numbers its lines. As you type, a syntax error is underlined on its line, with a hint on hover. When the code fails, the step's error shows the message Python raised and ends with the line it failed on, such as "(line 4)", and in the editor that line stays underlined until you edit the code.

Node
Output in this run

## Next Steps

* See every node group in [Nodes](https://docs.noxus.ai/platform/flows/nodes)
* Work with downloaded files in [Files & Documents](https://docs.noxus.ai/platform/flows/files-documents.md)
* Reshape responses in [Data Operations](https://docs.noxus.ai/platform/flows/data-operations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.