API
The API block makes an HTTP request to a URL and returns the response. Use it to call any REST API: fetch data, create a record, or trigger an external endpoint.
Configuration
URL
The endpoint to call. Type a static URL, or insert a connection tag to build it from an earlier output, like https://api.example.com/users/<start.userId>.
Method
The HTTP method: GET, POST, PUT, DELETE, or PATCH. Defaults to GET.
Query Params
Key-value pairs appended to the URL as a query string. apiKey and limit become ?apiKey=…&limit=10.
Headers
Key-value request headers, such as Content-Type: application/json or Authorization: Bearer <secret>. Standard headers like User-Agent and Accept are added automatically, and your values override them.
Body
The request payload for POST, PUT, and PATCH, sent as JSON. Type it directly, or pull it from an earlier output with a connection tag.
Advanced
- Timeout (ms). How long to wait before giving up. Defaults to 300000 (5 minutes), up to 600000 (10 minutes).
- Retries. Number of retry attempts on timeouts,
429responses, and5xxerrors. Defaults to 0. - Retry delay / Max retry delay (ms). The exponential-backoff bounds used between retries.
- Retry non-idempotent methods. Off by default, so POST and PATCH are not retried, which avoids duplicate writes. Turn it on only when a repeated request is safe.
Outputs
After the request completes, later blocks read its result by name:
| Output | What it is |
|---|---|
<api.data> | The response body, parsed as an object for JSON or returned as text otherwise |
<api.status> | The HTTP status code, like 200 or 404 |
<api.headers> | The response headers, as an object |
Branch on the result by reading <api.status> in a Condition block.
Example
A workflow that calls an HTTP endpoint and summarizes the response:
The API block builds its URL from the Start input, fetches the data, and the Agent reads the response as <api.data>.
Best Practices
- Keep secrets in environment variables. Reference them with
{{VAR}}in the URL or headers; never hardcode keys. - Handle failures. Read
<api.status>and branch on it with a Condition, or connect the error path for network failures and timeouts. - Set retries for flaky endpoints. Use the Advanced retry settings for idempotent calls. Leave POST and PATCH off unless a repeated request is safe.
- Reference only the field you need. Pull
<api.data.id>rather than the whole<api.data>when the response is large.