Create Library Patch (writeback)
Sandcastles
Create Library Patch (Writeback)
Persist a sandcastle’s edits to /sandbox/files/library back to the org’s Context Library as a reviewable patch.
POST
Create Library Patch (writeback)
This is the writeback half of the Context Library. The library is mounted into
every sandcastle at
/sandbox/files/library, pruned to your OWNERS
permissions. Reads happen over the filesystem; writes back to canonical,
versioned org context happen here — as a reviewable patch, not a silent commit.Workflow
(Optional) Preview the diff
Call Diff Library to confirm what
will be written back before authoring a patch.
Create the patch
POST /v2/sandcastles/:id/library/patches with a title and description.
The patch is submitted OPEN for admin review (or DRAFT if you set
draft: true).Driving this from an agent loop
If you let an LLM decide when to write back, give the tool a description that teaches the stage-then-patch workflow — otherwise models try to “save” before editing, or file empty patches. A description that mirrors the in-product tool works well:Authorizations
API key or JWT token
Path Parameters
Sandbox ID
Body
application/json
Short summary (≤50 chars). Required for a new patch.
Maximum string length:
50Markdown explanation of the changes. Required for a new patch.
File as DRAFT instead of OPEN (not yet ready for review).
Set to revise an existing patch (creates a new patchset).
Response
Patch created or updated
Patch lifecycle state after submission.
Available options:
open, draft, approved, reserved Human-readable conflict view (present when has_conflicts).