API token from environment
142-api-token-from-environment.yaml
HTTP(S) / Security
What this example does
Uses an environment variable instead of embedding a bearer token in YAML.
Checks and behavior
- Uses an environment variable instead of embedding a bearer token in YAML.
Set `IPSONIC_API_TOKEN` securely before execution. api.example.com is a placeholder; do not use production credentials with sample endpoints.
YAML configuration
# Uses an environment variable instead of embedding a bearer token in YAML.
name: Authenticated API without stored token
url: https://api.example.com/health
request:
method: GET
auth:
type: bearer
token_env: IPSONIC_API_TOKEN
timeouts: {connect: 3, response: 8, total: 15}
tests:
status:
allow: [200]
metadata:
owner: api-operations
environment: example
description: Validate API health with an environment-supplied bearer token
tags: [api, authentication]
monitoring:
service_name: API bearer health
output: nagios
on_failure: critical