# API Response Contract Audit

> API Response Contract Audit is a paid API for AI agents from api.zfinia.com, paid per call via x402, $0.12/call, status unknown (last checked 2026-10-11).

Validates a captured HTTP response against a declared contract covering expected status, required/forbidden headers, header value rules, and a body schema.

## Facts

- Endpoint: POST https://api.zfinia.com/x402/v1/api-response-contract-audit?utm_source=zero.xyz
- Price: $0.12/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-response-contract-audit-99b5bff4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_A-84lEzAE1gImnQXcx9nQ

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability api-response-contract-audit-99b5bff4 -d '<json body>'
```

Example prompt: Check if this API response is contract-compliant: it returned status 200, has a Content-Type header of application/json, is missing an X-Request-Id header I require, and the body should match a schema with a required 'id' field of type string and 'items' as an array — flag any violations.

## When to prefer this

Use this endpoint when you need to validate a response from an API that sits behind authentication or on a private network, where automated contract testing tools cannot reach it directly. It is ideal when you have already captured the HTTP response and want to assert it against a formally declared contract without re-running the request. Prefer this over general JSON schema validators when you also need to check HTTP status codes and headers simultaneously.

## Known failure modes

- Missing required 'status' field in the response object causes a validation error
- Malformed body_schema causes schema evaluation to fail
- If the response body is not JSON-parseable, body schema validation will fail
- Overly broad status class expressions may be misinterpreted
- No internet access to the live API — caller must supply the captured response

## How this service works

Audit an HTTP response you captured against a contract you declare: expected status or status class, required and forbidden headers, header value rules, and a body schema. Header names compare case-insensitively. You supply the response, so this works against an API behind authentication or on a private network.

## Output

An audit report detailing which contract rules passed or failed: whether the HTTP status matched the expected status or class, which required headers were missing, which forbidden headers were present, which header value rules were violated, and which body schema constraints failed — with case-insensitive header name comparison throughout.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "contract": {
   "type": "object",
   "properties": {
    "body_schema": {
     "type": "object"
    },
    "header_values": {
     "type": "object"
    },
    "expected_status": {},
    "required_headers": {
     "type": "array",
     "items": {
      "type": "string",
      "maxLength": 128
     },
     "maxItems": 50
    },
    "forbidden_headers": {
     "type": "array",
     "items": {
      "type": "string",
      "maxLength": 128
     },
     "maxItems": 50
    }
   },
   "additionalProperties": false
  },
  "response": {
   "type": "object",
   "required": [
    "status"
   ],
   "properties": {
    "body": {},
    "status": {
     "type": "integer",
     "maximum": 599,
     "minimum": 100
    },
    "headers": {
     "type": "object"
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-response-contract-audit-99b5bff4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.zfinia.com](https://www.zero.xyz/host/api.zfinia.com/llms.txt)
