Slice one operation out of an OpenAPI 3.0 or 3.1 document with every component it needs

$0.005 USDC per call · Developer and security · POST /api/v1/openapi-slice · Id openapi-slice

Extracts one operation (path plus HTTP method, matching templated paths like /pets/{id}) from an OpenAPI 3.0.x or 3.1.x document, given as JSON, YAML or a parsed object, and returns a smaller valid OpenAPI document holding that operation, its path-level parameters and servers, and the transitive closure of every local $ref it uses: schemas, parameters, requestBodies, responses, headers, examples, links, callbacks, pathItems, securitySchemes and discriminator mappings, cycle safe. For agents that need to put one endpoint of a large API into a prompt or a tool definition. External file or URL references are listed and the status is unsupported, never silently dropped. It does not validate the document and does not dereference (references stay as $ref).

What you get

A 2 MB API description shrinks to the few KB one call needs, with nothing missing. 400 KB of JSON, 50 KB of YAML or 120,000 nodes per $0.005 call.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/openapi-slice. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/openapi-slice \
  -H 'content-type: application/json' \
  -d '{"specText":"openapi: 3.0.3\ninfo: {title: Pets, version: '\''1'\''}\npaths:\n  /pets/{id}:\n    get:\n      operationId: getPet\n      parameters:\n        - $ref: '\''#/components/parameters/Id'\''\n      responses:\n        '\''200'\'':\n          description: ok\n          content:\n            application/json:\n              schema: {$ref: '\''#/components/schemas/Pet'\''}\n  /owners:\n    get:\n      responses:\n        '\''200'\'': {description: ok}\ncomponents:\n  parameters:\n    Id: {name: id, in: path, required: true, schema: {type: string}}\n  schemas:\n    Pet: {type: object, properties: {friends: {type: array, items: {$ref: '\''#/components/schemas/Pet'\''}}}}\n    Unused: {type: string}\n","path":"/pets/42","method":"get"}'

Input

FieldTypeRequiredDescription
specanynoThe OpenAPI document as a JSON object (use specText for YAML).
specTextstring; length 0..400000noThe OpenAPI document as JSON text (up to 400000 characters) or YAML text (up to 50000 characters).
pathstring; length 0..500yesConcrete or templated path, e.g. /pets/{petId} or /pets/42.
methodstring; one of "get", "put", "post", "delete", "options", "head", "patch", "trace"yes

Example request body

{
  "specText": "openapi: 3.0.3\ninfo: {title: Pets, version: '1'}\npaths:\n  /pets/{id}:\n    get:\n      operationId: getPet\n      parameters:\n        - $ref: '#/components/parameters/Id'\n      responses:\n        '200':\n          description: ok\n          content:\n            application/json:\n              schema: {$ref: '#/components/schemas/Pet'}\n  /owners:\n    get:\n      responses:\n        '200': {description: ok}\ncomponents:\n  parameters:\n    Id: {name: id, in: path, required: true, schema: {type: string}}\n  schemas:\n    Pet: {type: object, properties: {friends: {type: array, items: {$ref: '#/components/schemas/Pet'}}}}\n    Unused: {type: string}\n",
  "path": "/pets/42",
  "method": "get"
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
sliceone ofno
matchedPathone ofno
templateMatchbooleannoTrue when path matched a templated key such as /pets/{id}.
operationIdone ofno
openapione ofno
includedobjectno
unresolvedarray<object>no
sizesobjectno
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the data-contract-kit package.

Machine-readable