HTTP Request

Makes outbound HTTP requests. URL, headers, and payload support templating.

Configuration

- http_request:
    name: call_api
    endpoint: "https://api.example.com/orders/{{event.data.id}}"
    method: GET
    credentials_path: /etc/http/api-credentials.json

Fields

FieldTypeDefaultDescription
namestringrequiredTask name.
endpointstringrequiredTarget URL. Supports templating.
methodstringGETGET, POST, PUT, DELETE, PATCH, HEAD.
credentials_pathstringPath to credentials file for request authentication.
payloadobjectRequest body (see below).
headersmapHTTP headers. Values support templating.
timeoutduration30sTotal request timeout from start to response body received. Set explicitly to override or omit-with-null to disable.
connect_timeoutduration10sTCP/TLS connect timeout.
depends_onlistUpstream task names.
retryobjectRetry configuration.

Payload options

FieldTypeDescription
objectmapJSON payload with explicit fields. Supports templating.
inputstringRaw JSON string.
from_eventboolUse incoming event data as the request body.
send_asstringEncoding: json (default), urlencoded, queryparams.

What send_as controls

ValueWhere the payload goesContent-Type set by client
json (default)Request bodyapplication/json
urlencodedRequest bodyapplication/x-www-form-urlencoded
queryparamsURL query string (?a=1&b=2)not set; no body sent

send_as is the only knob that changes how the payload is serialized. Setting Content-Type in headers does not change serialization — it just overrides the header value the client would otherwise send. Other content types (XML, multipart form-data, raw binary) are not currently supported.

urlencoded and queryparams require flat scalar payloads

urlencoded and queryparams go through serde_urlencoded, which only encodes flat objects of scalar values (strings, numbers, booleans). Nested objects or arrays produce a request build error.

For nested data, either:

  • use send_as: json (POST body), or
  • flatten the payload in a script task before this one and choose a per-API key convention (bracket notation, dotted keys, comma-separated, etc.).

Examples

POST with payload:

- http_request:
    name: create_order
    endpoint: "https://api.example.com/orders"
    method: POST
    credentials_path: /etc/http/credentials.json
    payload:
      object:
        customer_id: "{{event.data.customer_id}}"
        amount: "{{event.data.total}}"

Forward event data:

- http_request:
    name: forward
    endpoint: "https://api.example.com/ingest"
    method: POST
    credentials_path: /etc/http/credentials.json
    payload:
      from_event: true

GET with query parameters:

- http_request:
    name: search_orders
    endpoint: "https://api.example.com/orders"
    method: GET
    credentials_path: /etc/http/credentials.json
    payload:
      send_as: queryparams
      object:
        status: "open"
        customer_id: "{{event.data.customer_id}}"
        limit: 50

Resolves to GET https://api.example.com/orders?status=open&customer_id=…&limit=50.

Form-urlencoded body (typical for OAuth token endpoints):

- http_request:
    name: exchange_code
    endpoint: "https://login.example.com/oauth/token"
    method: POST
    payload:
      send_as: urlencoded
      object:
        grant_type: "authorization_code"
        code: "{{event.data.code}}"
        client_id: "{{env.OAUTH_CLIENT_ID}}"

Response handling

Response bodies are decoded into the next event’s event.data after the HTTP client applies a few transparent transforms:

  • Compression: Content-Encoding: gzip, br (Brotli), and deflate responses are decompressed automatically. The Accept-Encoding request header is set on every outbound call.
  • Character encoding: when Content-Type declares a charset (text/html; charset=windows-1250, iso-8859-2, etc.), the body is decoded to UTF-8 before parsing. No special configuration needed.

If the server returns 4xx/5xx, the task fails with the status code and body. 4xx (other than 429) is permanent and skips retries; 429, 5xx, and network errors are retriable per the task’s retry config.