Request Templates and Response Matching
Use dynamic execution variables in outbound requests and classify success from response body content.
TrigRun supports two advanced request features for scheduled jobs:
- dynamic variables that render at execution time
- response body matching that can fail a request even when the HTTP status is
200
It also supports:
- structured response assertions against JSON fields, headers, body text, and status codes
- response output mapping so transformed fields can be forwarded in downstream callbacks as
output
These features are useful when the target API expects per-request metadata or when application-level success is encoded in the response body instead of the status code.
Supported dynamic variables
TrigRun currently supports three execution-scoped variables:
| Variable | Example rendered value | Best for |
|---|---|---|
{{timestamp}} | 2026-03-16T12:34:56.000Z | audit timestamps, signed payloads, freshness markers |
{{uuid}} | 123e4567-e89b-42d3-a456-426614174000 | request IDs, idempotency keys, correlation IDs |
{{execution_id}} | cm9x8abc123 | tracing a TrigRun execution through your downstream system |
Where variables can be used
You can use variables in:
request.url- request header values
- plain string request bodies
- string fields inside JSON request bodies
You cannot use variables in:
- header names
- JSON object keys
secret://namereferences
How rendering works
- Variables are rendered once when the execution starts.
- The same rendered values are reused across retries of that execution.
{{uuid}}does not change between retries.- TrigRun still injects
X-Cron-Service-Execution-Idautomatically on every outbound request.
URL examples
Timestamp in a query string
Stable request ID per execution
Header examples
Correlation IDs
Combining variables with secrets
The secret reference is resolved as-is. Variables are not allowed inside secret://... values.
Body examples
Plain string body
JSON body
Response body matching
By default, TrigRun decides success from success_statuses only.
You can make success stricter with response_matcher:
Matching rules
TrigRun evaluates a completed HTTP response in this order:
- worker errors such as timeouts or network failures fail the attempt
- if
failure_patternmatches, the attempt fails - if the status code is not in
success_statuses, the attempt fails - if
success_patternis configured and does not match, the attempt fails - otherwise, the attempt succeeds
Important behavior:
failure_patternwins oversuccess_pattern- response body matching never converts a failed status code into success
- a
200response that fails body matching is treated as failed and does not create a new retry path
Structured response assertions
If you want more reliable validation than raw regex, use response_assertions.
Example: require status = ok and fail when error_code exists.
Supported assertion sources:
json_bodybody_textstatus_codeheader
Supported operators:
equalsnot_equalscontainsnot_containsexistsnot_existsmatches_regex
Response output mapping
Use response_output_template to transform the final response into a compact object for downstream systems.
TrigRun stores this mapped object on the execution as final_output and includes it as output in success and failure callbacks.
Useful mapping placeholders:
{{response.status_code}}{{response.body.status}}{{response.body.data.id}}{{response.body_text}}{{execution.id}}{{execution.status}}{{job.id}}{{job.name}}{{timestamp}}
Common use cases
APIs that always return 200
Some APIs always respond with 200 and put the real outcome in JSON:
Use a failure pattern so TrigRun records this as a failed execution instead of a success.
Require an explicit success marker
If the target returns 200 for accepted-but-not-complete work, require a success marker:
Case-insensitive response matching
Validation limits
- supported regex flags:
i,m,s,u gis not supported- each regex pattern is limited to 512 characters
- TrigRun evaluates patterns against the first 64 KiB of the response body