API Block
Connect to any external API with support for all standard HTTP methods and customizable request parameters.
The API block connects to any external REST API with support for all standard HTTP methods and customizable request parameters. Configure headers, query parameters, and request bodies to integrate with any service that does not have a dedicated tool block. Standard headers (User-Agent, Accept, Cache-Control, etc.) are automatically included.
Overview
| Property | Value |
|---|---|
| Type | api |
| Category | blocks |
| Color | #EA580C |
When to Use
- Call any REST API endpoint — internal services, third-party providers, or public data APIs
- Fetch data from a service that has no dedicated Zelaxy tool block
- POST structured JSON payloads to webhooks or custom backends
- Execute PUT, PATCH, or DELETE operations against a resource
- Chain API responses into downstream agent or condition blocks using
{{api_1.data}} - Pass secrets and API keys safely via
{{ENV_VAR_NAME}}references in headers or body
Configuration
URL (required)
A short text input for the full endpoint URL. Supports {{...}} references to other block outputs and environment variables.
Example: https://api.example.com/users/{{starter.userId}}
Method (required)
Dropdown that selects the HTTP verb for the request.
| Label | id |
|---|---|
| GET | GET |
| POST | POST |
| PUT | PUT |
| DELETE | DELETE |
| PATCH | PATCH |
Query Params
A key-value table (columns: Key, Value) of URL query parameters appended to the URL at runtime. Each row becomes ?key=value&... in the final request.
Headers
A key-value table (columns: Key, Value) of custom HTTP headers. Standard headers such as User-Agent, Accept, and Cache-Control are added automatically — you only need to add headers specific to the API (e.g. Authorization: Bearer {{MY_API_KEY}}).
Body
A code editor (JSON mode) for the request body, used with POST, PUT, and PATCH requests. Supports {{blockName.field}} references to other blocks and {{ENV_VAR_NAME}} for environment variables. An AI wand is available to generate the JSON body from a plain-language description.
Example body:
{
"name": "{{agent1.content}}",
"userId": "{{starter.userId}}",
"apiKey": "{{MY_SERVICE_KEY}}"
}Inputs & Outputs
Inputs (subBlock ids that can be set in the workflow editor or passed from other blocks):
url(string) — Request URLmethod(string) — HTTP method (GET, POST, PUT, DELETE, PATCH)headers(json) — Request headers as key-value pairsbody(json) — Request body data (for POST, PUT, PATCH)params(json) — URL query parameters as key-value pairs
Outputs (reference as {{blockId.field}} in downstream blocks):
data(json) — API response data (JSON object, plain text, or other format depending on the Content-Type the server returns)status(number) — HTTP status code returned by the server (e.g. 200, 404, 500)headers(json) — HTTP response headers as key-value pairs
Tools
HTTP Request (http_request) — Makes HTTP requests with comprehensive support for methods, headers, query parameters, path parameters, and form data. Features configurable timeout and status validation. Proxy-aware: external URLs are routed through the Zelaxy proxy endpoint transparently. Response handling auto-detects JSON vs. plain-text content and unwraps Zelaxy proxy response envelopes.
YAML Example
api_1:
type: api
name: "API"
inputs:
url: "https://api.openweathermap.org/data/2.5/weather"
method: "GET"
params:
- key: "q"
value: "{{starter.city}}"
- key: "appid"
value: "{{OPENWEATHER_API_KEY}}"
- key: "units"
value: "metric"
connections:
outgoing:
- target: agent_1After the API block runs, downstream blocks can access:
{{api_1.data}}— the parsed JSON weather payload{{api_1.status}}— e.g.200{{api_1.headers}}— response headers includingcontent-type