This document defines the planned HTTP request node for Workflow APIs. The node is intended for provider integrations such as SMS, email, payment, OAuth token exchange, CRM sync, and internal service calls.
Ye plan external API call ke liye hai. HTTP node useful hoga, lekin unrestricted URL call allow nahi hogi.
Allow a workflow to call a configured external HTTP endpoint safely and return selected response data to later nodes.
Example use cases:
- Send OTP by SMS.
- Send transactional email.
- Create a payment intent.
- Verify OAuth token or exchange code.
- Notify an internal service.
- Sync order status to another system.
- No arbitrary JavaScript execution.
- No unrestricted private-network calls.
- No long-running polling.
- No streaming response support in MVP.
- No raw secret values in workflow JSON.
- No full provider SDK execution inside the workflow runtime.
Planned workflow JSON:
{
"id": "send-otp-sms",
"type": "httpRequest",
"config": {
"method": "POST",
"url": "https://api.provider.example/messages",
"headers": {
"authorization": "Bearer secret:sms.apiKey",
"content-type": "application/json"
},
"query": {
"version": "v1"
},
"body": {
"to": "{{body.phone}}",
"message": "Your OTP is {{runtime.otp}}"
},
"timeoutMs": 5000,
"retry": {
"attempts": 2,
"backoffMs": 300
},
"successStatus": [200, 201, 202],
"outputKey": "smsResult",
"responseBodyMode": "json"
}
}Output available to later nodes:
{
"steps": {
"send-otp-sms": {
"status": 202,
"headers": {
"content-type": "application/json"
},
"body": {
"id": "msg_123"
}
}
},
"smsResult": {
"id": "msg_123"
}
}MVP should allow:
GET
POST
PUT
PATCH
DELETERules:
- Method is required.
- Method must be uppercase after normalization.
GETandDELETEshould ignore body unless explicitly allowed later.HEAD,OPTIONS, and streaming methods are out of scope for MVP.
The node must not call unrestricted URLs. Without a safety model, this becomes SSRF-prone.
Required controls:
- URL must be absolute
https://by default. http://should be denied unless an explicit development setting allows it.- Hostname must match an allowlist.
- Private IP ranges must be blocked after DNS resolution.
- Loopback, link-local, multicast, and metadata service IPs must be blocked.
- Redirects must be disabled by default or revalidated against the same allowlist.
- URL templates may replace path/query values, but not the host unless host is separately allowlisted.
Blocked targets:
127.0.0.1
localhost
0.0.0.0
::1
169.254.169.254
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
fc00::/7
fe80::/10Admin UI should later manage allowed hosts:
api.twilio.com
api.sendgrid.com
api.stripe.com
oauth2.googleapis.com
hooks.slack.comHinglish: admin ko pehle provider host allow karna hoga. Workflow author sirf allowed host par HTTP call bana payega.
Allowed:
https://api.example.com/orders/{{body.orderId}}
https://api.example.com/search?q={{query.q}}Not allowed in MVP:
{{body.url}}
https://{{body.host}}/ordersReason: user-controlled host templates can bypass SSRF protection.
Headers support static values, templates, and secret references.
Example:
{
"authorization": "Bearer secret:stripe.secretKey",
"idempotency-key": "{{request.id}}",
"content-type": "application/json"
}Rules:
- Header names must be lowercase normalized in stored config.
- Block hop-by-hop headers such as
connection,transfer-encoding,upgrade,proxy-authorization. - Redact sensitive headers in logs/history.
- Secrets must use the secret reference plan from
docs/workflow-secret-store-plan.md. - Resolved secret values must never be stored in workflow JSON or history.
Query and body values can use the existing safe workflow expression syntax.
Allowed sources:
body.*
query.*
params.*
entry.*
steps.*
runtime.*
settings.*Rules:
- Templates must be evaluated before sending the request.
- Missing required template values should fail with
HTTP_TEMPLATE_VALUE_MISSING. - Large body output should be size-limited.
- Binary uploads are out of scope for MVP.
Default:
timeoutMs: 5000Allowed range:
1000 <= timeoutMs <= 15000Behavior:
- Timeout applies to the full request.
- Timeout returns
HTTP_REQUEST_TIMEOUT. - Timed-out request is recorded as failed with redacted config.
- Workflow runtime limit still caps the total execution time.
Retry should be explicit and bounded.
Config:
{
"retry": {
"attempts": 2,
"backoffMs": 300
}
}Rules:
attemptsmeans additional tries after the first call.- Maximum retry attempts:
2in MVP. - Maximum backoff:
2000ms. - Retry only network errors, timeouts, and
429/5xxby default. - Do not retry
400/401/403/404by default. - Retrying non-idempotent calls should require idempotency key guidance in docs.
Config:
{
"successStatus": [200, 201, 202],
"responseBodyMode": "json",
"outputKey": "paymentResult"
}Supported response body modes:
json
text
noneRules:
jsonparses JSON and fails withHTTP_RESPONSE_JSON_INVALIDwhen parsing fails.textstores a size-limited string preview.nonestores only status and selected headers.- Response body stored in history must be redacted and size-limited.
- Default max stored body size:
16KB. - Provider response headers should be filtered to safe headers only.
Planned error codes:
HTTP_URL_NOT_ALLOWED
HTTP_PRIVATE_NETWORK_BLOCKED
HTTP_REDIRECT_NOT_ALLOWED
HTTP_TEMPLATE_VALUE_MISSING
HTTP_SECRET_NOT_FOUND
HTTP_REQUEST_TIMEOUT
HTTP_REQUEST_FAILED
HTTP_STATUS_NOT_ALLOWED
HTTP_RESPONSE_TOO_LARGE
HTTP_RESPONSE_JSON_INVALID
HTTP_RETRY_LIMIT_REACHEDError response shape:
{
"ok": false,
"code": "HTTP_STATUS_NOT_ALLOWED",
"message": "HTTP request returned status 401, which is not in successStatus.",
"nodeId": "create-payment-intent"
}Do not include request secrets or full provider response bodies in errors.
HTTP node form should include:
- Method selector.
- Allowed host URL input.
- Header key/value editor.
- Query key/value editor.
- Body JSON/template editor.
- Timeout field.
- Retry attempts/backoff fields.
- Success status multi-select.
- Output key input.
- Response mode selector.
- Secret reference picker.
- Test run panel with redacted preview.
Validation messages should explain whether the problem is URL safety, template syntax, missing secret reference, or response handling.
Workflow OpenAPI output should document that the route may call external providers, but it must not expose provider secrets.
Example extension:
{
"x-apiagex-workflow-nodes": [
{
"id": "send-otp-sms",
"type": "httpRequest",
"method": "POST",
"host": "api.provider.example",
"usesSecrets": ["secret:sms.apiKey"]
}
]
}usesSecrets is optional and should show references only, not values.
Minimum tests before implementation:
- Reject non-allowed hosts.
- Reject private IP and metadata service URLs after DNS resolution.
- Reject host templates.
- Allow path/query templates.
- Resolve secret references at call time.
- Redact authorization headers from run history.
- Enforce timeout.
- Retry only allowed failures.
- Fail on unexpected status.
- Parse JSON response.
- Size-limit response body.
- Browser test validates HTTP node form and redacted test output.
- Add config validator.
- Add URL allowlist and private-network guard.
- Add HTTP client wrapper with timeout and redirect policy.
- Add template rendering for URL path/query, headers, and body.
- Add secret resolver integration from the secret store plan.
- Add redaction on request/response history.
- Add executor node.
- Add Admin UI form fields.
- Add OpenAPI output.
- Add mocked provider tests and browser test.
Do not implement provider calls before URL safety and secret redaction are in place.
The first implementation supports the httpRequest workflow node with:
method,url,headers,query,body,timeoutMs,retry,successStatus,responseBodyMode, andoutputKey.- Host allowlisting from
APIAGEX_WORKFLOW_HTTP_ALLOWED_HOSTS. - HTTPS-only URLs by default.
- Private-network and metadata-address blocking after DNS resolution.
- Redirect blocking.
- Env-backed secret references such as
secret:provider.apiKey, resolved fromAPIAGEX_SECRET_PROVIDER_APIKEY. - Redaction of resolved secrets and sensitive response keys before saving step output.
- Mockable fetch and hostname resolver for provider tests.
Database-backed encrypted secrets and Admin UI secret management remain planned in docs/workflow-secret-store-plan.md.