# API workflow nodes

> Exchange data with external systems over OSC and HTTP. Listen for OSC messages, serve REST endpoints, and send or poll HTTP requests.

Use these nodes to exchange data with external systems. Listener and server nodes open network ports, so configure authentication and exposure deliberately.

## Choose a node

- [OSC Listener](#osc-listener): listen for open sound control (osc) messages on a udp port
- [REST Server](#rest-server): expose selected workflow values and triggers as http endpoints
- [HTTP Request](#http-request): send one http request when another node triggers it
- [HTTP Query](#http-query): fetch and refresh data from an http endpoint

## OSC Listener

Listen for Open Sound Control (OSC) messages on a UDP port.

### What you see in the editor

![The OSC Listener node card, headed OSC Server, listening on port 9000 with one path, /scene/:name; after a /scene/main message with the argument go, its :name output shows main and its Arg 1 output shows go](https://bitfocus.io/api/docs-media/file/osc-listener.png?prefix=docs-media)

- The card header reads **OSC Server**, even though this node is listed and referred to elsewhere as **OSC Listener**.
- Set **Port**: accepted values are 1024–65535; a lower value shows a **Too small: expected number to be >=1024** error and the node won't start. Then use **Add Path** to add each OSC path the workflow should accept. Each path's editor popover reminds you of the supported syntax: `:param` for a single named segment, `*` to match one segment, and `**` to match many.
- For a path such as `/scene/:name`, the node creates an event for that path and makes each `:name`-style segment available as its own output. Only `:param` segments produce an output: `*` and `**` wildcards match but don't expose a value.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Output events | One per configured path | Fires when an incoming OSC address matches that path. |
| Outputs | One per `:param` in the path | The latest value received for that named segment. |
| Output | **Arg 1** | The first OSC argument from the matched message, regardless of how many arguments it carried. |

### Example

Add `/scene/:name`, send `/scene/main` from a test client, and use the resulting event and `name` value downstream.

## REST Server

Expose selected workflow values and triggers as HTTP endpoints.

### What you see in the editor

![The REST Server node card with Port, Rate Limit, and Bearer Tokens settings above a list of GET and POST endpoints and an Add Endpoint control](https://bitfocus.io/api/docs-media/file/rest-server.png?prefix=docs-media)

- Set **Port**: accepted values are 1024–65535. **Rate Limit** is a preset dropdown (**10 reqs / min**, **100 reqs / min**, **1000 reqs / min**, or **Off**), not a custom number. Add one or more **Bearer Tokens** to require that token on every endpoint (GET and POST alike; there's no per-endpoint auth control). Configure both before exposing the server to another system.
- Use **Add Endpoint** to enter a **Path** and choose **GET** or **POST**. A GET endpoint returns its connected value. A POST endpoint updates its output and fires an event.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | One per GET endpoint | The value returned by that endpoint. |
| Output | One per POST endpoint | The latest request body. |
| Output event | One per POST endpoint | Fires when a request reaches that endpoint. |

### Example

Create an authenticated GET `/status` endpoint for a non-sensitive workflow value and test it from the intended network.

See [Expose a small authenticated REST endpoint from a workflow](/docs/buttons/v1.10/workflows/recipes/rest-server) for a full walkthrough, including bearer-token rotation and restart behavior.

## HTTP Request

Send one HTTP request when another node triggers it.

### What you see in the editor

![The HTTP Request node card with URL, Method, Content Type, Timeout (ms) and Authentication fields, Request Object, Trigger, URL, Method, Headers and Body inputs on the left, and onSuccess, onError, Body, Full Response, Error and Status Code outputs on the right](https://bitfocus.io/api/docs-media/file/http-request.png?prefix=docs-media)

- Enter **URL**. Choose **Method** from **GET**, **POST**, **PUT**, **PATCH**, **DELETE**, **HEAD**, or **OPTIONS**, and **Content Type** from **JSON**, **JSON (UTF-8)**, **Form URL Encoded**, **Octet Stream**, or **Text**: both are dropdowns, not free text. Set **Timeout (ms)** from 0 to 300000 (default 30000).
- Under **Authentication**, choose **None**, **Bearer Token**, or **Basic Auth**. Select stored Secrets for tokens and passwords rather than typing credentials into the workflow.
- Use this node for one-shot requests. Use **HTTP Query** for automatic polling.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input event | **Trigger** | Sends a request using the values configured on the card. |
| Input event | **Request Object** | Sends a request with event-provided overrides. |
| Inputs | **URL**, **Method**, **Headers**, **Body** | Override or supply request values. |
| Output events | **onSuccess**, **onError** | Continue according to the result. |
| Outputs | **Body**, **Full Response**, **Error**, **Status Code** | Inspect the latest response. |

### Example

Connect a **Button** to **Trigger**, make a harmless read request, and display **Status Code** while testing.

See [Call an HTTP endpoint from a workflow](/docs/buttons/v1.10/workflows/recipes/http-request) for a full walkthrough, including timeout and error-handling behavior.

## HTTP Query

Fetch and refresh data from an HTTP endpoint.

### What you see in the editor

![The HTTP Query node card after a successful fetch, with a success and 200 status panel, Refetch and Retry buttons and the last response, then Method, Timeout, Content Type, Authentication, retry, Refetch Interval and Cache Mode settings, its Enabled, Invalidate, URL, Headers, Params and Body inputs, and its event and state outputs](https://bitfocus.io/api/docs-media/file/http-query.png?prefix=docs-media)

- Enter **URL**. Choose **Method** from **GET**, **POST**, **PUT**, **PATCH**, **DELETE**, or **HEAD** (no **OPTIONS** here, unlike **HTTP Request**), **Content Type** from the same five options as HTTP Request, **Timeout (ms)** from 1000–300000 (default 30000), and **Authentication**.
- Choose a **Retry Strategy**: **Exponential Backoff** (capped by **Max Backoff (ms)**, 1000–600000, default 60000) or **Fixed Interval** (**Retry Interval (ms)**, 500–60000, default 5000). Toggle **Infinite Retries**, or set **Max Retries** (0–100, default 3). Only failed requests with a 5xx status or a timeout are retried; a 4xx response is not.
- **Refetch Interval** is a switch that's **on by default**: with it on the node polls automatically every **Interval (ms)** (1000–3,600,000, default 10000) even if you never touch this section. Turn it off for a query that should only run once or on demand.
- Set **Cache Mode**: **Never Cache**, **Cache Until Retry Fails** (default), or **Cache Until Success**, and optionally enable **Expire Cache After Timeout** with an **Expire After (ms)** value (1000–86,400,000).
- The status panel shows the current state, status code, error, and a preview of the last response. Use **Refetch** to fetch now. **Retry** becomes available after an error.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | **Enabled** | Stops all fetching when false. |
| Input event | **Invalidate** | Starts an immediate fetch. |
| Inputs | **URL**, **Headers**, **Params**, **Body** | Supply request values. |
| Output events | **onSuccess**, **onError**, **onSettled** | Respond when a request completes. |
| Outputs | **Status**, **Data**, **Error**, **isLoading**, **isError**, **isSuccess**, **Status Code** | Use the latest query state and response. |

### Example

Poll a read-only status endpoint and connect **isSuccess** and **Data** to the workflow’s display logic.
