Apply document body (optimistic base_hash)
const url = 'https://example.com/wp-json/wp2/studio-sync/v1/sync/posts/1';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"base_hash":"example","content":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/wp-json/wp2/studio-sync/v1/sync/posts/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "base_hash": "example", "content": "example" }'Writes content with optimistic locking: base_hash (the hash the client last saw) and content are required. On hash mismatch returns 409 and does not change WordPress. WP EDITABLE also accepts PUT/POST.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”WordPress post ID.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Document hash the client last saw (optimistic lock).
Document body (Gutenberg HTML, Studio, validate).
Example
{ "base_hash": "example", "content": "example"}Responses
Section titled “Responses”OK
object
Success flag (often Studio/License envelope).
Document content hash.
Examplegenerated
{ "success": true, "hash": "example"}Studio_sync_missing_auth / studio_sync_invalid_token
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Studio_sync_insufficient_permissions / studio_sync_connection_revoked
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Conflict
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Validation errors
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}