Multi-Step Checks

Multi-step checks let you monitor complex workflows that require sequential operations—like logging in, extracting a token, and using that token to access protected resources.

All steps in a multi-step check execute on the same checker node, allowing you to share cookies, session state, and extracted variables between steps.

When to Use Multi-Step

  • Login flows: Authenticate → access protected resource
  • API chains: Get ID → fetch related data
  • E-commerce: Add to cart → verify cart → checkout
  • Any workflow requiring session state

Basic Structure

{
  "type": "multistep",
  "config": {
    "steps": [
      {
        "name": "Step 1 Name",
        "type": "https",
        "config": { /* check config */ },
        "extracts": { /* variables to extract */ }
      },
      {
        "name": "Step 2 Name",
        "type": "https",
        "config": {
          /* can use {{variable}} from step 1 */
        }
      }
    ],
    "fail_fast": true
  }
}

Example: OAuth-Protected API

{
  "name": "api-workflow",
  "type": "multistep",
  "config": {
    "steps": [
      {
        "name": "Get Token",
        "type": "https",
        "config": {
          "url": "https://api.example.com/oauth/token",
          "method": "POST",
          "headers": { "Content-Type": "application/json" },
          "body": "{\"client_id\":\"xxx\",\"client_secret\":\"yyy\"}"
        },
        "extracts": {
          "token": { "jsonpath": "$.access_token" }
        }
      },
      {
        "name": "Call API",
        "type": "https",
        "config": {
          "url": "https://api.example.com/users",
          "headers": {
            "Authorization": "Bearer {{token}}"
          },
          "expected_status": [200]
        }
      }
    ],
    "fail_fast": true
  },
  "regions": ["na-east-ewr"],
  "interval_seconds": 300
}

Variable Extraction

Extract values from responses using JSONPath:

"extracts": {
  "token": { "jsonpath": "$.access_token" },
  "user_id": { "jsonpath": "$.user.id" },
  "session": { "header": "Set-Cookie" }
}
          

Then reference them in subsequent steps with {{variable_name}}.

More Examples

See the Terraform examples for advanced patterns including:

  • OAuth2 client credentials flow
  • GraphQL queries with variable passing
  • Webhook signature verification
  • API pagination handling
  • Circuit breaker patterns

See Also