# OpenAPI Mock Response Synthesizer

> OpenAPI Mock Response Synthesizer is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Synthesizes a realistic JSON response body for a specified operation and status code in an OpenAPI 3.x or Swagger 2.x specification

## Facts

- Endpoint: POST https://agent402.tools/api/openapi-mock-response
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/openapi-mock-response-synthesizer-3775e78e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_woDGBPyNL-XmlSx4qPQvW

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 openapi-mock-response-synthesizer-3775e78e -d '<json body>'
```

Example prompt: Can you generate a mock JSON response for the 'createUser' operation in this OpenAPI spec — use the 201 status code? Here's the spec: {paste spec}

## When to prefer this

Use this endpoint when you need realistic, schema-conformant mock response data from an existing OpenAPI or Swagger specification without calling the real API — ideal for testing, documentation, and development workflows where you need example payloads that match a known spec contract.

## Known failure modes

- operationId not found in spec — returns error indicating no matching operation
- no matching status code found and no 2xx response defined — returns error
- spec is malformed or unparseable JSON/YAML — returns parse error
- path+method combination does not exist in spec — returns not-found error
- response schema has no defined structure — returns empty or minimal mock

## How this service works

Synthesize a JSON response body for one operation + status code in an OpenAPI 3.x or Swagger 2.x spec. Locate the operation by operationId or method+path. Pick the response by explicit `status`, else the first 2xx, else the first documented response. Generation precedence: operation-level `example`/`examples` > schema `example` > recursive type-inferred walk (objects walk properties, arrays return [mock(items)], enums return the first value, $ref is surfaced literally).

## Output

A synthesized JSON object representing a realistic response body for the matched operation and status code, derived from the response schema defined in the OpenAPI or Swagger document.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "path": {
   "description": "Path template (use with `method` if no operationId)"
  },
  "spec": {
   "description": "OpenAPI/Swagger document (object or JSON string)"
  },
  "method": {
   "description": "HTTP method (use with `path` if no operationId)"
  },
  "status": {
   "description": "Response status to mock (defaults to first 2xx)"
  },
  "operationId": {
   "description": "operationId to mock (preferred)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "mock": {
   "id": "u_42",
   "name": "Alice",
   "roles": [
    "admin"
   ],
   "active": true
  },
  "source": "generated",
  "status": "200",
  "contentType": "application/json"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/openapi-mock-response-synthesizer-3775e78e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
