LemursEye
Documentation
API

Change a user's roles

PUThttps://lemurseye.com/api/v1/users/{id}/roles

Replaces the person's roles with exactly the list you send. An empty list leaves them able to sign in but see nothing.

Two rules keep the company from locking itself out: you cannot remove your own owner role, and the company must keep at least one active owner (one who is not suspended and has set a password).

Permission: users:write (a person only, never an API key). The token is sent as Authorization: Bearer <token>; see Authentication.

Path parameters

  • idstringrequired

    The user's id.

Body (JSON)

  • rolesstring[]required

    The full new set: owner, manager, viewer, installer.

Response

200

The person, with their new roles.

Response fields

  • idstring

    The user's id.

  • emailstring

    Their sign-in email.

  • namestring | null

    Full name.

  • enabledboolean

    false when suspended: they cannot sign in.

  • pendingPasswordboolean

    true until they accept the invitation and choose a password.

  • rolesstring[]

    Their roles in your company: owner, manager, viewer, installer.

  • lastSeenAttimestamp | null

    Their last activity, or null if they have never signed in.

Errors

A refusal by the rules comes back as { "error": "...", "code": "..." }: branch on code, show error. Where no message is listed, only the status code is returned.

  • 404

    No user with this id in your company (a user of another company answers the same, so ids cannot be probed).

  • 400

    A role is not one your company can assign.

  • 403
    selfyou cannot remove your own owner role

    You tried to drop owner from yourself.

  • 409
    last_ownerThis is the company's only active owner. Make someone else owner first, so the company is never left without one.

    It would leave no active owner.

  • 401

    No token, or it has expired.

  • 403

    The token lacks the permission above.