Documentation Index Fetch the complete documentation index at: https://docs.servflow.io/llms.txt
Use this file to discover all available pages before exploring further.
The HTTP action allows you to call external APIs, webhooks, and web services from your workflows. Use it to integrate with third-party services, fetch remote data, or trigger external processes.
http
Makes HTTP requests to external APIs and returns the response.
URL
The full URL to send the request to. Supports template variables.
YAML Key urlType string Required Yes
Example values:
https://api.example.com/users
https://api.example.com/users/{{ param "user_id" }}
HTTP Method
The HTTP method to use for the request.
YAML Key methodType string Required Yes
Supported methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
HTTP headers to include with the request as key-value pairs.
YAML Key headersType map Required No
Common headers include Authorization, Content-Type, and Accept.
Body
The request body data. Typically used with POST, PUT, and PATCH requests.
YAML Key bodyType object Required No
The body is automatically serialized to JSON when Content-Type is application/json.
Response Path
A JSONPath expression to extract a specific field from the response. When set, only the extracted value is returned instead of the full response.
YAML Key responsePathType string Required No
Example: access_token extracts just the token from an OAuth response.
Expected Response Code
The expected HTTP status code. If the actual response code differs, the action fails and routes to the fail step.
YAML Key expectedResponseCodeType string Required No
Example: "201" for expecting a created response.
Fail If Response Empty
Whether to treat an empty response body as a failure.
YAML Key failIfResponseEmptyType boolean Required No Default true
Examples
GET Request
Fetch data from an external API:
actions :
get_user_data :
type : http
config :
url : "https://api.example.com/users/{{ param \" user_id \" }}"
method : GET
headers :
Authorization : "Bearer {{ secret \" API_TOKEN \" }}"
Accept : application/json
next : response.success
fail : response.api_error
POST Request
Create a resource on an external service:
actions :
create_resource :
type : http
config :
url : "https://api.example.com/resources"
method : POST
headers :
Authorization : "Bearer {{ secret \" API_TOKEN \" }}"
Content-Type : application/json
body :
name : "{{ param \" name \" }}"
type : "{{ param \" type \" }}"
metadata :
created_by : "{{ .authenticated_user.id }}"
expectedResponseCode : "201"
next : response.created
fail : response.create_failed
Get just the access token from an OAuth token endpoint:
actions :
get_access_token :
type : http
config :
url : "https://auth.example.com/oauth/token"
method : POST
headers :
Content-Type : application/x-www-form-urlencoded
body :
grant_type : client_credentials
client_id : "{{ secret \" CLIENT_ID \" }}"
client_secret : "{{ secret \" CLIENT_SECRET \" }}"
responsePath : "access_token"
next : action.use_token
Webhook Call
Trigger an external webhook with workflow data:
actions :
notify_webhook :
type : http
config :
url : "{{ secret \" WEBHOOK_URL \" }}"
method : POST
headers :
Content-Type : application/json
body :
event : "order.completed"
order_id : "{{ .order.id }}"
total : "{{ .order.total }}"
timestamp : "{{ now }}"
next : response.success
fail : response.webhook_failed
Chaining API Calls
Use the result of one HTTP call in another:
actions :
authenticate :
type : http
config :
url : "https://api.example.com/auth"
method : POST
body :
username : "{{ secret \" API_USER \" }}"
password : "{{ secret \" API_PASS \" }}"
responsePath : "token"
next : action.fetch_data
fetch_data :
type : http
config :
url : "https://api.example.com/data"
method : GET
headers :
Authorization : "Bearer {{ .authenticate }}"
next : response.success
Next Steps
Secrets Management Securely store API keys and tokens for your HTTP requests.
Authentication Secure your own APIs with JWT and authentication actions.
Data Operations Store and retrieve data from databases.
Actions Overview Learn the fundamentals of actions in ServFlow.