API readiness contract
96-api-readiness-contract.yaml
HTTP(S)
What this example does
This example demonstrates api readiness contract.
Checks and behavior
- Sends an GET request to https://api.example.com/health.
- Checks allowed/denied HTTP status codes.
- Validates required, forbidden or matching HTTP headers.
- Looks for expected response content and/or rejects known error markers.
- TLS settings cover certificate trust, certificate expiry.
- Applies response-time thresholds for operational alerting.
- Formats results for icinga2 output.
Adapt example domains, addresses, credentials and thresholds to your environment before use.
YAML configuration
# Copyright (c) 2026 mati peterson. Maintainer: mati peterson <ipsonic@mailbox.org>. Project: https://ipsonic.com/probe/. Disclaimer: Provided AS IS, without warranty of any kind. Use at your own risk; validate checks and configurations before production use.
# API readiness: JSON response + TLS + latency + no error traces.
name: "API readiness contract"
url: "https://api.example.com/health"
request:
method: GET
headers: {Accept: application/json}
follow_redirects: false
timeouts: {connect: 2, response: 8}
tls: {verify: true, min_valid_days: 21}
tests:
status: {allow: [200], deny: [301, 302, 401, 403, 500, 503]}
headers:
contains:
Content-Type: [application/json]
response:
min_bytes: 10
max_bytes: 65536
content_type: application/json
body:
contains: ['"status"']
not_contains: ["Traceback", "Exception", "Internal Server Error"]
monitoring:
service_name: "API Readiness Contract"
output: icinga2
on_failure: critical
thresholds:
response_time: {warning: 1, critical: 3}