WritersLogic Verifiable AI Agent Hub Patch Anchor API
The Patch Anchor API from WritersLogic Verifiable AI Agent Hub — 1 operation(s) for patch anchor.
The Patch Anchor API from WritersLogic Verifiable AI Agent Hub — 1 operation(s) for patch anchor.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/writerslogic-com:writerslogic-com-patch-anchor-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: WritersLogic Verifiable AI Agent Hub Patch Anchor API
version: 2.0.0
description: Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.
contact:
name: WritersLogic
url: https://writerslogic.com/agents
email: agents@writerslogic.com
servers:
- url: https://agents.writerslogic.com
tags:
- name: Patch Anchor
paths:
/api/v1/patch-anchor:
post:
operationId: patch_anchor
summary: Apply a unified-diff hunk or search/replace edit to a file by content, refusing…
description: 'Applies unified-diff hunks (wrong line numbers are fine) or search/replace blocks to a supplied file text and returns the patched text, for an agent whose edit tool failed or whose diff has drifted line numbers. Each hunk is located by its content against the original file, trying exact, trailing-whitespace, outer-whitespace then collapsed-whitespace matching; the rung used is reported per hunk. If a hunk matches more than once it is refused and the candidate lines with similarity scores are returned; if any hunk is missing, ambiguous or overlapping nothing is applied (never a partial patch). Does not run tools, touch files, handle multi-file, new-file, rename or binary diffs, or match inside a line: edits and hunks match whole lines.
Price: 0.005 USDC on Base (x402).'
x-x402-price-usdc: '0.005'
x-x402-amount: '5000'
x-payment-info:
protocols:
- x402
price:
mode: fixed
currency: USD
amount: '0.005'
x-audience: agent-infra
x-sample-url: https://agents.writerslogic.com/api/v1/samples/patch-anchor
security:
- x402: []
- apiKey: []
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- file
properties:
file:
type: string
maxLength: 524288
description: Current file text, at most 524288 UTF-8 bytes and 100000 lines. A leading BOM is preserved.
diff:
type: string
maxLength: 262144
description: Single-file unified diff, at most 64 hunks and 400 anchor lines each. Header counts and line numbers are ignored except as a reported hint. Give either diff or edits.
edits:
type: array
minItems: 1
maxItems: 64
description: Search/replace blocks, matched as whole lines against the original file; all are located before any is applied.
items:
type: object
additionalProperties: false
required:
- search
- replace
properties:
search:
type: string
maxLength: 65536
replace:
type: string
maxLength: 65536
description: Empty string deletes the matched lines.
line:
type: integer
minimum: 1
maximum: 1000000
description: Optional line hint, reported as lineShift and never used to break ties.
example:
file: "function add(a, b) {\n return a + b;\n}\n\nfunction sub(a, b) {\n return a - b;\n}\n"
diff: "@@ -40,3 +40,3 @@\n function sub(a, b) {\n- return a - b;\n+ return b - a;\n }\n"
responses:
'200':
description: Paid result with provenance
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
status:
type: string
enum:
- pass
- fail
- unknown
- unsupported
description: 'pass: 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.'
applied:
type: boolean
description: True only when every hunk matched exactly one place and none overlap.
text:
type: string
description: The patched file; present only when applied is true.
hunks:
type: array
items:
type: object
properties:
index:
type: integer
kind:
type: string
enum:
- hunk
- edit
state:
type: string
enum:
- applied
- ambiguous
- not-found
- overlap
- invalid
- budget
tolerance:
type: string
enum:
- exact
- trailing-ws
- outer-ws
- inner-ws
description: 'Rung of the tolerance ladder that matched: exact, trailing whitespace ignored, outer whitespace ignored, internal whitespace collapsed.'
startLine:
type: integer
description: 1-based first original line of the matched region.
endLine:
type: integer
description: 1-based last original line of the matched region.
lineHint:
type: integer
description: The line number the caller gave; never used to choose between matches.
lineShift:
type: integer
description: Matched start line minus the hint.
candidates:
type: array
items:
type: object
properties:
startLine:
type: integer
endLine:
type: integer
score:
type: number
description: Share of anchor lines identical to the file's lines (ambiguous) or positional similarity (not found).
tolerance:
type: string
candidateCount:
type: integer
note:
type: string
eol:
type: string
enum:
- lf
- crlf
- mixed
- none
description: Line endings found in the input file.
finalNewline:
type: boolean
description: Whether the returned text (or, when not applied, the input file) ends with a line terminator.
changed:
type: boolean
description: 'Present when applied: false if the result is byte-identical to the input.'
witnesses:
type: array
items:
type: object
properties:
ruleId:
type: string
detail:
type: string
path:
type: string
description: JSON pointer or dotted path into the input.
offset:
type: integer
index:
type: integer
expected:
description: What the rule required.
actual:
description: What the input had.
versions:
type: object
description: Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limits:
type: array
items:
type: string
deterministic:
type: boolean
description: 'Always true: pure code, no model.'
_provenance:
type: object
description: C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance
required:
- data
- _provenance
'400':
description: Invalid request (no payment consumed)
content:
application/json:
schema:
type: object
properties:
error:
type: string
code:
type: string
'401':
description: Invalid X-API-KEY
content:
application/json:
schema:
type: object
properties:
error:
type: string
code:
type: string
'402':
description: Payment required or invalid
content:
application/json:
schema:
type: object
description: x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)
properties:
x402Version:
type: integer
error:
type: string
code:
type: string
resource:
type: object
accepts:
type: array
items:
type: object
extensions:
type: object
'502':
description: Upstream failure; the payment is released or not settled
content:
application/json:
schema:
type: object
properties:
error:
type: string
code:
type: string
tags:
- Patch Anchor
components:
securitySchemes:
x402:
type: apiKey
in: header
name: PAYMENT-SIGNATURE
description: x402 v2 payment payload (base64) sent after a 402 challenge
apiKey:
type: apiKey
in: header
name: X-API-KEY