Skip to main content
Version: Next 🚧

User API

User List​

Retrieve the list of users.

GET /api/users

Parameters​

info

Authentication required and the user must have global admin permissions.

Return body​

[
{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "dark",
"timezone": "Etc/UTC",
"role": "user"
},
{
"id": 7,
"username": "bar",
"email": "bar@zealot.com",
"locale": "zh-CN",
"appearance": "auto",
"timezone": "Asia/Shanghai",
"role": "developer"
}
]

Current User Detail​

Retrieve information about the authenticated user.

GET /api/users/me

Return body​

{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "dark",
"timezone": "Etc/UTC",
"role": "user"
}

Search user​

Search user by email.

GET /api/users/search

Parameters​

info

Authentication required and the user must have global admin permissions.

AttributeTypeRequiredDescription
emailStringtrueEmail

Return body​

[
{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "dark",
"timezone": "Etc/UTC",
"role": "user"
},
{
"id": 7,
"username": "bar",
"email": "bar@zealot.com",
"locale": "zh-CN",
"appearance": "auto",
"timezone": "Asia/Shanghai",
"role": "developer"
}
]

Create user​

Create a user by providing necessary parameters.

Parameters​

info

Authentication required and the user must have global admin permissions.

AttributeTypeRequiredDescription
usernameStringtrueUsername
emailStringtrueUser email
localStringfalseset user's language, defaults use global setting, options are en/zh-CN
appearanceStringfalseset user's appearance, defaults use global setting, options are light/dark/auto
timezoneStringfalseset user's timezone, defaults use global setting, avaiable value in the values of reference MAPPING constant.
roleStringfalseUser role, defaults to "user", options are user/developer/admin

Return body​

  • Return 422 if name is missing or empty.
  • Return 201 and response body
{
"id": 8,
"username": "user",
"email": "user@zealot.com",
"locale": "en",
"appearance": "auto",
"timezone": "Etc/GMT+12",
"role": "admin"
}

Edit User Information​

Edit the username, email, or role for a specified user ID.

PUT /api/users/:id

Parameters​

info

Authentication required and the user must have global admin permissions.

AttributeTypeRequiredDescription
idStringtrueUser ID
usernameStringtrueUsername
emailStringtrueUser email
localStringfalseset user's language, defaults use global setting, options are en/zh-CN
appearanceStringfalseset user's appearance, defaults use global setting, options are light/dark/auto
timezoneStringfalseset user's timezone, defaults use global setting, avaiable value in the values of reference MAPPING constant.
roleStringfalseUser role, defaults to "user", options are user/developer/admin

Return body​

{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "light",
"timezone": "America/Los_Angeles",
"role": "user"
}

Destroy user​

Delete a user from the Zealot system.

DELETE /api/users/:id

Parameters​

info

Authentication required and the user must have global admin permissions.

AttributeTypeRequiredDescription
idIntegertrueUser ID

Return body​

  • Return 404 if user not existed.
  • Return 200 if success.

Lock user​

Deactive a user to prevent them from logging in. This is useful when a user leaves the company.

POST /api/users/:id/lock

Parameters​

info

Authentication required and the user must have global admin permissions.

AttributeTypeRequiredDescription
idIntegertrueUser ID

Return body​

  • Return 404 if user not existed.
  • Return 202 if success.

Unlock user​

Active a user to allow them to log in.

DELETE /api/users/:id/unlock

Parameters​

info

Authentication required and the user must have global admin permissions.

AttributeTypeRequiredDescription
idIntegertrueUser ID

Return body​

  • Return 404 if user not existed.
  • Return 202 if success.