81trust / 100

Openapi Redact

by OpenAPI spec redactor in Documents & files

x402 APIPassing, checked 4 h ago

Shrink an OpenAPI 3.x or Swagger 2.x document for LLM context by stripping verbose meta-fields (examples, descriptions, summaries, tags, externalDocs, deprecated). Categories are explicit; default is `["examples", "descriptions"]`. User-defined property names under `properties: { ... }` are protected - only the meta-field `example` keyword inside a property schema is removed, not a user property literally named "example".

POST https://agent402.tools/api/openapi-redact

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
191 ms typical, 191 ms slowest 5%
Last check
4 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/openapi-redact" \
  -H "content-type: application/json" \
  -d '{"spec":{"info":{"description":"An example API","title":"Demo","version":"1.0.0"},"openapi":"3.0.0","paths":{"/users":{"get":{"description":"Returns all users.","parameters":[{"description":"Max results","in":"query","name":"limit","schema":{"example":10,"type":"integer"}}],"responses":{"200":{"description":"ok"}},"summary":"List users"}}}},"strip":["examples","descriptions"]}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fopenapi-redact
const res = await pay("https://agent402.tools/api/openapi-redact", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"spec":{"info":{"description":"An example API","title":"Demo","version":"1.0.0"},"openapi":"3.0.0","paths":{"/users":{"get":{"description":"Returns all users.","parameters":[{"description":"Max results","in":"query","name":"limit","schema":{"example":10,"type":"integer"}}],"responses":{"200":{"description":"ok"}},"summary":"List users"}}}},"strip":["examples","descriptions"]}),
});
console.log(await res.json());

Example input

{
  "spec": {
    "info": {
      "description": "An example API",
      "title": "Demo",
      "version": "1.0.0"
    },
    "openapi": "3.0.0",
    "paths": {
      "/users": {
        "get": {
          "description": "Returns all users.",
          "parameters": [
            {
              "description": "Max results",
              "in": "query",
              "name": "limit",
              "schema": {
                "example": 10,
                "type": "integer"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "ok"
            }
          },
          "summary": "List users"
        }
      }
    }
  },
  "strip": [
    "examples",
    "descriptions"
  ]
}

Example output

{
  "removed": {
    "descriptions": 4,
    "examples": 1
  },
  "sizeAfter": 209,
  "sizeBefore": 334,
  "spec": {
    "info": {
      "title": "Demo",
      "version": "1.0.0"
    },
    "openapi": "3.0.0",
    "paths": {
      "/users": {
        "get": {
          "parameters": [
            {
              "in": "query",
              "name": "limit",
              "schema": {
                "type": "integer"
              }
            }
          ],
          "responses": {
            "200": {}
          },
          "summary": "List users"
        }
      }
    }
  }
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
4 h agoPassed402191 ms$0.001