/api/v1/documents/{slug}/lockTake the edit lock
Takes, renews or takes over a page's edit lock, so nobody else edits it at the same time. Take it with your first real change (intent=edit) and renew it every 30 seconds while you edit (intent=heartbeat, with edited, hidden and dirty). It lapses 2 minutes after your last heartbeat, 2 minutes after your last change, or 60 seconds after your tab was hidden, whichever comes first. A heartbeat never takes back a lock that lapsed or was taken over: it answers mine: false, released: true and the reason. take_over=true lets the page's owner or a workspace admin take it from whoever holds it.
Guide: Editing together
Code samples and Try itPath parameters
#slugstringRequiredThe document's address: the part after
markdrop.in/.
Query parameters
#intent"edit" | "heartbeat"edit(your first change: take it) orheartbeat(renew yours). Leave it out only in old clients.editedbooleanYou changed something since the last heartbeat. Default
false.hiddenbooleanYour tab is hidden now.
dirtybooleanYou have changes the server doesn't have yet.
take_overbooleanTake it from whoever holds it. The page's owner and workspace admins only. Default
false.
Responses
#200OK.401No token, or the token is revoked or mistyped.403take_over_forbidden: only the page's owner or a workspace admin can take over.422The request didn't validate.detaillists each problem, with where it is (loc) and why (msg).423Someone else is editing:codeislocked, with theholder's name,idle_s,dirty(unsaved changes),releases_in_sandcan_take_over.429Too many requests from your IP address. Wait the seconds inRetry-After.