New to Kestra?
Use blueprints to kickstart your first workflows.
Validate configurable API JSON responses, branch on contract validity, and optionally notify Slack about failures.
Validate an API response as part of a repeatable Kestra workflow. The blueprint calls a configurable URL, accepts unsuccessful HTTP responses as data for inspection, parses the response as JSON, and checks a small top-level contract. It then uses an If flow to handle valid and invalid responses and returns the validation result as a structured flow output.
scheduled_validation trigger is provided as a disabled hourly
schedule. Enable it after configuring the target API.call_api uses io.kestra.plugin.core.http.Request to send a GET
request to the api_url input. options.allowFailed: true keeps 4xx
and 5xx responses available for validation rather than failing before
the contract check.validate_response parses the response body and checks that the HTTP
status equals expected_status_code, the body is a JSON object, and
every field in required_fields exists.route_validation_result uses an If flow. Valid responses are logged
as successful; invalid responses are logged with their validation
errors and can optionally be sent to Slack.validation_result output returns the status, validity flag,
missing fields, and validation errors.validation_result output for downstream tasks.A standalone script can make one request, but Kestra adds triggers, execution history, observable task boundaries, branching, secret management, and reusable outputs. The same validation can run manually, on a schedule, or as part of a larger data and integration workflow.
SLACK_WEBHOOK_URL: Slack Incoming Webhook URL, required only when
notify_slack is true. Do not put the webhook URL in this flow.With the default inputs, a valid response looks like:
{
"id": 1,
"title": "Example product",
"price": 29.99
}
The response must be a JSON object with id, title, and price, and
it must use HTTP status 200. Change required_fields and
expected_status_code for another API contract.
api_url to the API endpoint you want to validate.required_fields to a JSON array of required top-level fields.notify_slack to true only after creating the
SLACK_WEBHOOK_URL secret in Kestra.{{ outputs.validation_result }} and enable the schedule when
the manual execution succeeds.A response is valid only when its HTTP status equals
expected_status_code, its body parses as JSON, the parsed value is an
object, and every name in required_fields is present. A 4xx/5xx status,
malformed JSON, an array/scalar body, or a missing field produces an
invalid result with a reason in errors.
{{ outputs.validation_result }}: JSON object containing valid,
http_status, expected_status, missing_fields, and errors.{{ outputs.validate_response.vars.result }}: The same structured
result available to downstream tasks in this flow.status or data.items.