# OpenAPI $ref Inliner / Resolver

> OpenAPI $ref Inliner / Resolver is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Resolves and inlines all local $ref pointers in an OpenAPI 3.x or Swagger 2.x document, producing a fully self-contained spec with no unresolved references.

## Facts

- Endpoint: POST https://agent402.tools/api/openapi-resolve-refs
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/openapi-ref-inliner-resolver-4d2cd83f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2m1qrK5i5TSBt-FzNuWTn

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-ref-inliner-resolver-4d2cd83f -d '<json body>'
```

Example prompt: Take this OpenAPI 3.x spec and inline all the local $ref pointers so I get back a fully self-contained document with no unresolved references — here's the spec: { ... }

## When to prefer this

Use this endpoint when your OpenAPI 3.x or Swagger 2.x document uses local $ref pointers that confuse downstream code generators, validators, or documentation tools. Ideal when you need a flat, portable spec with no external dependencies on shared component sections.

## Known failure modes

- Circular $ref chains may cause infinite recursion or an error response
- Invalid JSON string input returns a parse error
- Non-OpenAPI/Swagger documents may yield unexpected or partial resolution
- External $ref URLs (non-local) are not resolved and remain as-is
- Malformed $ref pointers that don't match #/components/... or #/definitions/... are left unresolved

## How this service works

Inline every local `$ref` in an OpenAPI 3.x or Swagger 2.x document so downstream tools see a self-contained spec. Resolves `#/components/...` (OpenAPI) and `#/definitions/...` (Swagger) JSON-pointer refs anywhere in the document, including inside components themselves. Per-branch cycle detection: if A→B→A, the second A is left as a `$ref` and recorded under `circular`. External refs (http://, file://, ./other.yaml) are never fetched - they're reported under `external` and left as-is.

## Output

A fully resolved OpenAPI or Swagger document returned as a JSON object, where every local $ref (e.g. #/components/schemas/Foo or #/definitions/Bar) has been replaced with the actual inlined schema content, making the document self-contained and ready for downstream tools.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "spec": {
   "description": "OpenAPI/Swagger document (object or JSON string)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "spec": {
   "info": {
    "title": "Demo",
    "version": "1.0.0"
   },
   "paths": {
    "/users/{id}": {
     "get": {
      "responses": {
       "200": {
        "content": {
         "application/json": {
          "schema": {
           "type": "object",
           "properties": {
            "id": {
             "type": "string"
            },
            "name": {
             "type": "string"
            }
           }
          }
         }
        },
        "description": "ok"
       }
      },
      "parameters": [
       {
        "in": "path",
        "name": "id",
        "schema": {
         "type": "string"
        },
        "required": true
       }
      ]
     }
    }
   },
   "openapi": "3.0.0",
   "components": {
    "schemas": {
     "User": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string"
       },
       "name": {
        "type": "string"
       }
      }
     }
    },
    "parameters": {
     "UserId": {
      "in": "path",
      "name": "id",
      "schema": {
       "type": "string"
      },
      "required": true
     }
    }
   }
  },
  "circular": [],
  "external": [],
  "resolved": 2,
  "unresolved": []
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/openapi-ref-inliner-resolver-4d2cd83f/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)
