POST/api/v1/documents/{slug}/lock

Take 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.

API token required60 per minute per IP

Guide: Editing together

Code samples and Try it

Path parameters

#
  • slugstringRequired

    The document's address: the part after markdrop.in/.

Query parameters

#
  • intent"edit" | "heartbeat"

    edit (your first change: take it) or heartbeat (renew yours). Leave it out only in old clients.

  • editedboolean

    You changed something since the last heartbeat. Default false.

  • hiddenboolean

    Your tab is hidden now.

  • dirtyboolean

    You have changes the server doesn't have yet.

  • take_overboolean

    Take 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. detail lists each problem, with where it is (loc) and why (msg).
  • 423Someone else is editing: code is locked, with the holder's name, idle_s, dirty (unsaved changes), releases_in_s and can_take_over.
  • 429Too many requests from your IP address. Wait the seconds in Retry-After.
Did this page help?