{"uid":"cap_u-KrkjWQVzZsleL8skM_k","slug":"data-toolkit-json-patch-rfc-6902-4df58347","name":"Data Toolkit – JSON Patch (RFC 6902)","description":"Apply an RFC 6902 JSON Patch to a JSON document and return the result. An invalid or unresolvable patch (e.g. a failed `test`, or a path that does not exist) is rejected before payment.","url":"https://data.openverbs.com/v1/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","required":["data","patch"],"properties":{"data":{"description":"The JSON document to patch."},"patch":{"type":"array","items":{"type":"object","required":["op","path"],"properties":{"op":{"enum":["add","remove","replace","move","copy","test"],"type":"string"},"from":{"type":"string","description":"Source JSON Pointer for move/copy."},"path":{"type":"string","description":"A JSON Pointer (RFC 6901) target."},"value":{"description":"Any JSON value (object, array, string, number, boolean or null)."}},"additionalProperties":false},"description":"An RFC 6902 JSON Patch: an array of operation objects."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_XM0q8VX2ZtPssptecmr6Z","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Applies an RFC 6902 JSON Patch array of operations (add, remove, replace, move, copy, test) to a JSON document and returns the patched result.","exampleAgentPrompt":"Take this JSON document {\"name\":\"Alice\",\"age\":30,\"roles\":[\"viewer\"]} and apply these RFC 6902 patch operations: add the field 'email' with value 'alice@example.com', replace 'age' with 31, and add 'editor' to the roles array.","exampleUseCases":[{"title":"Add missing field to API payload","prompt":"I have a JSON object {\"id\":\"123\",\"status\":\"pending\"} and I need to add a 'priority' field set to 'high' and a 'retries' field set to 0 using JSON Patch — can you apply those two add operations for me?"},{"title":"Remove sensitive keys before logging","prompt":"Strip the 'password' and 'ssn' fields from this JSON record using JSON Patch remove operations: {\"user\":\"bob\",\"password\":\"secret\",\"ssn\":\"123-45-6789\",\"email\":\"bob@example.com\"}."},{"title":"Restructure nested config document","prompt":"I have a config JSON {\"database\":{\"host\":\"localhost\",\"port\":5432},\"debug\":true} and I want to replace 'host' with 'prod-db.example.com', change 'port' to 5433, and remove the 'debug' key — apply those patch operations."}],"resultDescription":"The patched JSON document after all specified RFC 6902 operations have been applied in sequence. If any operation fails (e.g. a 'test' assertion fails or a path does not exist), an error response is returned indicating which operation caused the failure.","failureModes":["Invalid JSON Pointer path causes operation to fail with a path-not-found error","'test' operation assertion fails, halting the patch and returning an error","Malformed patch array (missing required 'op' or 'path' fields) causes a validation error","Attempting to 'remove' a non-existent path returns an error","'move' or 'copy' operation with a missing 'from' pointer returns an error","Input document is not a valid JSON object, causing a parse error"],"whenToPreferThis":"Choose this endpoint when you need to apply standard RFC 6902 JSON Patch operations to a JSON document — especially when you already have a patch array (e.g. from a diff tool or version control system) or need precise, pointer-based edits without rewriting the entire document. It is ideal for partial updates, config mutations, and any workflow where idiomatic JSON Patch semantics (including test assertions) are required rather than ad-hoc string manipulation.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:30:24.542Z","isFirstParty":false}