Fetch User Suggestions
Endpoint
URL: /:projectId/users/suggestions
Method: GET
Authentication Required: No
Description
Fetch a list of up to 5 suggested users based on a query string. Useful for mention systems or user pickers.
Request
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
query | string | Yes | The input string used to search usernames. |
Headers
None
Body Parameters
None
Example Request
GET /proj1234/users/suggestions?query=john
Response
Success Response (200 OK)
[
{
"id": "67890",
"username": "johndoe",
"name": "John Doe",
"avatar": "https://example.com/avatar.jpg"
},
{
"id": "54321",
"username": "johnny",
"name": "Johnny Appleseed",
"avatar": "https://example.com/avatar2.jpg"
}
]
Error Responses
Missing or Invalid Query Parameter (400 Bad Request)
{
"error": "Missing or invalid query parameter",
"code": "user/invalid-query"
}
Server Error (500 Internal Server Error)
{
"error": "Internal server error",
"code": "user/server-error",
"details": "<Error message>"
}
Notes
- Maximum of 5 results are returned.
- Usernames starting with the query are ranked higher.
- Returned user objects exclude sensitive fields (email, hash, etc.).