DevelopersHow to connect an assistantKeys
Reference/People/Change

Change a person's role

PATCHhttps://api.getwerk.ai/api/v1/projects/{projectId}/people/{personId}

Makes a person of the project an admin, or an admin a member.

The owner and the admins allowed to name admins may do it. A person who is not in the project is refused as not_permitted.

Authorization

AuthorizationheaderRequired

Authorization: Bearer <key> Authentication

Path parameters

projectIdstring, uuidRequired

The project's id.

personIdstring, uuidRequired

The person's id.

Body

clientRequestIdstring, uuidRequired

An id the caller makes for this request. Sent again with the same request, it returns the first answer and changes nothing twice; sent with a different request, it is refused.

roleenumRequired

The person's new role.

Allowed valuesadminmember

Response

200 The project's people after the change.

capabilitiesobject

What the key's person may do with the project now.

Show properties of capabilitiesHide properties of capabilities
inviteboolean

True when the key's person may invite people to the project.

managePeopleboolean

True when they may manage the project's people.

changeRolesboolean

True when they may make a person an admin or a member.

removePeopleboolean

True when they may remove people from the project.

editListsboolean

True when they may change the project's steps.

archiveboolean

True when they may archive the project.

restoreboolean

True when they may bring the project back from the archive.

deleteboolean

True when they may delete the project.

transferOwnershipboolean

True when they may hand the project to another person and leave it.

renameboolean

True when they may rename the project.

changePhotoboolean

True when they may change the project's photo.

leaveboolean

True when they may leave the project.

peopleVersioninteger

The version of the project's people, which changes whenever its people do.

At least 1
peoplearray of objects

The project's people.

Show properties of peopleHide properties of people
idstring, uuid

The person's id.

namestring

The person's name, as they set it.

From 1 to 128 characters
roleenum

The person's role in the project.

Allowed valuesowneradminmembercollaborator
formenum

The grammatical gender of the person's role name in the reader's language; not sent today.

Allowed valuesfemininemasculine
emailobject

The person's verified email, which everyone in the project sees.

Show properties of emailHide properties of email

One of 2 shapes, told apart by kind:

kindaddress
kindenum

address for an email shown as is, private_relay for an Apple address the person keeps hidden.

Allowed valuesaddress
addressstring, email

The email address.

kindprivate_relay
kindenum

address for an email shown as is, private_relay for an Apple address the person keeps hidden.

Allowed valuesprivate_relay
isYouboolean

True for the key's own person.

actionsobject

What the key's person may do to this person now.

Show properties of actionsHide properties of actions
changeRoleToarray of enums

The roles the key's person may give this person now.

Allowed valuesadminmember
removeboolean

True when the key's person may remove this person from the project.

receiveOwnershipboolean

True when the key's person may hand the project to this person and leave it.

photoobject

The person's photo, when they have one.

Show properties of photoHide properties of photo
personIdstring, uuid

The person whose photo it is.

versioninteger

The photo's version, which changes with the photo; its read takes it to fetch the current one.

At least 1
configVersioninteger

The version of the project's settings; leaving a project as its owner sends it as expectedConfigVersion.

At least 1

Errors

400invalid_queryThe query is not in the form the route takes; the limit is in the unit of the input details.field names (characters for a text, entries for a list, the value for a number).
400invalid_people_requestThe people request is not in the form the route takes; the limit is in the unit of the input details.field names (characters for a text, entries for a list, the value for a number).
401session_revokedThe request carries no session the server holds, or its session has ended.
401session_expiredThe session has expired.
403not_permittedThe signed-in person's role, or whose the record is, does not allow this request.
404conversation_not_foundThe project the request names, or its chat, is not one the signed-in person is in.
404person_not_foundThe person the request is about is not one the signed-in person can reach.
409session_changedThe session changed while the request was in flight.
409project_deletedThe project is being deleted.
409project_archivedThe project is archived, so it does not take this request.
409request_conflictThe request id was already used with another request, or the change it asks could not be made to the record it names.
409request_erasedThe request id belongs to a request whose record was erased.
413payload_too_largeThe request body has more bytes than the route takes.
rate_limitedMore requests of this kind were sent than Werk takes within the time it counts them over.
500server_errorThe server could not complete the request, and it is not known whether a write it holds was made.
curl
curl -X PATCH "https://api.getwerk.ai/api/v1/projects/2f6c9e41-7a3b-4d58-9c1e-0b8d4f2a6e73/people/c4b7e9a1-2d6f-4c83-b5a0-7e1f3d9c2b64" \
  -H "Authorization: Bearer wk_key_..." \
  -H "Content-Type: application/json" \
  -d '{
    "clientRequestId": "f1e2d3c4-b5a6-4978-8a9b-0c1d2e3f4d01",
    "role": "admin"
  }'
TypeScript
const res = await fetch("https://api.getwerk.ai/api/v1/projects/2f6c9e41-7a3b-4d58-9c1e-0b8d4f2a6e73/people/c4b7e9a1-2d6f-4c83-b5a0-7e1f3d9c2b64", {
  method: "PATCH",
  headers: {
    Authorization: "Bearer wk_key_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "clientRequestId": "f1e2d3c4-b5a6-4978-8a9b-0c1d2e3f4d01",
    "role": "admin"
  }),
});
const answer = await res.json();
200JSON
{
  "peopleVersion": 3,
  "configVersion": 6,
  "people": [
    {
      "id": "5d1f3a2e-8c4b-4e7a-9f21-3b6c8d0e1a42",
      "name": "Maya Chen",
      "role": "owner",
      "email": {
        "kind": "address",
        "address": "maya@harborstreet.example"
      },
      "isYou": true,
      "photo": {
        "personId": "5d1f3a2e-8c4b-4e7a-9f21-3b6c8d0e1a42",
        "version": 1
      }
    },
    {
      "id": "8a2e6c14-3f5d-4b9a-a7e2-61c0d9f4b3e8",
      "name": "Tom Okafor",
      "role": "admin",
      "email": {
        "kind": "address",
        "address": "tom@harborstreet.example"
      },
      "isYou": false,
      "actions": {
        "changeRoleTo": [
          "member"
        ],
        "remove": true,
        "receiveOwnership": true
      }
    },
    {
      "id": "c4b7e9a1-2d6f-4c83-b5a0-7e1f3d9c2b64",
      "name": "Lucia Ferraro",
      "role": "member",
      "email": {
        "kind": "address",
        "address": "lucia@harborstreet.example"
      },
      "isYou": false,
      "actions": {
        "changeRoleTo": [
          "admin"
        ],
        "remove": true,
        "receiveOwnership": true
      }
    }
  ]
}