# agent402.tools OpenAPI-to-cURL Command Builder

> agent402.tools OpenAPI-to-cURL Command Builder is a paid API for AI agents from agent402.tools, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Generates a runnable curl command for a specified operation in an OpenAPI 3.x or Swagger 2.x spec, resolving path parameters, required query params, and headers using example values from the spec.

## Facts

- Endpoint: POST https://agent402.tools/api/openapi-to-curl
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-openapi-to-curl-command-builder-603d48c5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_OIHIn4SGZh50gZNWcqNz8

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 agent402-tools-openapi-to-curl-command-builder-603d48c5 -d '<json body>'
```

Example prompt: Take this OpenAPI spec and build me a runnable curl command for the 'createUser' operation — use the example values from the spec to fill in path params and required headers.

## When to prefer this

Use this endpoint when you have an OpenAPI 3.x or Swagger 2.x spec and need a ready-to-run curl command for a specific operation, especially when you want parameters auto-filled from spec examples rather than writing the curl command manually.

## Known failure modes

- operationId not found in spec — returns error indicating missing or mismatched operationId
- spec is invalid or unparseable JSON/YAML — returns parse error
- method + path combo does not match any operation — returns not found error
- required path parameter has no example value in spec — may return incomplete or placeholder curl command
- malformed input schema — returns validation error

## How this service works

Build a runnable curl command for one operation in an OpenAPI 3.x or Swagger 2.x spec. Locate the operation by operationId (preferred) or by method + path, substitute path parameters using the spec's example values, include required query and header parameters with their example values, and attach a JSON body when the operation defines one. Returns the structured request (method, url, headers, body) alongside the assembled curl string with POSIX single-quote escaping.

## Output

A complete, runnable curl command string with path parameters substituted, required query parameters and headers included, based on example values found in the provided OpenAPI or Swagger spec.

## 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)"
  },
  "operationId": {
   "description": "operationId of the operation to render (preferred)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "url": "https://api.example.com/users/u_42?fields=name%2Cemail",
  "body": null,
  "curl": "curl -X GET 'https://api.example.com/users/u_42?fields=name%2Cemail'",
  "method": "GET",
  "headers": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-openapi-to-curl-command-builder-603d48c5/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)
