API Docs
Users

List all Users

10min

API Endpoint Documentation: /api/users

Description:

This endpoint allows you to fetch a list of users. You can optionally filter the users based on their type and search by keyword.

Endpoint:

Text


Query Parameters:

  • type: string Comma-separated list of user types to filter by (e.g., user, editor, admin). (Example shown above is for all basic users and editors)
  • keyword: string A keyword to search for users. Leave empty to return all users matching the specified types. (Example shown above is for case-insensitive "john")

Headers:

  • accept: application/json Specifies that the request expects a JSON response.
  • authorization: Bearer <JWT Token> A JSON Web Token (JWT) that authenticates the request. Replace <JWT Token> with a valid token.



Method:

  • GET: Sends a request to retrieve a list of users based on the specified filters and optional keyword search.

Example Request (Node.js):

JS


Response:

The API will return a JSON response containing user data matching the request filters.

Success Response (200):

JSON


Error Response (400/401):

JSON


Authentication:

This API requires a valid JWT token for authentication. Ensure that the token is included in the authorization header as Bearer <JWT Token>.

Usage Notes:

  • Ensure that the type parameter correctly filters users (e.g., user, editor, admin).
  • You can pass an empty keyword parameter to return all users of the specified type.
  • The request will return an error if the authorization token is invalid or missing.



Updated 09 Oct 2024
Doc contributor
Did this page help you?