Skip to content
undertext developers
Skip to Content
undertext developers
REST API

Members

Decide who can open a document and with which role, and transfer ownership.

Members are the users who can open a document, each with a role. Your sharing screens decide who gets in; these endpoints tell Undertext, which enforces the role in the editor and for each person's agents. People who aren't members can still open a document through its link access. See Documents and access.

RoleCan
ownerEverything an editor can, and seal the document. A document has one or more owners, and always at least one.
editorWrite, accept and reject suggestions, comment. Can turn on suggesting for themselves.
suggesterPropose changes as suggestions and comment. Every edit they make is a suggestion.
viewerRead, and see comments.

A person's agents never get more than the person's own role, and never ownership. When you lower someone's role, their agents' access drops with it.

The member object

AttributeTypeDescription
documentstringThe document's id.
userstringThe member's Undertext id.
namestringThe user's current name.
rolestringowner, editor, suggester or viewer.
added_attimestampWhen they became a member.
{
  "document": "doc_8Hq2Lm4R",
  "user": "usr_9Tb3Wc1X",
  "name": "Grace Hopper",
  "role": "suggester",
  "added_at": "2026-10-13T22:05:17Z"
}

List members

GET /v1/documents/{document_id}/members

The document's members, owners first, then in the order they were added.

ParameterTypeDescription
document_idstring, path, requiredThe document's id.
limitinteger1 to 100. Default 50.
afterstringThe next cursor from the previous page.
curl https://api.undertext.sh/v1/documents/doc_8Hq2Lm4R/members \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY"
{
  "data": [
    {
      "document": "doc_8Hq2Lm4R",
      "user": "usr_5Kq2Lm8R",
      "name": "Ada Lovelace",
      "role": "owner",
      "added_at": "2026-10-13T21:12:40Z"
    },
    {
      "document": "doc_8Hq2Lm4R",
      "user": "usr_9Tb3Wc1X",
      "name": "Grace Hopper",
      "role": "suggester",
      "added_at": "2026-10-13T22:05:17Z"
    }
  ],
  "next": null
}

Add or change a member

PUT /v1/documents/{document_id}/members/{user_id}

Adds the user as a member with role, or changes their role if they're one already. The change reaches open editors at once: someone made a suggester mid-sentence carries on writing as suggestions.

Setting role to owner makes them an owner too; the others stay owners. To hand a document over, make the new person an owner, then lower the old owner's role or remove them. A member added again comes out of their own trash.

ParameterTypeDescription
document_idstring, path, requiredThe document's id.
user_idstring, path, requiredThe user's Undertext id. The user must exist.
rolestring, requiredowner, editor, suggester or viewer.
curl https://api.undertext.sh/v1/documents/doc_8Hq2Lm4R/members/usr_9Tb3Wc1X \
  -X PUT \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"role": "suggester"}'

Returns the member: 201 when they were added, 200 when their role changed.

{
  "document": "doc_8Hq2Lm4R",
  "user": "usr_9Tb3Wc1X",
  "name": "Grace Hopper",
  "role": "suggester",
  "added_at": "2026-10-13T22:05:17Z"
}
ErrorWhen
404 user_not_foundThe user doesn't exist. Create them with PUT /v1/users/external/{external_id} first.
409 last_ownerYou tried to give the only owner a lower role. Make someone else an owner first.
409 document_trashedThe document is in the trash.

Remove a member

DELETE /v1/documents/{document_id}/members/{user_id}

Takes away a member's access. Their open editors close, and their agents lose the document. What they wrote stays credited to them.

People can still reach the document through link access afterwards if its link_access lets them in and you start a session for them with via: "link".

ParameterTypeDescription
document_idstring, path, requiredThe document's id.
user_idstring, path, requiredThe user's Undertext id.
curl https://api.undertext.sh/v1/documents/doc_8Hq2Lm4R/members/usr_9Tb3Wc1X \
  -X DELETE \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY"
{
  "document": "doc_8Hq2Lm4R",
  "user": "usr_9Tb3Wc1X",
  "removed": true
}
ErrorWhen
404 member_not_foundThe user isn't a member.
409 last_ownerThe user is the only owner. Make someone else an owner first, or delete the document.

On this page