Transform Pipelines
Modify requests and responses at the gateway level without touching your backend code. Pipelines execute ordered actions with conditional logic and graceful error handling.
Overview
Each route can have a request pipeline and a response pipeline. Pipelines are arrays of actions executed in order. Each action has a name, optional targets, and optional conditions.
Pipelines are compiled on first use and cached in an LRU cache (10,000 entries, 5-minute TTL) for fast repeated execution.
Request Actions (10)
request.jwtClaimToHeaderExtract a JWT claim and inject it as a request header. Supports dot notation for nested claims (e.g., "user.role").
request.setHeaderSet or override a request header. Supports static values and context variables.
request.removeHeaderRemove a header from the request before forwarding.
request.setQueryParamAdd or override a URL query parameter.
request.removeQueryParamRemove a query parameter from the URL.
renameFieldRename a JSON body field. Useful for API version compatibility.
setDefaultSet a default value for a field if it doesn't exist in the body.
stringTrimTrim whitespace from string fields in the request body.
stringToLowerConvert string fields to lowercase.
request.xmlToJsonConvert an XML request body to JSON before forwarding to upstream. Supports namespace stripping, attribute extraction, and CDATA. XXE-safe, depth-limited.
Response Actions (8)
hideSensitiveDataMask or remove sensitive fields from response JSON. Supports dot notation and wildcards (e.g., "users.*.ssn").
response.setHeaderSet or override a response header.
response.removeHeaderRemove a header from the response.
removeFieldRemove a field from the response JSON body.
response.replaceStringFind and replace strings in the response body.
response.securityHeadersInject OWASP-recommended security headers (CSP, HSTS, X-Frame-Options, etc.).
addHeaderAppend a header to the response (does not override existing values).
response.jsonToXmlConvert a JSON response body to XML before sending to the client. Supports custom root element, CDATA fields, indentation, and XML declaration. Automatically sets Content-Type: application/xml.
Configuration Example
Pipeline configuration is stored per-route as JSON:
{
"request": [
{
"action": "request.jwtClaimToHeader",
"config": {
"claim": "sub",
"header": "X-User-Id",
"required": true
}
},
{
"action": "request.removeHeader",
"targets": ["x-debug-token"],
"condition": {
"method": ["POST", "PUT"]
}
}
],
"response": [
{
"action": "hideSensitiveData",
"targets": ["users.*.ssn", "users.*.email"],
"mask": "***REDACTED***"
},
{
"action": "response.securityHeaders"
}
]
}Conditional Execution
Each action can have a condition object that filters when it runs:
- method — Only run for specific HTTP methods (e.g.,
["POST", "PUT"]) - path — Only run for paths starting with a prefix (e.g.,
"/v2/")
If no condition is specified, the action runs for every request.
Error Handling
Pipelines use graceful degradation: if an action fails, it is logged but the pipeline continues executing the remaining actions. This ensures a single misconfigured action never breaks your entire API.
Plan Requirements
Transform Pipelines are available on Pro plans and above. Free and Starter plans do not include pipeline support.