{"uid":"cap_Xhta3ThTM350taaDFh-pd","slug":"relaystation-apply-patch-b0c3d6b2","name":"Relaystation Apply Patch","description":"$0.0002/MB. Apply a unified diff to a source string — 422 on context mismatch, never a silent bad merge. 1¢ x402 min; remainder auto-credits — relaystation.ai/penny","url":"https://api.relaystation.ai/v1/text/apply-patch","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","properties":{"patch":{"type":"string","description":"A unified-diff patch (e.g. from text/diff)."},"source":{"type":"string","description":"The original text to patch."}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST","PUT","PATCH"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_QjJ-Pe4qyNa-4_LkgELKM","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Applies a unified diff (patch) to a source string, returning the patched result or a 422 error on context mismatch — never a silent bad merge.","exampleAgentPrompt":"Apply this unified diff to my source code — the original is 'function hello() { return \"world\"; }' and the patch is '--- a\\n+++ b\\n@@ -1 +1 @@\\n-function hello() { return \"world\"; }\\n+function hello() { return \"hello world\"; }' — and fail loudly if the context doesn't match.","exampleUseCases":[{"title":"Applying code review patch to source","prompt":"I have a code review that produced a unified diff — take this original function and apply the patch to it, but throw an error if the context lines don't match exactly so I know if the patch is stale."},{"title":"Automated patch replay in CI pipeline","prompt":"In my build pipeline, I need to replay a stored unified diff against the current version of this config file — apply the patch and return the updated text, or give me a 422 if the file has changed in a way that breaks the context."},{"title":"Merging text edits from a diff tool","prompt":"I used a diff tool to capture edits to my markdown document and now I have the original text and the unified diff — can you apply the patch to get the final version, making sure it fails clearly if anything doesn't align?"}],"resultDescription":"Returns the patched string resulting from applying the unified diff to the source. If the context lines in the diff do not match the source, returns a 422 error — guaranteeing no silent bad merges.","failureModes":["422 Unprocessable Entity when diff context lines do not match the source string","Malformed unified diff input causes parsing error","Empty source or patch input returns error","Network timeout on very large payloads","Payment not fulfilled (x402 payment required)"],"whenToPreferThis":"Choose this endpoint when you need guaranteed-safe patch application — it explicitly rejects context mismatches with a 422 rather than silently producing a corrupted merge. Ideal for agents automating code edits, config updates, or any text transformation where correctness must be verified and silent failures are unacceptable.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T06:47:29.307Z","isFirstParty":false}