weChess Multiplayer Chess Platform - REST API Reference
Complete REST API documentation for all services in weChess Multiplayer Chess Platform
This document provides comprehensive REST API documentation for all services. Use this reference to understand available endpoints, request/response formats, and authentication requirements.
Table of Contents
- Introduction
- Auth Service REST API
- Gameplay Service REST API
- LobbyChat Service REST API
- Leaderboard Service REST API
- AgentHub Service REST API
- Bff Service REST API
- Notification Service REST API
Introduction
weChess Multiplayer Chess Platform
Version : 1.0.174
weChess is a real-time multiplayer chess platform featuring lobby and in-game chat, leaderboards, and support for both guest and registered players. The system provides chat moderation, matchmaking (public and private games), ongoing/resumable matches, and administrative tools for game and user management.
How to Use Project Documents
The Wechess project has been designed and generated using Mindbricks, a powerful microservice-based backend generation platform. All documentation is automatically produced by the Mindbricks Genesis Engine, based on the high-level architectural patterns defined by the user or inferred by AI.
This documentation set is intended for both AI agents and human developers—including frontend and backend engineers—who need precise and structured information about how to interact with the backend services of this project. Each document reflects the live architecture of the system, providing a reliable reference for API consumption, data models, authentication flows, and business logic.
By following this documentation, developers can seamlessly integrate with the backend, while AI agents can use it to reason about the service structure, make accurate decisions, or even generate compatible client-side code.
Accessing Project Services
Each service generated by Mindbricks is exposed via a dedicated REST API endpoint. Every service documentation set includes the base URL of that service along with the specific API paths for each available route.
Before consuming any API, developers or agents must understand the service URL structure and environment-specific endpoints.
Service Endpoint Structure
| Environment | URL Pattern Example |
|---|---|
| Preview | https://wechess.prw.mindbricks.com/auth-api |
| Staging | https://wechess-stage.mindbricks.co/auth-api |
| Production | https://wechess.mindbricks.co/auth-api |
Replace auth with the actual service name as lower case (e.g., order-api, bff-service, customermanagement-api etc.).
Environment Usage Notes
- Preview APIs become accessible after a project is previewed inside the Mindbricks platform. These are ideal for development and testing.
- Staging and Production APIs are only accessible after the project is deployed to cloud environments provisioned via Mindbricks.
- In some cases, the project owner may choose to deploy services on their own infrastructure. In such scenarios, the service base URLs will be custom and should be communicated manually by the project owner to developers or AI agents.
Frontend applications should be designed to easily switch between environments, allowing dynamic endpoint targeting for Preview, Staging, and Production.
Getting Started: Use the Auth Service First
Before interacting with other services in the Wechess project, AI agents and developers should begin by integrating with the Auth Service.
Mindbricks automatically generates a dedicated authentication microservice based on the project’s authentication definitions provided by the architect. This service provides the essential user and access management foundation for the project.
Agents should first utilize the Auth Service to:
- Register and authenticate users (login)
- Manage users, roles, and permissions
- Handle user groups (if defined)
- Support multi-tenancy logic (if configured)
- Perform Policy-Based Access Control (PBAC), if activated by the architect
Auth Service Documentation
Use the following resources to understand and integrate the Auth Service:
-
REST API Guide – ideal for frontend and direct HTTP usage
Auth REST API Guide -
Event Guide – helpful for event-driven or cross-service integrations
Auth Event Guide -
Service Design Document – overall structure, patterns, and logic
Auth Service Design
Note: For most frontend use cases, the REST API Guide will be the primary source. The Event Guide and Service Design documents are especially useful when integrating with other backend microservices or building systems that interact with the auth service indirectly.
Using the BFF (Backend-for-Frontend) Service
In Mindbricks, all backend services are designed with an advanced CQRS (Command Query Responsibility Segregation) architecture. Within this architecture, business services are responsible for managing their respective domains and ensuring the accuracy and freshness of domain data.
The BFF service complements these business services by providing a read-only aggregation and query layer tailored specifically for frontend and client-side applications.
Key Principles of the BFF Service
-
Elasticsearch Replicas for Fast Queries:
Each data object managed by a business service is automatically replicated as an Elasticsearch index, making it accessible for fast, frontend-oriented queries through the BFF. -
Cross-Service Data Aggregation:
The BFF offers an aggregation layer capable of combining data across multiple services, enabling complex filters, searches, and unified views of related data. -
Read-Only by Design:
The BFF service is strictly read-only. All create, update, or delete operations must be performed through the relevant business services, or via event-driven sagas if designed.
BFF Service Documentation
-
REST API Guide – querying aggregated and indexed data
BFF REST API Guide -
Event Guide – syncing strategies across replicas
BFF Event Guide -
Service Design – aggregation patterns and index structures
BFF Service Design
Tip: Use the BFF service as the main entry point for all frontend data queries. It simplifies access, reduces round-trips, and ensures that data is shaped appropriately for the UI layer.
Business Services Overview
The weChess Multiplayer Chess Platform project consists of multiple business services, each responsible for managing a specific domain within the system. These services expose their own REST APIs and documentation sets, and are accessible based on the environment (Preview, Staging, Production).
Usage Guidance
Business services are primarily designed to:
- Handle the state and operations of domain data
- Offer Create, Update, Delete operations over owned entities
- Serve direct data queries (
get,list) for their own objects when needed
For advanced query needs across multiple services or aggregated views, prefer using the BFF service.
Available Business Services
gameplay Service
Description: Service for managing real-time chess games, matchmaking, move history, and private invitations, including lifecycle management (mutual game-save/resume, admin termination), supporting both guest and registered users. Enables API access for reviewing games, enforcing moderation actions, and tracking game results.
Documentation:
Base URL Examples:
| Environment | URL |
|---|---|
| Preview | https://wechess.prw.mindbricks.com/gameplay-api |
| Staging | https://wechess-stage.mindbricks.co/gameplay-api |
| Production | https://wechess.mindbricks.co/gameplay-api |
lobbyChat Service
Description: Public lobby chat microservice. Manages create, list, reporting, moderation, and 24-hour message expiry for guest/registered users.
Documentation:
Base URL Examples:
| Environment | URL |
|---|---|
| Preview | https://wechess.prw.mindbricks.com/lobbychat-api |
| Staging | https://wechess-stage.mindbricks.co/lobbychat-api |
| Production | https://wechess.mindbricks.co/lobbychat-api |
leaderboard Service
Description: Handles ELO/stat computation and leaderboard management for registered players only. Excludes guest users entirely.
Documentation:
Base URL Examples:
| Environment | URL |
|---|---|
| Preview | https://wechess.prw.mindbricks.com/leaderboard-api |
| Staging | https://wechess-stage.mindbricks.co/leaderboard-api |
| Production | https://wechess.mindbricks.co/leaderboard-api |
agentHub Service
Description: AI Agent Hub
Documentation:
Base URL Examples:
| Environment | URL |
|---|---|
| Preview | https://wechess.prw.mindbricks.com/agenthub-api |
| Staging | https://wechess-stage.mindbricks.co/agenthub-api |
| Production | https://wechess.mindbricks.co/agenthub-api |
Connect via MCP (Model Context Protocol)
All backend services in the Wechess project expose their Business APIs as MCP tools. These tools are aggregated by the MCP-BFF service into a single unified endpoint that external AI tools can connect to.
Unified MCP Endpoint
| Environment | StreamableHTTP (recommended) | SSE (legacy fallback) |
|---|---|---|
| Preview | https://wechess.prw.mindbricks.com/mcpbff-api/mcp |
https://wechess.prw.mindbricks.com/mcpbff-api/mcp/sse |
| Staging | https://wechess-stage.mindbricks.co/mcpbff-api/mcp |
https://wechess-stage.mindbricks.co/mcpbff-api/mcp/sse |
| Production | https://wechess.mindbricks.co/mcpbff-api/mcp |
https://wechess.mindbricks.co/mcpbff-api/mcp/sse |
Authentication
MCP connections require authentication via the Authorization header:
- API Key (recommended for AI agents):
Authorization: Bearer sk_mbx_your_api_key_hereAPI keys are long-lived and don’t expire like JWT tokens. Create one from the profile page. - JWT Token:
Authorization: Bearer {accessToken}Use a valid access token obtained from the login API.
OAuth is not supported for MCP connections at this time.
Connecting from Cursor
Add the following to your project’s .cursor/mcp.json:
{
"mcpServers": {
"wechess": {
"url": "https://wechess.prw.mindbricks.com/mcpbff-api/mcp",
"headers": {
"Authorization": "Bearer sk_mbx_your_api_key_here"
}
}
}
}
Connecting from Claude Desktop
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"wechess": {
"url": "https://wechess.prw.mindbricks.com/mcpbff-api/mcp",
"headers": {
"Authorization": "Bearer sk_mbx_your_api_key_here"
}
}
}
}
What’s Available
Once connected, the AI tool can discover and call all Business API tools from all services — CRUD operations, custom queries, file operations, and more. The MCP-BFF handles routing each tool call to the correct backend service and propagates your authentication context.
Conclusion
This documentation set provides a comprehensive guide for understanding and consuming the weChess Multiplayer Chess Platform backend, generated by the Mindbricks platform. It is structured to support both AI agents and human developers in navigating authentication, data access, service responsibilities, and system architecture.
To summarize:
- Start with the Auth Service to manage users, roles, sessions, and permissions.
- Use the BFF Service for optimized, read-only data queries and cross-service aggregation.
- Refer to the Business Services when you need to manage domain-specific data or perform direct CRUD operations.
Each service offers a complete set of documentation—REST API guides, event interface definitions, and design insights—to help you integrate efficiently and confidently.
Whether you are building a frontend application, configuring an automation agent, or simply exploring the architecture, this documentation is your primary reference for working with the backend of this project.
For environment-specific access, ensure you’re using the correct base URLs (Preview, Staging, Production), and coordinate with the project owner for any custom deployments.
Service API Documentation
REST API GUIDE
wechess-auth-service
Version: 1.0.29
Authentication service for the project
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to . For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the Auth Service’s REST API. This document is designed to provide a comprehensive guide to interfacing with our Auth Service exclusively through RESTful API endpoints.
Intended Audience
This documentation is intended for developers and integrators who are looking to interact with the Auth Service via HTTP requests for purposes such as creating, updating, deleting and querying Auth objects.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST It’s important to note that the Auth Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Authentication And Authorization
To ensure secure access to the Auth service’s protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it’s important to note that access control varies across different routes:
Protected API: Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **: The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
|---|---|
| Query | access_token |
| Authorization Header | Bearer |
| Header | wechess-access-token |
| Cookie | wechess-access-token |
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
Api Definitions
This section outlines the API endpoints available within the Auth service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It’s important to understand the flexibility in how parameters can be included in requests to effectively interact with the Auth service.
This service is configured to listen for HTTP requests on port 3011,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
- API Test Interface (API Face):
/ - Swagger Documentation:
/swagger - Postman Collection Download:
/getPostmanCollection - Health Checks:
/healthand/admin/health - Current Session Info:
/currentuser - Favicon:
/favicon.ico
This service is accessible via the following environment-specific URLs:
- Preview:
https://wechess.prw.mindbricks.com/auth-api - Staging:
https://wechess-stage.mindbricks.co/auth-api - Production:
https://wechess.mindbricks.co/auth-api
Parameter Inclusion Methods: Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
Query Parameters: Included directly in the URL’s query string.
Path Parameters: Embedded within the URL’s path.
Body Parameters: Sent within the JSON body of the request.
Session Parameters: Automatically read from the session object. This method is used for parameters that are intrinsic to the user’s session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
Note on Session Parameters: Session parameters represent a unique method of parameter inclusion, relying on the context of the user’s session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the Auth service’s API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
Common Parameters
The Auth service’s business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
Supported Common Parameters:
-
getJoins (BOOLEAN): Controls whether to retrieve associated objects along with the main object. By default,
getJoinsis assumed to betrue. Set it tofalseif you prefer to receive only the main fields of an object, excluding its associations. -
excludeCQRS (BOOLEAN): Applicable only when
getJoinsistrue. By default,excludeCQRSis set tofalse. Enabling this parameter (true) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage. -
requestId (String): Identifies a request to enable tracking through the service’s log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom
requestId, simply include it in your query parameters. -
caching (BOOLEAN): Determines the use of caching for query API. By default, caching is enabled (
true). To ensure the freshest data directly from the database, set this parameter tofalse, bypassing the cache. -
cacheTTL (Integer): Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for
get listqueries. Setting a customcacheTTLallows you to fine-tune the cache lifespan to meet your needs. -
pageNumber (Integer): For paginated
get listAPI’s, this parameter selects which page of results to retrieve. The default is1, indicating the first page. To disable pagination and retrieve all results, setpageNumberto0. -
pageRowCount (Integer): In conjunction with paginated API’s, this parameter defines the number of records per page. The default value is
25. AdjustingpageRowCountallows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the Auth service.
Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- 401 Unauthorized: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Object Structure of a Successfull Response
When the Auth service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
Key Characteristics of the Response Envelope:
-
Data Presentation: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- Creation and Update API: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- Delete API: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- Get Requests: A single data object is returned in JSON format.
- Get List Requests: An array of data objects is provided, reflecting a collection of resources.
-
Data Structure and Joins: The complexity of the data structure in the response can vary based on the API’s architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- Pure Data Forms: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- Extended Data Forms: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- Join Varieties: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
Design Considerations: The structure of a API’s response data is meticulously crafted during the service’s architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
Brief Data: Certain API’s return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
HTTP Status Codes:
- 200 OK: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- 201 Created: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
Success Response Format:
For successful operations, the response includes a "status": "OK" property, signaling the successful execution of the request. The structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
Handling Errors:
For details on handling error scenarios and understanding the structure of error responses, please refer to the “Error Response” section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
Resources
Auth service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
User resource
Resource Definition : A data object that stores the user information and handles login settings. User Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| String | * A string value to represent the user's email.* | |||
| password | String | * A string value to represent the user's password. It will be stored as hashed.* | ||
| fullname | String | A string value to represent the fullname of the user | ||
| avatar | String | The avatar url of the user. A random avatar will be generated if not provided | ||
| roleId | String | A string value to represent the roleId of the user. | ||
| emailVerified | Boolean | A boolean value to represent the email verification status of the user. |
UserAvatarsFile resource
Resource Definition : Auto-generated file storage for the userAvatars database bucket. Files are stored as BYTEA in PostgreSQL. UserAvatarsFile Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| fileName | String | Original file name as uploaded by the client. | ||
| mimeType | String | MIME type of the uploaded file (e.g., image/png, application/pdf). | ||
| fileSize | Integer | File size in bytes. | ||
| accessKey | String | 12-character random key for shareable access. Auto-generated on upload. | ||
| ownerId | ID | ID of the user who uploaded the file (from session). | ||
| fileData | Blob | Binary file content. Stored as BYTEA in PostgreSQL or Buffer in MongoDB. | ||
| metadata | Object | Optional JSON metadata for the file (tags, alt text, etc.). | ||
| userId | ID | Reference to the owner user record. |
Business Api
Get User API
This api is used by admin roles or the users themselves to get the user profile information.
Rest Route
The getUser API REST controller can be triggered via the following route:
/v1/users/:userId
Rest Request Parameters
The getUser api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/users/:userId
axios({
method: 'GET',
url: `/v1/users/${userId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update User API
This route is used by admins to update user profiles.
Rest Route
The updateUser API REST controller can be triggered via the following route:
/v1/users/:userId
Rest Request Parameters
The updateUser api has got 3 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| fullname | String | false | request.body?.[“fullname”] |
| avatar | String | false | request.body?.[“avatar”] |
| userId : This id paremeter is used to select the required data object that will be updated | |||
| fullname : A string value to represent the fullname of the user | |||
| avatar : The avatar url of the user. A random avatar will be generated if not provided |
REST Request To access the api you can use the REST controller with the path PATCH /v1/users/:userId
axios({
method: 'PATCH',
url: `/v1/users/${userId}`,
data: {
fullname:"String",
avatar:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Profile API
This route is used by users to update their profiles.
Rest Route
The updateProfile API REST controller can be triggered via the following route:
/v1/profile/:userId
Rest Request Parameters
The updateProfile api has got 3 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| fullname | String | false | request.body?.[“fullname”] |
| avatar | String | false | request.body?.[“avatar”] |
| userId : This id paremeter is used to select the required data object that will be updated | |||
| fullname : A string value to represent the fullname of the user | |||
| avatar : The avatar url of the user. A random avatar will be generated if not provided |
REST Request To access the api you can use the REST controller with the path PATCH /v1/profile/:userId
axios({
method: 'PATCH',
url: `/v1/profile/${userId}`,
data: {
fullname:"String",
avatar:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Create User API
This api is used by admin roles to create a new user manually from admin panels
Rest Route
The createUser API REST controller can be triggered via the following route:
/v1/users
Rest Request Parameters
The createUser api has got 4 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| avatar | String | false | request.body?.[“avatar”] |
| String | true | request.body?.[“email”] | |
| password | String | true | request.body?.[“password”] |
| fullname | String | true | request.body?.[“fullname”] |
| avatar : The avatar url of the user. If not sent, a default random one will be generated. | |||
| email : A string value to represent the user’s email. | |||
| password : A string value to represent the user’s password. It will be stored as hashed. | |||
| fullname : A string value to represent the fullname of the user |
REST Request To access the api you can use the REST controller with the path POST /v1/users
axios({
method: 'POST',
url: '/v1/users',
data: {
avatar:"String",
email:"String",
password:"String",
fullname:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete User API
This api is used by admins to delete user profiles.
Rest Route
The deleteUser API REST controller can be triggered via the following route:
/v1/users/:userId
Rest Request Parameters
The deleteUser api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/users/:userId
axios({
method: 'DELETE',
url: `/v1/users/${userId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Archive Profile API
This api is used by users to archive their profiles.
Rest Route
The archiveProfile API REST controller can be triggered via the following route:
/v1/archiveprofile/:userId
Rest Request Parameters
The archiveProfile api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/archiveprofile/:userId
axios({
method: 'DELETE',
url: `/v1/archiveprofile/${userId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Users API
The list of users is filtered by the tenantId.
Rest Route
The listUsers API REST controller can be triggered via the following route:
/v1/users
Rest Request Parameters
Filter Parameters
The listUsers api supports 3 optional filter parameters for filtering list results:
email (String): A string value to represent the user’s email.
- Single (partial match, case-insensitive):
?email=<value> - Multiple:
?email=<value1>&email=<value2> - Null:
?email=null
fullname (String): A string value to represent the fullname of the user
- Single (partial match, case-insensitive):
?fullname=<value> - Multiple:
?fullname=<value1>&fullname=<value2> - Null:
?fullname=null
roleId (String): A string value to represent the roleId of the user.
- Single (partial match, case-insensitive):
?roleId=<value> - Multiple:
?roleId=<value1>&roleId=<value2> - Null:
?roleId=null
REST Request To access the api you can use the REST controller with the path GET /v1/users
axios({
method: 'GET',
url: '/v1/users',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// email: '<value>' // Filter by email
// fullname: '<value>' // Filter by fullname
// roleId: '<value>' // Filter by roleId
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "users",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"users": [
{
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Search Users API
The list of users is filtered by the tenantId.
Rest Route
The searchUsers API REST controller can be triggered via the following route:
/v1/searchusers
Rest Request Parameters
The searchUsers api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| keyword | String | true | request.query?.[“keyword”] |
| keyword : |
Filter Parameters
The searchUsers api supports 1 optional filter parameter for filtering list results:
roleId (String): A string value to represent the roleId of the user.
- Single (partial match, case-insensitive):
?roleId=<value> - Multiple:
?roleId=<value1>&roleId=<value2> - Null:
?roleId=null
REST Request To access the api you can use the REST controller with the path GET /v1/searchusers
axios({
method: 'GET',
url: '/v1/searchusers',
data: {
},
params: {
keyword:'"String"',
// Filter parameters (see Filter Parameters section above)
// roleId: '<value>' // Filter by roleId
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "users",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"users": [
{
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Update Userrole API
This route is used by admin roles to update the user role.The default role is user when a user is registered. A user’s role can be updated by superAdmin or admin
Rest Route
The updateUserRole API REST controller can be triggered via the following route:
/v1/userrole/:userId
Rest Request Parameters
The updateUserRole api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| roleId | String | true | request.body?.[“roleId”] |
| userId : This id paremeter is used to select the required data object that will be updated | |||
| roleId : The new roleId of the user to be updated |
REST Request To access the api you can use the REST controller with the path PATCH /v1/userrole/:userId
axios({
method: 'PATCH',
url: `/v1/userrole/${userId}`,
data: {
roleId:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Userpassword API
This route is used to update the password of users in the profile page by users themselves
Rest Route
The updateUserPassword API REST controller can be triggered via the following route:
/v1/userpassword/:userId
Rest Request Parameters
The updateUserPassword api has got 3 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| oldPassword | String | true | request.body?.[“oldPassword”] |
| newPassword | String | true | request.body?.[“newPassword”] |
| userId : This id paremeter is used to select the required data object that will be updated | |||
| oldPassword : The old password of the user that will be overridden bu the new one. Send for double check. | |||
| newPassword : The new password of the user to be updated |
REST Request To access the api you can use the REST controller with the path PATCH /v1/userpassword/:userId
axios({
method: 'PATCH',
url: `/v1/userpassword/${userId}`,
data: {
oldPassword:"String",
newPassword:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Userpasswordbyadmin API
This route is used to change any user password by admins only. Superadmin can chnage all passwords, admins can change only nonadmin passwords
Rest Route
The updateUserPasswordByAdmin API REST controller can be triggered via the following route:
/v1/userpasswordbyadmin/:userId
Rest Request Parameters
The updateUserPasswordByAdmin api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| password | String | true | request.body?.[“password”] |
| userId : This id paremeter is used to select the required data object that will be updated | |||
| password : The new password of the user to be updated |
REST Request To access the api you can use the REST controller with the path PATCH /v1/userpasswordbyadmin/:userId
axios({
method: 'PATCH',
url: `/v1/userpasswordbyadmin/${userId}`,
data: {
password:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Briefuser API
This route is used by public to get simple user profile information.
Rest Route
The getBriefUser API REST controller can be triggered via the following route:
/v1/briefuser/:userId
Rest Request Parameters
The getBriefUser api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/briefuser/:userId
axios({
method: 'GET',
url: `/v1/briefuser/${userId}`,
data: {
},
params: {
}
});
REST Response
This route’s response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"user": {
"isActive": true
}
}
Stream Test API
Test API for iterator action streaming via SSE.
Rest Route
The streamTest API REST controller can be triggered via the following route:
/v1/streamtest/:userId
Rest Request Parameters
The streamTest api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/streamtest/:userId
axios({
method: 'GET',
url: `/v1/streamtest/${userId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Register User API
This api is used by public users to register themselves
Rest Route
The registerUser API REST controller can be triggered via the following route:
/v1/registeruser
Rest Request Parameters
The registerUser api has got 4 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| avatar | String | false | request.body?.[“avatar”] |
| password | String | true | request.body?.[“password”] |
| fullname | String | true | request.body?.[“fullname”] |
| String | true | request.body?.[“email”] | |
| avatar : The avatar url of the user. If not sent, a default random one will be generated. | |||
| password : The password defined by the the user that is being registered. | |||
| fullname : The fullname defined by the the user that is being registered. | |||
| email : The email defined by the the user that is being registered. |
REST Request To access the api you can use the REST controller with the path POST /v1/registeruser
axios({
method: 'POST',
url: '/v1/registeruser',
data: {
avatar:"String",
password:"String",
fullname:"String",
email:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Useravatarsfile API
[Default get API] — This is the designated default get API for the userAvatarsFile data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The getUserAvatarsFile API REST controller can be triggered via the following route:
/v1/useravatarsfiles/:userAvatarsFileId
Rest Request Parameters
The getUserAvatarsFile api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userAvatarsFileId | ID | true | request.params?.[“userAvatarsFileId”] |
| userAvatarsFileId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/useravatarsfiles/:userAvatarsFileId
axios({
method: 'GET',
url: `/v1/useravatarsfiles/${userAvatarsFileId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userAvatarsFile",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userAvatarsFile": {
"id": "ID",
"fileName": "String",
"mimeType": "String",
"fileSize": "Integer",
"accessKey": "String",
"ownerId": "ID",
"fileData": "Blob",
"metadata": "Object",
"userId": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
List Useravatarsfiles API
[Default list API] — This is the designated default list API for the userAvatarsFile data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The listUserAvatarsFiles API REST controller can be triggered via the following route:
/v1/useravatarsfiles
Rest Request Parameters
Filter Parameters
The listUserAvatarsFiles api supports 3 optional filter parameters for filtering list results:
mimeType (String): MIME type of the uploaded file (e.g., image/png, application/pdf).
- Single (partial match, case-insensitive):
?mimeType=<value> - Multiple:
?mimeType=<value1>&mimeType=<value2> - Null:
?mimeType=null
ownerId (ID): ID of the user who uploaded the file (from session).
- Single:
?ownerId=<value> - Multiple:
?ownerId=<value1>&ownerId=<value2> - Null:
?ownerId=null
userId (ID): Reference to the owner user record.
- Single:
?userId=<value> - Multiple:
?userId=<value1>&userId=<value2> - Null:
?userId=null
REST Request To access the api you can use the REST controller with the path GET /v1/useravatarsfiles
axios({
method: 'GET',
url: '/v1/useravatarsfiles',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// mimeType: '<value>' // Filter by mimeType
// ownerId: '<value>' // Filter by ownerId
// userId: '<value>' // Filter by userId
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userAvatarsFiles",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"userAvatarsFiles": [
{
"id": "ID",
"fileName": "String",
"mimeType": "String",
"fileSize": "Integer",
"accessKey": "String",
"ownerId": "ID",
"fileData": "Blob",
"metadata": "Object",
"userId": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Delete Useravatarsfile API
[Default delete API] — This is the designated default delete API for the userAvatarsFile data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The deleteUserAvatarsFile API REST controller can be triggered via the following route:
/v1/useravatarsfiles/:userAvatarsFileId
Rest Request Parameters
The deleteUserAvatarsFile api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userAvatarsFileId | ID | true | request.params?.[“userAvatarsFileId”] |
| userAvatarsFileId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/useravatarsfiles/:userAvatarsFileId
axios({
method: 'DELETE',
url: `/v1/useravatarsfiles/${userAvatarsFileId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userAvatarsFile",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"userAvatarsFile": {
"id": "ID",
"fileName": "String",
"mimeType": "String",
"fileSize": "Integer",
"accessKey": "String",
"ownerId": "ID",
"fileData": "Blob",
"metadata": "Object",
"userId": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": false
}
}
Authentication Specific Routes
Route: login
Route Definition: Handles the login process by verifying user credentials and generating an authenticated session.
Route Type: login
Access Routes:
GET /login: Returns the HTML login page (not a frontend module, typically used in browser-based contexts for test purpose to make sending POST /login easier).POST /login: Accepts credentials, verifies the user, creates a session, and returns a JWT access token.
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| username | String | Yes | request.body.username |
| password | String | Yes | request.body.password |
Notes
- This route accepts login credentials and creates an authenticated session if credentials are valid.
- On success, the response will:
- Set a cookie named
projectname-access-token[-tenantCodename]with the JWT token. - Include the token in the response headers under the same name.
- Return the full
sessionobject in the JSON body. - Note that
usernameparameter should have the email of the user as value. You can also send anemailparameter instead ofusernameparameter. If both sent onlyusernameparameter will be read.
- Set a cookie named
// Sample POST /login call
axios.post("/login", {
username: "user@example.com",
password: "securePassword"
});
Success Response
Returns the authenticated session object with a status code 200 OK.
A secure HTTP-only cookie and an access token header are included in the response.
{
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
...
}
Error Responses
- 401 Unauthorized: Invalid username or password.
- 403 Forbidden: Login attempt rejected due to pending email/mobile verification or 2FA requirements.
- 400 Bad Request: Missing credentials in the request.
Route: logout
Route Definition: Logs the user out by terminating the current session and clearing the access token.
Route Type: logout
Access Route: POST /logout
Parameters
This route does not require any parameters in the body or query.
Behavior
- Invalidates the current session on the server (if stored).
- Clears the access token cookie (
projectname-access-token[-tenantCodename]) from the client. - Responds with a 200 status and a simple confirmation object.
// Sample POST /logout call
axios.post("/logout", {}, {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Notes
- This route is public, meaning it can be called without a session or token.
- If the session is active, the server will clear associated session state and cookies.
- The logout behavior may vary slightly depending on whether you’re using cookie-based or header-based token management.
Error Responses 00200 OK:** Always returned, regardless of whether a session existed. Logout is treated as idempotent.
Route: publickey
Route Definition: Returns the public RSA key used to verify JWT access tokens issued by the auth service.
Route Type: publicKeyFetch
Access Route: GET /publickey
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| keyId | String | No | request.query.keyId |
keyIdis optional.
If provided, retrieves the public key corresponding to the specifickeyId.
If omitted, retrieves the current active public key (global.currentKeyId).
Behavior
- Reads the requested RSA public key file from the server filesystem.
- If the key exists, returns it along with its
keyId. - If the key does not exist, returns a 404 error.
// Sample GET /publickey call
axios.get("/publickey", {
params: {
keyId: "currentKeyIdOptional"
}
});
Success Response Returns the active public key and its associated keyId.
{
"keyId": "a1b2c3d4",
"keyData": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhki...\n-----END PUBLIC KEY-----"
}
Error Responses 404 Not Found: Public key file could not be found on the server.
Token Key Management
Mindbricks uses RSA key pairs to sign and verify JWT access tokens securely.
While the auth service signs each token with a private key, other services within the system — or external clients — need the corresponding public key to verify the authenticity and integrity of received tokens.
The /publickey endpoint allows services and clients to dynamically fetch the currently active public key, ensuring that token verification remains secure even if key rotation is performed.
Note:
The/publickeyroute is not intended for direct frontend (browser) consumption.
Instead, it is primarily used by trusted backend services, APIs, or middleware systems that need to independently verify access tokens issued by the auth service — without making verification-dependent API calls to the auth service itself.
Accessing the public key is crucial for validating user sessions efficiently and maintaining a decentralized trust model across your platform.
Route: relogin
Route Definition: Performs a silent login by verifying the current access token, refreshing the session, and returning a new access token along with updated user information.
Route Type: sessionRefresh
Access Route: GET /relogin
Parameters
This route does not require any request parameters.
Behavior
- Validates the access token associated with the request.
- If the token is valid:
- Re-authenticates the user using the session’s user ID.
- Fetches the most up-to-date user information from the database.
- Generates a new session object with a new session ID and new access token.
- If the token is invalid or missing, returns a 401 Unauthorized error.
// Example call to refresh session
axios.get("/relogin", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response Returns a new session object, refreshed from database data.
{
"sessionId": "new-session-uuid",
"userId": "user-uuid",
"email": "user@example.com",
"roleId": "admin",
"accessToken": "new-jwt-token",
...
}
Error Responses
- 401 Unauthorized: Token is missing, invalid, or session cannot be re-established.
{
"status": "ERR",
"message": "Cannot relogin"
}
Notes
- The
/reloginroute is commonly used for silent login flows, especially after page reloads or token-based auto-login mechanisms. - It triggers internal logic (
req.userAuthUpdate = true) to signal that the session should be re-initialized and repopulated. - It is not a simple session lookup — it performs a fresh authentication pass using the session’s user context.
- The refreshed session ensures any updates to user profile, roles, or permissions are immediately reflected.
Tip: This route is ideal when you want to rebuild a user’s session in the frontend without requiring them to manually log in again.
Verification Services — Email Verification
Email verification is a two-step flow that ensures a user’s email address is verified and trusted by the system.
All verification services, including email verification, are located under the /verification-services base path.
When is Email Verification Triggered?
- After user registration, if
emailVerificationRequiredForLoginis active. - During a separate user action to verify or update email addresses.
- When login fails with
EmailVerificationNeededand frontend initiates verification.
Email Verification Flow
- Frontend calls
/verification-services/email-verification/startwith the user’s email address.- Mindbricks checks if the email is already verified.
- A secret code is generated and stored in the cache linked to the user.
- The code is sent to the user’s email or returned in the response (only in development environments for easier testing).
- User receives the code and enters it into the frontend application.
- Frontend calls
/verification-services/email-verification/completewith theemailand the receivedsecretCode.- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s
emailVerifiedflag is set totrue, and a success response is returned.
API Endpoints
POST /verification-services/email-verification/start
Purpose
Starts the email verification process by generating and sending a secret verification code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The email address to verify |
{
"email": "user@example.com"
}
Success Response
Secret code details (in development environment). Confirms that the verification step has been started.
{
"userId": "user-uuid",
"email": "user@example.com",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
⚠️ In production, the secret code is only sent via email, not exposed in the API response.
Error Responses
400 Bad Request: Email already verified.403 Forbidden: Sending a code too frequently (anti-spam).
POST /verification-services/email-verification/complete
Purpose
Completes the email verification by validating the secret code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The user email being verified | |
| secretCode | String | Yes | The secret code received via email |
{
"email": "user@example.com",
"secretCode": "123456"
}
Success Response
Returns confirmation that the email has been verified.
{
"userId": "user-uuid",
"email": "user@example.com",
"isVerified": true
}
Error Responses
403 Forbidden:- Secret code mismatch
- Secret code expired
- No ongoing verification found
Important Behavioral Notes
Resend Throttling
You can only request a new verification code after a cooldown period (resendTimeWindow, e.g., 60 seconds).
Expiration Handling
Verification codes expire after a configured period (expireTimeWindow, e.g., 1 day).
One Code Per Session
Only one active verification session per user is allowed at a time.
💡 Mindbricks automatically manages spam prevention, session caching, expiration, and event broadcasting (start/complete events) for all verification steps.
Verification Services — Mobile Verification
Mobile verification is a two-step flow that ensures a user’s mobile number is verified and trusted by the system.
All verification services, including mobile verification, are located under the /verification-services base path.
When is Mobile Verification Triggered?
- After user registration, if
mobileVerificationRequiredForLoginis active. - During a separate user action to verify or update mobile numbers.
- When login fails with
MobileVerificationNeededand frontend initiates verification.
Mobile Verification Flow
- Frontend calls
/verification-services/mobile-verification/startwith the user’s email address (used to locate the user).- Mindbricks checks if the mobile number is already verified.
- A secret code is generated and stored in the cache linked to the user.
- The code is sent to the user’s mobile via SMS or returned in the response (only in development environments for easier testing).
- User receives the code and enters it into the frontend application.
- Frontend calls
/verification-services/mobile-verification/completewith theemailand the receivedsecretCode.- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s
mobileVerifiedflag is set totrue, and a success response is returned.
API Endpoints
POST /verification-services/mobile-verification/start
Purpose:
Starts the mobile verification process by generating and sending a secret verification code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The email address associated with the mobile number to verify |
{
"email": "user@example.com"
}
Success Response
Secret code details (in development environment). Confirms that the verification step has been started.
{
"userId": "user-uuid",
"mobile": "+15551234567",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
⚠️ In production, the secret code is only sent via SMS, not exposed in the API response.
Error Responses
- 400 Bad Request: Mobile already verified.
- 403 Forbidden: Sending a code too frequently (anti-spam).
POST /verification-services/mobile-verification/complete
Purpose:
Completes the mobile verification by validating the secret code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The user’s email being verified | |
| secretCode | String | Yes | The secret code received via SMS |
{
"email": "user@example.com",
"secretCode": "123456"
}
Success Response
Returns confirmation that the mobile number has been verified.
{
"userId": "user-uuid",
"mobile": "+15551234567",
"isVerified": true
}
Error Responses
403 Forbidden:
- Secret code mismatch
- Secret code expired
- No ongoing verification found
Important Behavioral Notes
Resend Throttling:
You can only request a new verification code after a cooldown period (resendTimeWindow, e.g., 60 seconds).
Expiration Handling:
Verification codes expire after a configured period (expireTimeWindow, e.g., 1 day).
One Code Per Session:
Only one active verification session per user is allowed at a time.
💡 Mindbricks automatically manages spam prevention, session caching, expiration, and event broadcasting (start/complete events) for all verification steps.
Verification Services — Email 2FA Verification
Email 2FA (Two-Factor Authentication) provides an additional layer of security by requiring users to confirm their identity using a secret code sent to their email address. This process is used in login flows or sensitive actions that need extra verification.
All verification services, including 2FA, are located under the /verification-services base path.
When is Email 2FA Triggered?
- During login flows where
sessionNeedsEmail2FAistrue - When the backend enforces two-factor authentication for a sensitive operation
Email 2FA Flow
- Frontend calls
/verification-services/email-2factor-verification/startwith the user’s id, session id, client info, and reason.- Mindbricks identifies the user and checks if a cooldown period applies.
- A new secret code is generated and stored, linked to the current session ID.
- The code is sent via email or returned in development environments.
- User receives the code and enters it into the frontend application.
- Frontend calls
/verification-services/email-2factor-verification/completewith theuserId,sessionId, and thesecretCode.- Mindbricks verifies the code, validates the session, and updates the session to remove the 2FA requirement.
API Endpoints
POST /verification-services/email-2factor-verification/start
Purpose:
Starts the email-based 2FA process by generating and sending a verification code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | String | Yes | The user’s ID |
| sessionId | String | Yes | The current session ID |
| client | String | No | Optional client tag or context |
| reason | String | No | Optional reason for triggering 2FA |
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"client": "login-page",
"reason": "Login requires email 2FA"
}
Success Response
{
"sessionId": "session-uuid",
"userId": "user-uuid",
"email": "user@example.com",
"secretCode": "123456",
"expireTime": 300,
"date": "2024-04-29T10:00:00.000Z"
}
⚠️ In production, the secretCode is only sent via email, not exposed in the API response.
Error Responses
- 403 Forbidden: Sending a code too frequently (anti-spam)
- 401 Unauthorized: User session not found
POST /verification-services/email-2factor-verification/complete
Purpose:
Completes the email 2FA process by validating the secret code and session.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | String | Yes | The user’s ID |
| sessionId | String | Yes | The session ID the code is tied to |
| secretCode | String | Yes | The secret code received via email |
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"secretCode": "123456"
}
Success Response
Returns an updated session with 2FA disabled:
{
"sessionId": "session-uuid",
"userId": "user-uuid",
"sessionNeedsEmail2FA": false,
...
}
Error Responses
- 403 Forbidden:
- Secret code mismatch
- Secret code expired
- Verification step not found
Important Behavioral Notes
- One Code Per Session: Only one active code can be issued per session.
- Resend Throttling: Code requests are throttled based on
resendTimeWindow(e.g., 60 seconds). - Expiration: Codes expire after
expireTimeWindow(e.g., 5 minutes). - 💡 Mindbricks manages session cache, spam control, expiration tracking, and event notifications for all 2FA steps.
Verification Services — Mobile 2FA Verification
Mobile 2FA (Two-Factor Authentication) is a security mechanism that adds an extra layer of authentication using a user’s verified mobile number.
All verification services, including mobile 2FA, are accessible under the /verification-services base path.
When is Mobile 2FA Triggered?
- During login or critical actions requiring step-up authentication.
- When the session has a flag
sessionNeedsMobile2FA = true. - When login or session verification fails with
MobileVerificationNeeded, indicating 2FA is required.
Mobile 2FA Verification Flow
- Frontend calls
/verification-services/mobile-2factor-verification/startwith the user’s id, session id, client info, and reason.- Mindbricks finds the user by id.
- Verifies that the user has a verified mobile number.
- A secret code is generated and cached against the session.
- The code is sent to the user’s verified mobile number or returned in the response (only in development environments).
- User receives the code and enters it in the frontend app.
- Frontend calls
/verification-services/mobile-2factor-verification/completewith theuserId,sessionId, andsecretCode.- Mindbricks validates the code for expiration and correctness.
- If valid, the session flag
sessionNeedsMobile2FAis cleared. - A refreshed session object is returned.
API Endpoints
POST /verification-services/mobile-2factor-verification/start
Purpose:
Initiates mobile-based 2FA by generating and sending a secret code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | String | Yes | The user’s ID |
| sessionId | String | Yes | The current session ID |
| client | String | No | Optional client tag or context |
| reason | String | No | Optional reason for triggering 2FA |
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"client": "login-page",
"reason": "Login requires mobile 2FA"
}
Success Response
Returns the generated code (only in development), expiration info, and metadata.
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"mobile": "+15551234567",
"secretCode": "654321",
"expireTime": 300,
"date": "2024-04-29T11:00:00.000Z"
}
⚠️ In production environments, the secret code is not included in the response and is instead delivered via SMS.
Error Responses
- 403 Forbidden: Mobile number not verified.
- 403 Forbidden: Code resend attempted before cooldown period (
resendTimeWindow). - 401 Unauthorized: Email not recognized or session invalid.
POST /verification-services/mobile-2factor-verification/complete
Purpose:
Completes mobile 2FA verification by validating the secret code and updating the session.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | String | Yes | ID of the user |
| sessionId | String | Yes | ID of the session |
| secretCode | String | Yes | The 6-digit code received via SMS |
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"secretCode": "654321"
}
Success Response
Returns the updated session with sessionNeedsMobile2FA: false.
{
"sessionId": "session-uuid",
"userId": "user-uuid",
"sessionNeedsMobile2FA": false,
"accessToken": "jwt-token",
"expiresIn": 86400
}
Error Responses
- 403 Forbidden: Code mismatch or expired.
- 403 Forbidden: No ongoing verification found.
- 401 Unauthorized: Session does not exist or is invalid.
Behavioral Notes
- Rate Limiting: A user can only request a new mobile 2FA code after the cooldown period (
resendTimeWindow, e.g., 60 seconds). - Expiration: Mobile 2FA codes expire after the configured time (
expireTimeWindow, e.g., 5 minutes). - Session Integrity: Verification status is tied to the session; incorrect sessionId will invalidate the attempt.
💡 Mindbricks handles session integrity, rate limiting, and secure code delivery to ensure a robust mobile 2FA process.
Verification Services — Password Reset by Email
Password Reset by Email enables a user to securely reset their password using a secret code sent to their registered email address.
All verification services, including password reset by email, are located under the /verification-services base path.
When is Password Reset by Email Triggered?
- When a user requests to reset their password by providing their email address.
- This service is typically exposed on a “Forgot Password?” flow in the frontend.
Password Reset Flow
- Frontend calls
/verification-services/password-reset-by-email/startwith the user’s email.- Mindbricks checks if the user exists and if the email is registered.
- A secret code is generated and stored in the cache linked to the user.
- The code is sent to the user’s email, or returned in the response (in development environments only for testing).
- User receives the code and enters it into the frontend along with the new password.
- Frontend calls
/verification-services/password-reset-by-email/completewith theemail, thesecretCode, and the newpassword.- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s password is reset, their
emailVerifiedflag is set totrue, and a success response is returned.
API Endpoints
POST /verification-services/password-reset-by-email/start
Purpose:
Starts the password reset process by generating and sending a secret verification code.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The email address of the user |
{
"email": "user@example.com"
}
Success Response
Returns secret code details (only in development environment) and confirmation that the verification step has been started.
{
"userId": "user-uuid",
"email": "user@example.com",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
⚠️ In production, the secret code is only sent via email and not exposed in the API response.
Error Responses
401 NotAuthenticated: Email address not found or not associated with a user.403 Forbidden: Sending a code too frequently (spam prevention).
POST /verification-services/password-reset-by-email/complete
Purpose:
Completes the password reset process by validating the secret code and updating the user’s password.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The email address of the user | |
| secretCode | String | Yes | The code received via email |
| password | String | Yes | The new password the user wants to set |
{
"email": "user@example.com",
"secretCode": "123456",
"password": "newSecurePassword123"
}
Success Response
{
"userId": "user-uuid",
"email": "user@example.com",
"isVerified": true
}
Error Responses
403 Forbidden:- Secret code mismatch
- Secret code expired
- No ongoing verification found
Important Behavioral Notes
Resend Throttling:
A new verification code can only be requested after a cooldown period (configured via resendTimeWindow, e.g., 60 seconds).
Expiration Handling:
Verification codes automatically expire after a predefined period (expireTimeWindow, e.g., 1 day).
Session & Event Handling:
Mindbricks manages:
- Spam prevention
- Code caching per user
- Expiration logic
- Verification start/complete events
Verification Services — Password Reset by Mobile
Password reset by mobile provides users with a secure mechanism to reset their password using a verification code sent via SMS to their registered mobile number.
All verification services, including password reset by mobile, are located under the /verification-services base path.
When is Password Reset by Mobile Triggered?
- When a user forgets their password and selects the mobile reset option.
- When a user explicitly initiates password recovery via mobile on the login or help screen.
Password Reset by Mobile Flow
- Frontend calls
/verification-services/password-reset-by-mobile/startwith the user’s mobile number or associated identifier.- Mindbricks checks if a user with the given mobile exists.
- A secret code is generated and stored in the cache for that user.
- The code is sent to the user’s mobile (or returned in development environments for testing).
- User receives the code via SMS and enters it into the frontend app.
- Frontend calls
/verification-services/password-reset-by-mobile/completewith the user’semail, thesecretCode, and the newpassword.- Mindbricks validates the secret code and its expiration.
- If valid, it updates the user’s password and returns a success response.
API Endpoints
POST /verification-services/password-reset-by-mobile/start
Purpose:
Initiates the mobile-based password reset by sending a verification code to the user’s mobile.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| mobile | String | Yes | The mobile number to verify |
{
"mobile": "+905551234567"
}
Success Response
Returns the verification context (code returned only in development):
{
"userId": "user-uuid",
"mobile": "+905551234567",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
⚠️ In production, the secretCode is not included in the response and is only sent via SMS.
Error Responses
- 400 Bad Request: Mobile already verified
- 403 Forbidden: Rate-limited (code already sent recently)
- 404 Not Found: User with provided mobile not found
POST /verification-services/password-reset-by-mobile/complete
Purpose:
Finalizes the password reset process by validating the received verification code and updating the user’s password.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | The email address of the user | |
| secretCode | String | Yes | The code received via SMS |
| password | String | Yes | The new password to assign |
{
"email": "user@example.com",
"secretCode": "123456",
"password": "NewSecurePassword123!"
}
Success Response
{
"userId": "user-uuid",
"mobile": "+905551234567",
"isVerified": true
}
Important Behavioral Notes
- Throttling: Codes can only be resent after a delay defined by
resendTimeWindow(e.g., 60 seconds). - Expiration: Codes expire after the
expireTimeWindow(e.g., 1 day). - One Active Session: Only one active password reset session is allowed per user at a time.
- Session-less: This flow does not require an active session — it works for unauthenticated users.
💡 Mindbricks handles spam protection, session caching, and event-based logging (for both start and complete operations) as part of the verification service base class.
Verification Method Types
🧾 For byCode Verifications
This verification type requires the user to manually enter a 6-digit code.
Frontend Action:
Display a secure input page where the user can enter the code they received via email or SMS. After collecting the code and any required metadata (such as userId or sessionId), make a POST request to the corresponding /complete endpoint.
🔗 For byLink Verifications
This verification type uses a clickable link embedded in an email (or SMS message).
Frontend Action:
The link points to a GET page in your frontend that parses userId and code from the query string and sends them to the backend via a POST request to the corresponding /complete endpoint. This enables one-click verification without requiring the user to type in a code.
Common Routes
Route: currentuser
Route Definition: Retrieves the currently authenticated user’s session information.
Route Type: sessionInfo
Access Route: GET /currentuser
Parameters
This route does not require any request parameters.
Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response Returns the session object, including user-related data and token information.
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
Error Response 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
Notes
- This route is typically used by frontend or mobile applications to fetch the current session state after login.
- The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
- Always ensure a valid access token is provided in the request to retrieve the session.
Route: permissions
*Route Definition*: Retrieves all effective permission records assigned to the currently authenticated user.
*Route Type*: permissionFetch
Access Route: GET /permissions
Parameters
This route does not require any request parameters.
Behavior
- Fetches all active permission records (
givenPermissionsentries) associated with the current user session. - Returns a full array of permission objects.
- Requires a valid session (
access token) to be available.
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
Returns an array of permission objects.
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
Each object reflects a single permission grant, aligned with the givenPermissions model:
**permissionName**: The permission the user has.**roleId**: If the permission was granted through a role. -**subjectUserId**: If directly granted to the user.**subjectUserGroupId**: If granted through a group.**objectId**: If tied to a specific object (OBAC).**canDo**: True or false flag to represent if permission is active or restricted.
Error Responses
- 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
- 500 Internal Server Error: Unexpected error fetching permissions.
Notes
- The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
- Auth service: Fetches permissions freshly from the live database (givenPermissions table).
- Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
Tip: Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
Route: permissions/:permissionName
Route Definition: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
Route Type: permissionScopeCheck
Access Route: GET /permissions/:permissionName
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| permissionName | String | Yes | request.params.permissionName |
Behavior
- Evaluates whether the current user has access to the given
permissionName. - Returns a structured object indicating:
- Whether the permission is generally granted (
canDo) - Which object IDs are explicitly included or excluded from access (
exceptions)
- Whether the permission is generally granted (
- Requires a valid session (
access token).
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
- If
canDoistrue, the user generally has the permission, but not for the objects listed inexceptions(i.e., restrictions). - If
canDoisfalse, the user does not have the permission by default — but only for the objects inexceptions, they do have permission (i.e., selective overrides). - The exceptions array contains valid UUID strings, each corresponding to an object ID (typically from the data model targeted by the permission).
Copyright
All sources, documents and other digital materials are copyright of .
About Us
For more information please visit our website: .
. .
REST API GUIDE
wechess-gameplay-service
Version: 1.0.74
Service for managing real-time chess games, matchmaking, move history, and private invitations, including lifecycle management (mutual game-save/resume, admin termination), supporting both guest and registered users. Enables API access for reviewing games, enforcing moderation actions, and tracking game results.
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to . For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the Gameplay Service’s REST API. This document is designed to provide a comprehensive guide to interfacing with our Gameplay Service exclusively through RESTful API endpoints.
Intended Audience
This documentation is intended for developers and integrators who are looking to interact with the Gameplay Service via HTTP requests for purposes such as creating, updating, deleting and querying Gameplay objects.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST It’s important to note that the Gameplay Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Authentication And Authorization
To ensure secure access to the Gameplay service’s protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it’s important to note that access control varies across different routes:
Protected API: Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **: The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
|---|---|
| Query | access_token |
| Authorization Header | Bearer |
| Header | wechess-access-token |
| Cookie | wechess-access-token |
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
Api Definitions
This section outlines the API endpoints available within the Gameplay service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It’s important to understand the flexibility in how parameters can be included in requests to effectively interact with the Gameplay service.
This service is configured to listen for HTTP requests on port 3000,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
- API Test Interface (API Face):
/ - Swagger Documentation:
/swagger - Postman Collection Download:
/getPostmanCollection - Health Checks:
/healthand/admin/health - Current Session Info:
/currentuser - Favicon:
/favicon.ico
This service is accessible via the following environment-specific URLs:
- Preview:
https://wechess.prw.mindbricks.com/gameplay-api - Staging:
https://wechess-stage.mindbricks.co/gameplay-api - Production:
https://wechess.mindbricks.co/gameplay-api
Parameter Inclusion Methods: Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
Query Parameters: Included directly in the URL’s query string.
Path Parameters: Embedded within the URL’s path.
Body Parameters: Sent within the JSON body of the request.
Session Parameters: Automatically read from the session object. This method is used for parameters that are intrinsic to the user’s session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
Note on Session Parameters: Session parameters represent a unique method of parameter inclusion, relying on the context of the user’s session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the Gameplay service’s API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
Common Parameters
The Gameplay service’s business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
Supported Common Parameters:
-
getJoins (BOOLEAN): Controls whether to retrieve associated objects along with the main object. By default,
getJoinsis assumed to betrue. Set it tofalseif you prefer to receive only the main fields of an object, excluding its associations. -
excludeCQRS (BOOLEAN): Applicable only when
getJoinsistrue. By default,excludeCQRSis set tofalse. Enabling this parameter (true) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage. -
requestId (String): Identifies a request to enable tracking through the service’s log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom
requestId, simply include it in your query parameters. -
caching (BOOLEAN): Determines the use of caching for query API. By default, caching is enabled (
true). To ensure the freshest data directly from the database, set this parameter tofalse, bypassing the cache. -
cacheTTL (Integer): Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for
get listqueries. Setting a customcacheTTLallows you to fine-tune the cache lifespan to meet your needs. -
pageNumber (Integer): For paginated
get listAPI’s, this parameter selects which page of results to retrieve. The default is1, indicating the first page. To disable pagination and retrieve all results, setpageNumberto0. -
pageRowCount (Integer): In conjunction with paginated API’s, this parameter defines the number of records per page. The default value is
25. AdjustingpageRowCountallows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the Gameplay service.
Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- 401 Unauthorized: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Object Structure of a Successfull Response
When the Gameplay service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
Key Characteristics of the Response Envelope:
-
Data Presentation: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- Creation and Update API: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- Delete API: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- Get Requests: A single data object is returned in JSON format.
- Get List Requests: An array of data objects is provided, reflecting a collection of resources.
-
Data Structure and Joins: The complexity of the data structure in the response can vary based on the API’s architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- Pure Data Forms: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- Extended Data Forms: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- Join Varieties: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
Design Considerations: The structure of a API’s response data is meticulously crafted during the service’s architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
Brief Data: Certain API’s return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
HTTP Status Codes:
- 200 OK: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- 201 Created: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
Success Response Format:
For successful operations, the response includes a "status": "OK" property, signaling the successful execution of the request. The structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
Handling Errors:
For details on handling error scenarios and understanding the structure of error responses, please refer to the “Error Response” section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
Resources
Gameplay service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
ChessGame resource
ChessGame Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| playerWhiteId | ID | User ID of the player assigned White (guest or registered); references auth:user.id. | ||
| playerBlackId | ID | ** | ||
| createdById | ID | ID of the user who created the game (can be a guest or registered user). | ||
| status | Enum | Lifecycle status: pending, active, paused, completed, terminated | ||
| mode | Enum | Game mode: public (matchmaking), private (invitation-based) | ||
| invitationCode | String | ** | ||
| currentFEN | String | Current board state in FEN notation for restoration/resume. | ||
| gameType | Enum | Game type: timed, untimed, blitz, rapid | ||
| saveStatus | Enum | Game mutual-saving: notSaveable, requested, paused (both agreed) | ||
| saveRequestWhite | Boolean | Whether white has requested save/resume; mutual save when both true. | ||
| saveRequestBlack | Boolean | Whether black has requested save/resume; mutual save when both true. | ||
| movedAt | Date | Timestamp of last move (heartbeat/game activity). | ||
| result | Enum | Game result/outcome: whiteWin, blackWin, draw, aborted | ||
| terminatedById | ID | ID of administrator who forced terminated the game (if applicable). | ||
| reportStatus | Enum | Moderation/review status: none, reported, underReview | ||
| guestPlayerWhite | Boolean | True if white is a guest (not a registered user); needed to distinguish guest/registered in history. | ||
| guestPlayerBlack | Boolean | True if black is a guest (not a registered user); needed to distinguish guest/registered in history. | ||
| initialFEN | String | The starting FEN position when the game was created. Used to identify custom games. |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
status Enum Property
Property Definition : Lifecycle status: pending, active, paused, completed, terminatedEnum Options
| Name | Value | Index |
|---|---|---|
| pending | "pending"" |
0 |
| active | "active"" |
1 |
| paused | "paused"" |
2 |
| completed | "completed"" |
3 |
| terminated | "terminated"" |
4 |
mode Enum Property
Property Definition : Game mode: public (matchmaking), private (invitation-based)Enum Options
| Name | Value | Index |
|---|---|---|
| public | "public"" |
0 |
| private | "private"" |
1 |
gameType Enum Property
Property Definition : Game type: timed, untimed, blitz, rapidEnum Options
| Name | Value | Index |
|---|---|---|
| timed | "timed"" |
0 |
| untimed | "untimed"" |
1 |
| blitz | "blitz"" |
2 |
| rapid | "rapid"" |
3 |
saveStatus Enum Property
Property Definition : Game mutual-saving: notSaveable, requested, paused (both agreed)Enum Options
| Name | Value | Index |
|---|---|---|
| notSaveable | "notSaveable"" |
0 |
| requested | "requested"" |
1 |
| paused | "paused"" |
2 |
result Enum Property
Property Definition : Game result/outcome: whiteWin, blackWin, draw, abortedEnum Options
| Name | Value | Index |
|---|---|---|
| whiteWin | "whiteWin"" |
0 |
| blackWin | "blackWin"" |
1 |
| draw | "draw"" |
2 |
| aborted | "aborted"" |
3 |
reportStatus Enum Property
Property Definition : Moderation/review status: none, reported, underReviewEnum Options
| Name | Value | Index |
|---|---|---|
| none | "none"" |
0 |
| reported | "reported"" |
1 |
| underReview | "underReview"" |
2 |
ChessGameMove resource
Resource Definition : Represents a single move in a chess game (FIDE-compliant SAN/LAN representation, timestamp, player, time, move number). ChessGameMove Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| gameId | ID | Reference to the chessGame this move belongs to. | ||
| moveNumber | Integer | Move number (starting from 1 in each game). | ||
| moveNotation | String | Chess move in either Standard Algebraic or Long Algebraic Notation (SAN/LAN). | ||
| moveTime | Integer | Time in milliseconds since the previous move (for time control, etc.). | ||
| movedById | ID | User ID of the player who made the move (guest/registered); references auth:user.id. | ||
| moveTimestamp | Date | Timestamp when move was made. |
ChessGameInvitation resource
Resource Definition : An invitation for a private chess game between two players; status tracked; expires at set time or when accepted/declined. ChessGameInvitation Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| gameId | ID | Game this invitation is linked to. | ||
| senderId | ID | ** | ||
| recipientId | ID | ** | ||
| status | Enum | ** | ||
| expiresAt | Date | Expiration date/time for the invitation. |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
status Enum Property
Enum Options
| Name | Value | Index |
|---|---|---|
| pending | "pending"" |
0 |
| accepted | "accepted"" |
1 |
| declined | "declined"" |
2 |
| cancelled | "cancelled"" |
3 |
CustomBoard resource
CustomBoard Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| name | String | Name of the custom board position | ||
| fen | String | FEN string representing the board position | ||
| description | Text | Optional description of the custom board | ||
| isPublished | Boolean | ** | ||
| category | Enum | ** | ||
| createdById | ID | ** |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
category Enum Property
Enum Options
| Name | Value | Index |
|---|---|---|
| endgame | "endgame"" |
0 |
| opening | "opening"" |
1 |
| puzzle | "puzzle"" |
2 |
| custom | "custom"" |
3 |
BoardTheme resource
BoardTheme Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| name | String | Theme display name | ||
| lightSquare | String | Hex color for light squares | ||
| darkSquare | String | Hex color for dark squares | ||
| isPublished | Boolean | Whether the theme is publicly visible | ||
| createdById | ID | User who created this theme |
UserPreference resource
UserPreference Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| userId | ID | The user this preferences record belongs to | ||
| activeThemeId | String | ID of the currently selected board theme (preset ID or custom theme ID) | ||
| soundEnabled | Boolean | Whether game sounds are enabled | ||
| showAnimations | Boolean | Whether board animations are shown | ||
| boardOrientation | Enum | Default board orientation preference | ||
| premoveEnabled | Boolean | Whether premove feature is enabled |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
boardOrientation Enum Property
Property Definition : Default board orientation preferenceEnum Options
| Name | Value | Index |
|---|---|---|
| auto | "auto"" |
0 |
| white | "white"" |
1 |
| black | "black"" |
2 |
GameHubMessage resource
Resource Definition : Auto-generated message DataObject for the gameHub RealtimeHub. Stores all messages with typed content payloads. GameHubMessage Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| roomId | ID | Reference to the room this message belongs to | ||
| senderId | ID | Reference to the user who sent this message | ||
| senderName | String | Display name of the sender (denormalized from user profile at send time) | ||
| senderAvatar | String | Avatar URL of the sender (denormalized from user profile at send time) | ||
| messageType | Enum | Content type discriminator for this message | ||
| content | Object | Type-specific content payload (structure depends on messageType) | ||
| timestamp | Message creation time | |||
| status | Enum | Message moderation status |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
messageType Enum Property
Property Definition : Content type discriminator for this messageEnum Options
| Name | Value | Index |
|---|---|---|
| text | "text"" |
0 |
| system | "system"" |
1 |
| chessMove | "chessMove"" |
2 |
| drawOffer | "drawOffer"" |
3 |
| drawAccepted | "drawAccepted"" |
4 |
| drawDeclined | "drawDeclined"" |
5 |
| resignation | "resignation"" |
6 |
| saveRequest | "saveRequest"" |
7 |
| saveAccepted | "saveAccepted"" |
8 |
| saveDeclined | "saveDeclined"" |
9 |
| resumeRequest | "resumeRequest"" |
10 |
| resumeAccepted | "resumeAccepted"" |
11 |
| resumeDeclined | "resumeDeclined"" |
12 |
status Enum Property
Property Definition : Message moderation statusEnum Options
| Name | Value | Index |
|---|---|---|
| pending | "pending"" |
0 |
| approved | "approved"" |
1 |
| rejected | "rejected"" |
2 |
GameHubModeration resource
Resource Definition : Auto-generated moderation DataObject for the gameHub RealtimeHub. Stores block and silence actions for room-level user moderation. GameHubModeration Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| roomId | ID | Reference to the room where the moderation action applies | ||
| userId | ID | The user who is blocked or silenced | ||
| action | Enum | Moderation action type | ||
| reason | Text | Optional reason for the moderation action | ||
| duration | Integer | Duration in seconds. 0 means permanent | ||
| expiresAt | Expiry timestamp. Null means permanent | |||
| issuedBy | ID | The moderator who issued the action |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
action Enum Property
Property Definition : Moderation action typeEnum Options
| Name | Value | Index |
|---|---|---|
| blocked | "blocked"" |
0 |
| silenced | "silenced"" |
1 |
Business Api
Create Game API
[Default create API] — This is the designated default create API for the chessGame data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Starts a new chess game session (public or private). Sets up all initial state, assigns player roles, and sets mode.
API Frontend Description By The Backend Architect
Called when matchmaking or private game is created. Invited/private games have invitationCode. Only logged-in users (guest or registered) can create games. Raise event for gameCreated for notification/bff.
Rest Route
The createGame API REST controller can be triggered via the following route:
/v1/game
Rest Request Parameters
The createGame api has got 18 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| playerWhiteId | ID | true | request.body?.[“playerWhiteId”] |
| playerBlackId | ID | false | request.body?.[“playerBlackId”] |
| createdById | ID | true | request.body?.[“createdById”] |
| status | Enum | true | request.body?.[“status”] |
| mode | Enum | true | request.body?.[“mode”] |
| invitationCode | String | false | request.body?.[“invitationCode”] |
| currentFEN | String | true | request.body?.[“currentFEN”] |
| gameType | Enum | true | request.body?.[“gameType”] |
| saveStatus | Enum | true | request.body?.[“saveStatus”] |
| saveRequestWhite | Boolean | false | request.body?.[“saveRequestWhite”] |
| saveRequestBlack | Boolean | false | request.body?.[“saveRequestBlack”] |
| movedAt | Date | false | request.body?.[“movedAt”] |
| result | Enum | false | request.body?.[“result”] |
| terminatedById | ID | false | request.body?.[“terminatedById”] |
| reportStatus | Enum | false | request.body?.[“reportStatus”] |
| guestPlayerWhite | Boolean | false | request.body?.[“guestPlayerWhite”] |
| guestPlayerBlack | Boolean | false | request.body?.[“guestPlayerBlack”] |
| initialFEN | String | false | request.body?.[“initialFEN”] |
| playerWhiteId : User ID of the player assigned White (guest or registered); references auth:user.id. | |||
| playerBlackId : | |||
| createdById : ID of the user who created the game (can be a guest or registered user). | |||
| status : Lifecycle status: pending, active, paused, completed, terminated | |||
| mode : Game mode: public (matchmaking), private (invitation-based) | |||
| invitationCode : | |||
| currentFEN : Current board state in FEN notation for restoration/resume. | |||
| gameType : Game type: timed, untimed, blitz, rapid | |||
| saveStatus : Game mutual-saving: notSaveable, requested, paused (both agreed) | |||
| saveRequestWhite : Whether white has requested save/resume; mutual save when both true. | |||
| saveRequestBlack : Whether black has requested save/resume; mutual save when both true. | |||
| movedAt : Timestamp of last move (heartbeat/game activity). | |||
| result : Game result/outcome: whiteWin, blackWin, draw, aborted | |||
| terminatedById : ID of administrator who forced terminated the game (if applicable). | |||
| reportStatus : Moderation/review status: none, reported, underReview | |||
| guestPlayerWhite : True if white is a guest (not a registered user); needed to distinguish guest/registered in history. | |||
| guestPlayerBlack : True if black is a guest (not a registered user); needed to distinguish guest/registered in history. | |||
| initialFEN : The starting FEN position when the game was created. Used to identify custom games. |
REST Request To access the api you can use the REST controller with the path POST /v1/game
axios({
method: 'POST',
url: '/v1/game',
data: {
playerWhiteId:"ID",
playerBlackId:"ID",
createdById:"ID",
status:"Enum",
mode:"Enum",
invitationCode:"String",
currentFEN:"String",
gameType:"Enum",
saveStatus:"Enum",
saveRequestWhite:"Boolean",
saveRequestBlack:"Boolean",
movedAt:"Date",
result:"Enum",
terminatedById:"ID",
reportStatus:"Enum",
guestPlayerWhite:"Boolean",
guestPlayerBlack:"Boolean",
initialFEN:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGame",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"chessGame": {
"id": "ID",
"playerWhiteId": "ID",
"playerBlackId": "ID",
"createdById": "ID",
"status": "Enum",
"status_idx": "Integer",
"mode": "Enum",
"mode_idx": "Integer",
"invitationCode": "String",
"currentFEN": "String",
"gameType": "Enum",
"gameType_idx": "Integer",
"saveStatus": "Enum",
"saveStatus_idx": "Integer",
"saveRequestWhite": "Boolean",
"saveRequestBlack": "Boolean",
"movedAt": "Date",
"result": "Enum",
"result_idx": "Integer",
"terminatedById": "ID",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"guestPlayerWhite": "Boolean",
"guestPlayerBlack": "Boolean",
"initialFEN": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Game API
[Default update API] — This is the designated default update API for the chessGame data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Updates chess game state including board position, status, save flags etc. Auth: only participants or admin.
API Frontend Description By The Backend Architect
Used for updating board state, status, mutual saving, etc. Most fields are read-only after game completion/termination except by admin. Raise event for gameUpdated for notification/bff.
Rest Route
The updateGame API REST controller can be triggered via the following route:
/v1/game/:chessGameId
Rest Request Parameters
The updateGame api has got 13 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| chessGameId | ID | true | request.params?.[“chessGameId”] |
| playerBlackId | ID | request.body?.[“playerBlackId”] | |
| status | Enum | false | request.body?.[“status”] |
| currentFEN | String | false | request.body?.[“currentFEN”] |
| saveStatus | Enum | false | request.body?.[“saveStatus”] |
| saveRequestWhite | Boolean | false | request.body?.[“saveRequestWhite”] |
| saveRequestBlack | Boolean | false | request.body?.[“saveRequestBlack”] |
| movedAt | Date | false | request.body?.[“movedAt”] |
| result | Enum | false | request.body?.[“result”] |
| terminatedById | ID | false | request.body?.[“terminatedById”] |
| reportStatus | Enum | false | request.body?.[“reportStatus”] |
| guestPlayerWhite | Boolean | false | request.body?.[“guestPlayerWhite”] |
| guestPlayerBlack | Boolean | false | request.body?.[“guestPlayerBlack”] |
| chessGameId : This id paremeter is used to select the required data object that will be updated | |||
| playerBlackId : | |||
| status : Lifecycle status: pending, active, paused, completed, terminated | |||
| currentFEN : Current board state in FEN notation for restoration/resume. | |||
| saveStatus : Game mutual-saving: notSaveable, requested, paused (both agreed) | |||
| saveRequestWhite : Whether white has requested save/resume; mutual save when both true. | |||
| saveRequestBlack : Whether black has requested save/resume; mutual save when both true. | |||
| movedAt : Timestamp of last move (heartbeat/game activity). | |||
| result : Game result/outcome: whiteWin, blackWin, draw, aborted | |||
| terminatedById : ID of administrator who forced terminated the game (if applicable). | |||
| reportStatus : Moderation/review status: none, reported, underReview | |||
| guestPlayerWhite : True if white is a guest (not a registered user); needed to distinguish guest/registered in history. | |||
| guestPlayerBlack : True if black is a guest (not a registered user); needed to distinguish guest/registered in history. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/game/:chessGameId
axios({
method: 'PATCH',
url: `/v1/game/${chessGameId}`,
data: {
playerBlackId:"ID",
status:"Enum",
currentFEN:"String",
saveStatus:"Enum",
saveRequestWhite:"Boolean",
saveRequestBlack:"Boolean",
movedAt:"Date",
result:"Enum",
terminatedById:"ID",
reportStatus:"Enum",
guestPlayerWhite:"Boolean",
guestPlayerBlack:"Boolean",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGame",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"chessGame": {
"id": "ID",
"playerWhiteId": "ID",
"playerBlackId": "ID",
"createdById": "ID",
"status": "Enum",
"status_idx": "Integer",
"mode": "Enum",
"mode_idx": "Integer",
"invitationCode": "String",
"currentFEN": "String",
"gameType": "Enum",
"gameType_idx": "Integer",
"saveStatus": "Enum",
"saveStatus_idx": "Integer",
"saveRequestWhite": "Boolean",
"saveRequestBlack": "Boolean",
"movedAt": "Date",
"result": "Enum",
"result_idx": "Integer",
"terminatedById": "ID",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"guestPlayerWhite": "Boolean",
"guestPlayerBlack": "Boolean",
"initialFEN": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Game API
[Default delete API] — This is the designated default delete API for the chessGame data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Deletes a chess game (soft-delete). Only allowed for admins or system cleanup.
API Frontend Description By The Backend Architect
Hard deletion not recommended; soft-deletion disables user/game access. Used for moderation/cleanup only. Regular users cannot delete games. Raise event for gameDeleted for moderation/audit.
Rest Route
The deleteGame API REST controller can be triggered via the following route:
/v1/game/:chessGameId
Rest Request Parameters
The deleteGame api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| chessGameId | ID | true | request.params?.[“chessGameId”] |
| chessGameId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/game/:chessGameId
axios({
method: 'DELETE',
url: `/v1/game/${chessGameId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGame",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"chessGame": {
"id": "ID",
"playerWhiteId": "ID",
"playerBlackId": "ID",
"createdById": "ID",
"status": "Enum",
"status_idx": "Integer",
"mode": "Enum",
"mode_idx": "Integer",
"invitationCode": "String",
"currentFEN": "String",
"gameType": "Enum",
"gameType_idx": "Integer",
"saveStatus": "Enum",
"saveStatus_idx": "Integer",
"saveRequestWhite": "Boolean",
"saveRequestBlack": "Boolean",
"movedAt": "Date",
"result": "Enum",
"result_idx": "Integer",
"terminatedById": "ID",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"guestPlayerWhite": "Boolean",
"guestPlayerBlack": "Boolean",
"initialFEN": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Game API
[Default get API] — This is the designated default get API for the chessGame data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Fetch a single chess game by ID. Only participants, admin, or invitation recipient may access.
API Frontend Description By The Backend Architect
Retrieve all game details and limited move history for preview/study. If user is not participant, must check invitation. Raise event for gameFetched.
Rest Route
The getGame API REST controller can be triggered via the following route:
/v1/game/:chessGameId
Rest Request Parameters
The getGame api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| chessGameId | ID | true | request.params?.[“chessGameId”] |
| chessGameId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/game/:chessGameId
axios({
method: 'GET',
url: `/v1/game/${chessGameId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGame",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"chessGame": {
"id": "ID",
"playerWhiteId": "ID",
"playerBlackId": "ID",
"createdById": "ID",
"status": "Enum",
"status_idx": "Integer",
"mode": "Enum",
"mode_idx": "Integer",
"invitationCode": "String",
"currentFEN": "String",
"gameType": "Enum",
"gameType_idx": "Integer",
"saveStatus": "Enum",
"saveStatus_idx": "Integer",
"saveRequestWhite": "Boolean",
"saveRequestBlack": "Boolean",
"movedAt": "Date",
"result": "Enum",
"result_idx": "Integer",
"terminatedById": "ID",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"guestPlayerWhite": "Boolean",
"guestPlayerBlack": "Boolean",
"initialFEN": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"moves": [
{
"moveNumber": "Integer",
"moveNotation": "String",
"moveTime": "Integer",
"movedById": "ID",
"moveTimestamp": "Date"
},
{},
{}
]
}
}
List Games API
[Default list API] — This is the designated default list API for the chessGame data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List chess games by participant or admin query. Supports filtering by status, participants, mode, etc.
API Frontend Description By The Backend Architect
Used for history browsing, admin review, or finding ongoing/mutually saved games. Raise event for gameListFetched for audit/UX.
Rest Route
The listGames API REST controller can be triggered via the following route:
/v1/games
Rest Request Parameters
Filter Parameters
The listGames api supports 2 optional filter parameters for filtering list results:
status (Enum): Lifecycle status: pending, active, paused, completed, terminated
- Single:
?status=<value>(case-insensitive) - Multiple:
?status=<value1>&status=<value2> - Null:
?status=null
invitationCode (String): Filter by invitationCode
- Single (partial match, case-insensitive):
?invitationCode=<value> - Multiple:
?invitationCode=<value1>&invitationCode=<value2> - Null:
?invitationCode=null
REST Request To access the api you can use the REST controller with the path GET /v1/games
axios({
method: 'GET',
url: '/v1/games',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// status: '<value>' // Filter by status
// invitationCode: '<value>' // Filter by invitationCode
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGames",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"chessGames": [
{
"id": "ID",
"playerWhiteId": "ID",
"playerBlackId": "ID",
"createdById": "ID",
"status": "Enum",
"status_idx": "Integer",
"mode": "Enum",
"mode_idx": "Integer",
"invitationCode": "String",
"currentFEN": "String",
"gameType": "Enum",
"gameType_idx": "Integer",
"saveStatus": "Enum",
"saveStatus_idx": "Integer",
"saveRequestWhite": "Boolean",
"saveRequestBlack": "Boolean",
"movedAt": "Date",
"result": "Enum",
"result_idx": "Integer",
"terminatedById": "ID",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"guestPlayerWhite": "Boolean",
"guestPlayerBlack": "Boolean",
"initialFEN": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Gamemove API
[Default create API] — This is the designated default create API for the chessGameMove data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Record a move in an ongoing chess game. Only participants or admin can add moves.
API Frontend Description By The Backend Architect
Called in-order for each legitimate move. Ensures move sequence is preserved. Move time and timestamp acquired on submit. Raises event for moveAdded.
Rest Route
The createGameMove API REST controller can be triggered via the following route:
/v1/gamemove
Rest Request Parameters
The createGameMove api has got 6 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| gameId | ID | true | request.body?.[“gameId”] |
| moveNumber | Integer | true | request.body?.[“moveNumber”] |
| moveNotation | String | true | request.body?.[“moveNotation”] |
| moveTime | Integer | false | request.body?.[“moveTime”] |
| movedById | ID | true | request.body?.[“movedById”] |
| moveTimestamp | Date | true | request.body?.[“moveTimestamp”] |
| gameId : Reference to the chessGame this move belongs to. | |||
| moveNumber : Move number (starting from 1 in each game). | |||
| moveNotation : Chess move in either Standard Algebraic or Long Algebraic Notation (SAN/LAN). | |||
| moveTime : Time in milliseconds since the previous move (for time control, etc.). | |||
| movedById : User ID of the player who made the move (guest/registered); references auth:user.id. | |||
| moveTimestamp : Timestamp when move was made. |
REST Request To access the api you can use the REST controller with the path POST /v1/gamemove
axios({
method: 'POST',
url: '/v1/gamemove',
data: {
gameId:"ID",
moveNumber:"Integer",
moveNotation:"String",
moveTime:"Integer",
movedById:"ID",
moveTimestamp:"Date",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGameMove",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"chessGameMove": {
"id": "ID",
"gameId": "ID",
"moveNumber": "Integer",
"moveNotation": "String",
"moveTime": "Integer",
"movedById": "ID",
"moveTimestamp": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Gamemoves API
[Default list API] — This is the designated default list API for the chessGameMove data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List moves for a given game. Only participants or admin can view.
API Frontend Description By The Backend Architect
Used for reviewing game history/study. Returns moves ordered by moveNumber asc.
Rest Route
The listGameMoves API REST controller can be triggered via the following route:
/v1/gamemoves
Rest Request Parameters
Filter Parameters
The listGameMoves api supports 1 optional filter parameter for filtering list results:
gameId (ID): Reference to the chessGame this move belongs to.
- Single:
?gameId=<value> - Multiple:
?gameId=<value1>&gameId=<value2> - Null:
?gameId=null
REST Request To access the api you can use the REST controller with the path GET /v1/gamemoves
axios({
method: 'GET',
url: '/v1/gamemoves',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// gameId: '<value>' // Filter by gameId
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGameMoves",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"chessGameMoves": [
{
"id": "ID",
"gameId": "ID",
"moveNumber": "Integer",
"moveNotation": "String",
"moveTime": "Integer",
"movedById": "ID",
"moveTimestamp": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Gameinvitation API
[Default create API] — This is the designated default create API for the chessGameInvitation data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Send an invitation for a private chess game to a user (guest or registered).
API Frontend Description By The Backend Architect
Used for starting private games. Invitation auto-invalidates on expiry. Raise event for invitationSent for notification.
Rest Route
The createGameInvitation API REST controller can be triggered via the following route:
/v1/gameinvitation
Rest Request Parameters
The createGameInvitation api has got 5 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| gameId | ID | true | request.body?.[“gameId”] |
| senderId | ID | true | request.body?.[“senderId”] |
| recipientId | ID | true | request.body?.[“recipientId”] |
| status | Enum | true | request.body?.[“status”] |
| expiresAt | Date | true | request.body?.[“expiresAt”] |
| gameId : Game this invitation is linked to. | |||
| senderId : | |||
| recipientId : | |||
| status : | |||
| expiresAt : Expiration date/time for the invitation. |
REST Request To access the api you can use the REST controller with the path POST /v1/gameinvitation
axios({
method: 'POST',
url: '/v1/gameinvitation',
data: {
gameId:"ID",
senderId:"ID",
recipientId:"ID",
status:"Enum",
expiresAt:"Date",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGameInvitation",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"chessGameInvitation": {
"id": "ID",
"gameId": "ID",
"senderId": "ID",
"recipientId": "ID",
"status": "Enum",
"status_idx": "Integer",
"expiresAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Gameinvitation API
[Default update API] — This is the designated default update API for the chessGameInvitation data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update the status or expiry of a game invitation (accept, decline, cancel, expire). Only sender, recipient, or admin can change status.
API Frontend Description By The Backend Architect
Used for invitation workflow (accept, decline, cancel); handled securely as only involved users or admin can update. Event is raised for notification.
Rest Route
The updateGameInvitation API REST controller can be triggered via the following route:
/v1/gameinvitation/:chessGameInvitationId
Rest Request Parameters
The updateGameInvitation api has got 5 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| chessGameInvitationId | ID | true | request.params?.[“chessGameInvitationId”] |
| senderId | ID | request.body?.[“senderId”] | |
| recipientId | ID | request.body?.[“recipientId”] | |
| status | Enum | request.body?.[“status”] | |
| expiresAt | Date | false | request.body?.[“expiresAt”] |
| chessGameInvitationId : This id paremeter is used to select the required data object that will be updated | |||
| senderId : | |||
| recipientId : | |||
| status : | |||
| expiresAt : Expiration date/time for the invitation. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/gameinvitation/:chessGameInvitationId
axios({
method: 'PATCH',
url: `/v1/gameinvitation/${chessGameInvitationId}`,
data: {
senderId:"ID",
recipientId:"ID",
status:"Enum",
expiresAt:"Date",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGameInvitation",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"chessGameInvitation": {
"id": "ID",
"gameId": "ID",
"senderId": "ID",
"recipientId": "ID",
"status": "Enum",
"status_idx": "Integer",
"expiresAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Gameinvitation API
Delete a game invitation (soft-deletes); only admin may do this for moderation/cleanup.
API Frontend Description By The Backend Architect
Not available to normal users. Moderation purposes only. Raise event for invitationRemoved for mods.
Rest Route
The deleteGameInvitation API REST controller can be triggered via the following route:
/v1/gameinvitation/:chessGameInvitationId
Rest Request Parameters
The deleteGameInvitation api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| chessGameInvitationId | ID | true | request.params?.[“chessGameInvitationId”] |
| chessGameInvitationId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/gameinvitation/:chessGameInvitationId
axios({
method: 'DELETE',
url: `/v1/gameinvitation/${chessGameInvitationId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGameInvitation",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"chessGameInvitation": {
"id": "ID",
"gameId": "ID",
"senderId": "ID",
"recipientId": "ID",
"status": "Enum",
"status_idx": "Integer",
"expiresAt": "Date",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Gameinvitations API
[Default list API] — This is the designated default list API for the chessGameInvitation data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List game invitations. Supports filtering by recipientId, senderId, status, gameId.
API Frontend Description By The Backend Architect
Used to show pending invitations to a user, or to list all invitations for a game.
Rest Route
The listGameInvitations API REST controller can be triggered via the following route:
/v1/gameinvitations
Rest Request Parameters
Filter Parameters
The listGameInvitations api supports 3 optional filter parameters for filtering list results:
senderId (ID): Filter by senderId
- Single:
?senderId=<value> - Multiple:
?senderId=<value1>&senderId=<value2> - Null:
?senderId=null
recipientId (ID): Filter by recipientId
- Single:
?recipientId=<value> - Multiple:
?recipientId=<value1>&recipientId=<value2> - Null:
?recipientId=null
status (Enum): Filter by status
- Single:
?status=<value>(case-insensitive) - Multiple:
?status=<value1>&status=<value2> - Null:
?status=null
REST Request To access the api you can use the REST controller with the path GET /v1/gameinvitations
axios({
method: 'GET',
url: '/v1/gameinvitations',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// senderId: '<value>' // Filter by senderId
// recipientId: '<value>' // Filter by recipientId
// status: '<value>' // Filter by status
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chessGameInvitations",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"chessGameInvitations": [
{
"id": "ID",
"gameId": "ID",
"senderId": "ID",
"recipientId": "ID",
"status": "Enum",
"status_idx": "Integer",
"expiresAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Customboard API
[Default create API] — This is the designated default create API for the customBoard data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a new custom chess board position. Any logged-in user can create boards.
API Frontend Description By The Backend Architect
Called when a user saves a custom board position from the board editor. createdById is auto-set from session.
Rest Route
The createCustomBoard API REST controller can be triggered via the following route:
/v1/customboards
Rest Request Parameters
The createCustomBoard api has got 6 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| name | String | true | request.body?.[“name”] |
| fen | String | true | request.body?.[“fen”] |
| description | Text | false | request.body?.[“description”] |
| isPublished | Boolean | true | request.body?.[“isPublished”] |
| category | Enum | true | request.body?.[“category”] |
| createdById | ID | true | request.body?.[“createdById”] |
| name : Name of the custom board position | |||
| fen : FEN string representing the board position | |||
| description : Optional description of the custom board | |||
| isPublished : | |||
| category : | |||
| createdById : |
REST Request To access the api you can use the REST controller with the path POST /v1/customboards
axios({
method: 'POST',
url: '/v1/customboards',
data: {
name:"String",
fen:"String",
description:"Text",
isPublished:"Boolean",
category:"Enum",
createdById:"ID",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "customBoard",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"customBoard": {
"id": "ID",
"name": "String",
"fen": "String",
"description": "Text",
"isPublished": "Boolean",
"category": "Enum",
"category_idx": "Integer",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Customboards API
[Default list API] — This is the designated default list API for the customBoard data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List custom board positions. Supports filtering by isPublished, category, and createdById.
API Frontend Description By The Backend Architect
Used to browse published community boards or user’s own boards. Filter by isPublished=true for public boards.
Rest Route
The listCustomBoards API REST controller can be triggered via the following route:
/v1/customboards
Rest Request Parameters
Filter Parameters
The listCustomBoards api supports 3 optional filter parameters for filtering list results:
isPublished (Boolean): Filter by isPublished
- True:
?isPublished=true - False:
?isPublished=false - Null:
?isPublished=null
category (Enum): Filter by category
- Single:
?category=<value>(case-insensitive) - Multiple:
?category=<value1>&category=<value2> - Null:
?category=null
createdById (ID): Filter by createdById
- Single:
?createdById=<value> - Multiple:
?createdById=<value1>&createdById=<value2> - Null:
?createdById=null
REST Request To access the api you can use the REST controller with the path GET /v1/customboards
axios({
method: 'GET',
url: '/v1/customboards',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// isPublished: '<value>' // Filter by isPublished
// category: '<value>' // Filter by category
// createdById: '<value>' // Filter by createdById
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "customBoards",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"customBoards": [
{
"id": "ID",
"name": "String",
"fen": "String",
"description": "Text",
"isPublished": "Boolean",
"category": "Enum",
"category_idx": "Integer",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Get Customboard API
[Default get API] — This is the designated default get API for the customBoard data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Fetch a single custom board position by ID.
API Frontend Description By The Backend Architect
Used to load a specific custom board for editing or playing.
Rest Route
The getCustomBoard API REST controller can be triggered via the following route:
/v1/customboards/:customBoardId
Rest Request Parameters
The getCustomBoard api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| customBoardId | ID | true | request.params?.[“customBoardId”] |
| customBoardId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/customboards/:customBoardId
axios({
method: 'GET',
url: `/v1/customboards/${customBoardId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "customBoard",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"customBoard": {
"id": "ID",
"name": "String",
"fen": "String",
"description": "Text",
"isPublished": "Boolean",
"category": "Enum",
"category_idx": "Integer",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Customboard API
[Default update API] — This is the designated default update API for the customBoard data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update a custom board position. Only the creator can update their own boards.
API Frontend Description By The Backend Architect
Used to edit board name, description, FEN, category, or publish/unpublish.
Rest Route
The updateCustomBoard API REST controller can be triggered via the following route:
/v1/customboards/:customBoardId
Rest Request Parameters
The updateCustomBoard api has got 7 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| customBoardId | ID | true | request.params?.[“customBoardId”] |
| name | String | false | request.body?.[“name”] |
| fen | String | false | request.body?.[“fen”] |
| description | Text | false | request.body?.[“description”] |
| isPublished | Boolean | request.body?.[“isPublished”] | |
| category | Enum | request.body?.[“category”] | |
| createdById | ID | request.body?.[“createdById”] | |
| customBoardId : This id paremeter is used to select the required data object that will be updated | |||
| name : Name of the custom board position | |||
| fen : FEN string representing the board position | |||
| description : Optional description of the custom board | |||
| isPublished : | |||
| category : | |||
| createdById : |
REST Request To access the api you can use the REST controller with the path PATCH /v1/customboards/:customBoardId
axios({
method: 'PATCH',
url: `/v1/customboards/${customBoardId}`,
data: {
name:"String",
fen:"String",
description:"Text",
isPublished:"Boolean",
category:"Enum",
createdById:"ID",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "customBoard",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"customBoard": {
"id": "ID",
"name": "String",
"fen": "String",
"description": "Text",
"isPublished": "Boolean",
"category": "Enum",
"category_idx": "Integer",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Customboard API
[Default delete API] — This is the designated default delete API for the customBoard data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Delete a custom board position (soft-delete). Only creator or admin can delete.
API Frontend Description By The Backend Architect
Used to remove a custom board. Soft-deletes so data can be recovered if needed.
Rest Route
The deleteCustomBoard API REST controller can be triggered via the following route:
/v1/customboards/:customBoardId
Rest Request Parameters
The deleteCustomBoard api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| customBoardId | ID | true | request.params?.[“customBoardId”] |
| customBoardId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/customboards/:customBoardId
axios({
method: 'DELETE',
url: `/v1/customboards/${customBoardId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "customBoard",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"customBoard": {
"id": "ID",
"name": "String",
"fen": "String",
"description": "Text",
"isPublished": "Boolean",
"category": "Enum",
"category_idx": "Integer",
"createdById": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Create Boardtheme API
[Default create API] — This is the designated default create API for the boardTheme data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a custom board color theme.
API Frontend Description By The Backend Architect
Called when user saves a new custom theme from the themes picker.
Rest Route
The createBoardTheme API REST controller can be triggered via the following route:
/v1/boardthemes
Rest Request Parameters
The createBoardTheme api has got 4 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| name | String | true | request.body?.[“name”] |
| lightSquare | String | true | request.body?.[“lightSquare”] |
| darkSquare | String | true | request.body?.[“darkSquare”] |
| createdById | ID | true | request.body?.[“createdById”] |
| name : Theme display name | |||
| lightSquare : Hex color for light squares | |||
| darkSquare : Hex color for dark squares | |||
| createdById : User who created this theme |
REST Request To access the api you can use the REST controller with the path POST /v1/boardthemes
axios({
method: 'POST',
url: '/v1/boardthemes',
data: {
name:"String",
lightSquare:"String",
darkSquare:"String",
createdById:"ID",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "boardTheme",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"boardTheme": {
"id": "ID",
"name": "String",
"lightSquare": "String",
"darkSquare": "String",
"isPublished": "Boolean",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Boardthemes API
[Default list API] — This is the designated default list API for the boardTheme data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List board themes. Filter by isPublished for community themes or createdById for user’s own.
API Frontend Description By The Backend Architect
Used to load user’s custom themes and community-published themes.
Rest Route
The listBoardThemes API REST controller can be triggered via the following route:
/v1/boardthemes
Rest Request Parameters
Filter Parameters
The listBoardThemes api supports 1 optional filter parameter for filtering list results:
isPublished (Boolean): Whether the theme is publicly visible
- True:
?isPublished=true - False:
?isPublished=false - Null:
?isPublished=null
REST Request To access the api you can use the REST controller with the path GET /v1/boardthemes
axios({
method: 'GET',
url: '/v1/boardthemes',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// isPublished: '<value>' // Filter by isPublished
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "boardThemes",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"boardThemes": [
{
"id": "ID",
"name": "String",
"lightSquare": "String",
"darkSquare": "String",
"isPublished": "Boolean",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Update Boardtheme API
[Default update API] — This is the designated default update API for the boardTheme data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update a custom board theme. Only creator can update.
API Frontend Description By The Backend Architect
Used to edit theme colors/name or publish/unpublish.
Rest Route
The updateBoardTheme API REST controller can be triggered via the following route:
/v1/boardthemes/:boardThemeId
Rest Request Parameters
The updateBoardTheme api has got 5 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| boardThemeId | ID | true | request.params?.[“boardThemeId”] |
| name | String | false | request.body?.[“name”] |
| lightSquare | String | false | request.body?.[“lightSquare”] |
| darkSquare | String | false | request.body?.[“darkSquare”] |
| isPublished | Boolean | false | request.body?.[“isPublished”] |
| boardThemeId : This id paremeter is used to select the required data object that will be updated | |||
| name : Theme display name | |||
| lightSquare : Hex color for light squares | |||
| darkSquare : Hex color for dark squares | |||
| isPublished : Whether the theme is publicly visible |
REST Request To access the api you can use the REST controller with the path PATCH /v1/boardthemes/:boardThemeId
axios({
method: 'PATCH',
url: `/v1/boardthemes/${boardThemeId}`,
data: {
name:"String",
lightSquare:"String",
darkSquare:"String",
isPublished:"Boolean",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "boardTheme",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"boardTheme": {
"id": "ID",
"name": "String",
"lightSquare": "String",
"darkSquare": "String",
"isPublished": "Boolean",
"createdById": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Boardtheme API
[Default delete API] — This is the designated default delete API for the boardTheme data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Delete a custom board theme (soft-delete). Only creator can delete.
API Frontend Description By The Backend Architect
Used to remove user’s custom theme.
Rest Route
The deleteBoardTheme API REST controller can be triggered via the following route:
/v1/boardthemes/:boardThemeId
Rest Request Parameters
The deleteBoardTheme api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| boardThemeId | ID | true | request.params?.[“boardThemeId”] |
| boardThemeId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/boardthemes/:boardThemeId
axios({
method: 'DELETE',
url: `/v1/boardthemes/${boardThemeId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "boardTheme",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"boardTheme": {
"id": "ID",
"name": "String",
"lightSquare": "String",
"darkSquare": "String",
"isPublished": "Boolean",
"createdById": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Create Userpreference API
[Default create API] — This is the designated default create API for the userPreference data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create user preferences record. One per user, auto-sets userId from session.
API Frontend Description By The Backend Architect
Called once when user first changes a preference. userId is auto-set.
Rest Route
The createUserPreference API REST controller can be triggered via the following route:
/v1/userpreferences
Rest Request Parameters
The createUserPreference api has got 6 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.body?.[“userId”] |
| activeThemeId | String | false | request.body?.[“activeThemeId”] |
| soundEnabled | Boolean | false | request.body?.[“soundEnabled”] |
| showAnimations | Boolean | false | request.body?.[“showAnimations”] |
| boardOrientation | Enum | false | request.body?.[“boardOrientation”] |
| premoveEnabled | Boolean | false | request.body?.[“premoveEnabled”] |
| userId : The user this preferences record belongs to | |||
| activeThemeId : ID of the currently selected board theme (preset ID or custom theme ID) | |||
| soundEnabled : Whether game sounds are enabled | |||
| showAnimations : Whether board animations are shown | |||
| boardOrientation : Default board orientation preference | |||
| premoveEnabled : Whether premove feature is enabled |
REST Request To access the api you can use the REST controller with the path POST /v1/userpreferences
axios({
method: 'POST',
url: '/v1/userpreferences',
data: {
userId:"ID",
activeThemeId:"String",
soundEnabled:"Boolean",
showAnimations:"Boolean",
boardOrientation:"Enum",
premoveEnabled:"Boolean",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userPreference",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"userPreference": {
"id": "ID",
"userId": "ID",
"activeThemeId": "String",
"soundEnabled": "Boolean",
"showAnimations": "Boolean",
"boardOrientation": "Enum",
"boardOrientation_idx": "Integer",
"premoveEnabled": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Userpreference API
[Default update API] — This is the designated default update API for the userPreference data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update user preferences. Only the owner can update their own preferences.
API Frontend Description By The Backend Architect
Called when user changes theme, sound, animation, or other settings.
Rest Route
The updateUserPreference API REST controller can be triggered via the following route:
/v1/userpreferences/:userPreferenceId
Rest Request Parameters
The updateUserPreference api has got 6 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userPreferenceId | ID | true | request.params?.[“userPreferenceId”] |
| activeThemeId | String | false | request.body?.[“activeThemeId”] |
| soundEnabled | Boolean | false | request.body?.[“soundEnabled”] |
| showAnimations | Boolean | false | request.body?.[“showAnimations”] |
| boardOrientation | Enum | false | request.body?.[“boardOrientation”] |
| premoveEnabled | Boolean | false | request.body?.[“premoveEnabled”] |
| userPreferenceId : This id paremeter is used to select the required data object that will be updated | |||
| activeThemeId : ID of the currently selected board theme (preset ID or custom theme ID) | |||
| soundEnabled : Whether game sounds are enabled | |||
| showAnimations : Whether board animations are shown | |||
| boardOrientation : Default board orientation preference | |||
| premoveEnabled : Whether premove feature is enabled |
REST Request To access the api you can use the REST controller with the path PATCH /v1/userpreferences/:userPreferenceId
axios({
method: 'PATCH',
url: `/v1/userpreferences/${userPreferenceId}`,
data: {
activeThemeId:"String",
soundEnabled:"Boolean",
showAnimations:"Boolean",
boardOrientation:"Enum",
premoveEnabled:"Boolean",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userPreference",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"userPreference": {
"id": "ID",
"userId": "ID",
"activeThemeId": "String",
"soundEnabled": "Boolean",
"showAnimations": "Boolean",
"boardOrientation": "Enum",
"boardOrientation_idx": "Integer",
"premoveEnabled": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Userpreference API
[Default get API] — This is the designated default get API for the userPreference data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a user’s preferences by ID.
API Frontend Description By The Backend Architect
Called on app load to restore user’s preferences.
Rest Route
The getUserPreference API REST controller can be triggered via the following route:
/v1/userpreferences/:userPreferenceId
Rest Request Parameters
The getUserPreference api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userPreferenceId | ID | true | request.params?.[“userPreferenceId”] |
| userPreferenceId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/userpreferences/:userPreferenceId
axios({
method: 'GET',
url: `/v1/userpreferences/${userPreferenceId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userPreference",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userPreference": {
"id": "ID",
"userId": "ID",
"activeThemeId": "String",
"soundEnabled": "Boolean",
"showAnimations": "Boolean",
"boardOrientation": "Enum",
"boardOrientation_idx": "Integer",
"premoveEnabled": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Userpreferences API
[Default list API] — This is the designated default list API for the userPreference data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List user preferences. Filter by userId to get a specific user’s preferences.
API Frontend Description By The Backend Architect
Used to find user’s preference record by userId filter.
Rest Route
The listUserPreferences API REST controller can be triggered via the following route:
/v1/userpreferences
Rest Request Parameters
The listUserPreferences api has got no request parameters.
REST Request To access the api you can use the REST controller with the path GET /v1/userpreferences
axios({
method: 'GET',
url: '/v1/userpreferences',
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userPreferences",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"userPreferences": [
{
"id": "ID",
"userId": "ID",
"activeThemeId": "String",
"soundEnabled": "Boolean",
"showAnimations": "Boolean",
"boardOrientation": "Enum",
"boardOrientation_idx": "Integer",
"premoveEnabled": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
List Gamehubmessages API
[Default list API] — This is the designated default list API for the gameHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List messages in a gameHub hub room. Accessible by admins and room participants.
Rest Route
The listGameHubMessages API REST controller can be triggered via the following route:
/v1/v1/gameHub-messages
Rest Request Parameters
Filter Parameters
The listGameHubMessages api supports 8 optional filter parameters for filtering list results:
roomId (ID): Reference to the room this message belongs to
- Single:
?roomId=<value> - Multiple:
?roomId=<value1>&roomId=<value2> - Null:
?roomId=null
senderId (ID): Reference to the user who sent this message
- Single:
?senderId=<value> - Multiple:
?senderId=<value1>&senderId=<value2> - Null:
?senderId=null
senderName (String): Display name of the sender (denormalized from user profile at send time)
- Single (partial match, case-insensitive):
?senderName=<value> - Multiple:
?senderName=<value1>&senderName=<value2> - Null:
?senderName=null
senderAvatar (String): Avatar URL of the sender (denormalized from user profile at send time)
- Single (partial match, case-insensitive):
?senderAvatar=<value> - Multiple:
?senderAvatar=<value1>&senderAvatar=<value2> - Null:
?senderAvatar=null
messageType (Enum): Content type discriminator for this message
- Single:
?messageType=<value>(case-insensitive) - Multiple:
?messageType=<value1>&messageType=<value2> - Null:
?messageType=null
content (Object): Type-specific content payload (structure depends on messageType)
- Single:
?content=<value> - Multiple:
?content=<value1>&content=<value2> - Null:
?content=null
timestamp (String): Message creation time
- Single (partial match, case-insensitive):
?timestamp=<value> - Multiple:
?timestamp=<value1>×tamp=<value2> - Null:
?timestamp=null
status (Enum): Message moderation status
- Single:
?status=<value>(case-insensitive) - Multiple:
?status=<value1>&status=<value2> - Null:
?status=null
REST Request To access the api you can use the REST controller with the path GET /v1/v1/gameHub-messages
axios({
method: 'GET',
url: '/v1/v1/gameHub-messages',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// roomId: '<value>' // Filter by roomId
// senderId: '<value>' // Filter by senderId
// senderName: '<value>' // Filter by senderName
// senderAvatar: '<value>' // Filter by senderAvatar
// messageType: '<value>' // Filter by messageType
// content: '<value>' // Filter by content
// timestamp: '<value>' // Filter by timestamp
// status: '<value>' // Filter by status
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gameHubMessages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"gameHubMessages": [
{
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Get Gamehubmessage API
[Default get API] — This is the designated default get API for the gameHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a single gameHub hub message by ID.
Rest Route
The getGameHubMessage API REST controller can be triggered via the following route:
/v1/v1/gameHub-messages/:id
Rest Request Parameters
The getGameHubMessage api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| gameHubMessageId | ID | true | request.params?.[“gameHubMessageId”] |
| id | String | true | request.params?.[“id”] |
| gameHubMessageId : This id paremeter is used to query the required data object. | |||
| id : This parameter will be used to select the data object that is queried |
REST Request To access the api you can use the REST controller with the path GET /v1/v1/gameHub-messages/:id
axios({
method: 'GET',
url: `/v1/v1/gameHub-messages/${id}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gameHubMessage",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"gameHubMessage": {
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Gamehubmessage API
[Default delete API] — This is the designated default delete API for the gameHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Delete a gameHub hub message. Admins can delete any message; users can delete their own.
Rest Route
The deleteGameHubMessage API REST controller can be triggered via the following route:
/v1/v1/gameHub-messages/:id
Rest Request Parameters
The deleteGameHubMessage api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| gameHubMessageId | ID | true | request.params?.[“gameHubMessageId”] |
| id | String | true | request.params?.[“id”] |
| gameHubMessageId : This id paremeter is used to select the required data object that will be deleted | |||
| id : This parameter will be used to select the data object that want to be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/v1/gameHub-messages/:id
axios({
method: 'DELETE',
url: `/v1/v1/gameHub-messages/${id}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gameHubMessage",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"gameHubMessage": {
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Gamehubmessage API
[Default update API] — This is the designated default update API for the gameHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update a gameHub hub message content. Only the message sender or admins can edit.
Rest Route
The updateGameHubMessage API REST controller can be triggered via the following route:
/v1/v1/gameHub-messages/:id
Rest Request Parameters
The updateGameHubMessage api has got 4 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| gameHubMessageId | ID | true | request.params?.[“gameHubMessageId”] |
| content | Object | false | request.body?.[“content”] |
| status | Enum | false | request.body?.[“status”] |
| id | String | true | request.params?.[“id”] |
| gameHubMessageId : This id paremeter is used to select the required data object that will be updated | |||
| content : Type-specific content payload (structure depends on messageType) | |||
| status : Message moderation status | |||
| id : This parameter will be used to select the data object that want to be updated |
REST Request To access the api you can use the REST controller with the path PATCH /v1/v1/gameHub-messages/:id
axios({
method: 'PATCH',
url: `/v1/v1/gameHub-messages/${id}`,
data: {
content:"Object",
status:"Enum",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gameHubMessage",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"gameHubMessage": {
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Authentication Specific Routes
Common Routes
Route: currentuser
Route Definition: Retrieves the currently authenticated user’s session information.
Route Type: sessionInfo
Access Route: GET /currentuser
Parameters
This route does not require any request parameters.
Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response Returns the session object, including user-related data and token information.
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
Error Response 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
Notes
- This route is typically used by frontend or mobile applications to fetch the current session state after login.
- The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
- Always ensure a valid access token is provided in the request to retrieve the session.
Route: permissions
*Route Definition*: Retrieves all effective permission records assigned to the currently authenticated user.
*Route Type*: permissionFetch
Access Route: GET /permissions
Parameters
This route does not require any request parameters.
Behavior
- Fetches all active permission records (
givenPermissionsentries) associated with the current user session. - Returns a full array of permission objects.
- Requires a valid session (
access token) to be available.
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
Returns an array of permission objects.
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
Each object reflects a single permission grant, aligned with the givenPermissions model:
**permissionName**: The permission the user has.**roleId**: If the permission was granted through a role. -**subjectUserId**: If directly granted to the user.**subjectUserGroupId**: If granted through a group.**objectId**: If tied to a specific object (OBAC).**canDo**: True or false flag to represent if permission is active or restricted.
Error Responses
- 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
- 500 Internal Server Error: Unexpected error fetching permissions.
Notes
- The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
- Auth service: Fetches permissions freshly from the live database (givenPermissions table).
- Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
Tip: Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
Route: permissions/:permissionName
Route Definition: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
Route Type: permissionScopeCheck
Access Route: GET /permissions/:permissionName
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| permissionName | String | Yes | request.params.permissionName |
Behavior
- Evaluates whether the current user has access to the given
permissionName. - Returns a structured object indicating:
- Whether the permission is generally granted (
canDo) - Which object IDs are explicitly included or excluded from access (
exceptions)
- Whether the permission is generally granted (
- Requires a valid session (
access token).
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
- If
canDoistrue, the user generally has the permission, but not for the objects listed inexceptions(i.e., restrictions). - If
canDoisfalse, the user does not have the permission by default — but only for the objects inexceptions, they do have permission (i.e., selective overrides). - The exceptions array contains valid UUID strings, each corresponding to an object ID (typically from the data model targeted by the permission).
Copyright
All sources, documents and other digital materials are copyright of .
About Us
For more information please visit our website: .
. .
REST API GUIDE
wechess-lobbychat-service
Version: 1.0.24
Public lobby chat microservice. Manages create, list, reporting, moderation, and 24-hour message expiry for guest/registered users.
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to . For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the LobbyChat Service’s REST API. This document is designed to provide a comprehensive guide to interfacing with our LobbyChat Service exclusively through RESTful API endpoints.
Intended Audience
This documentation is intended for developers and integrators who are looking to interact with the LobbyChat Service via HTTP requests for purposes such as creating, updating, deleting and querying LobbyChat objects.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST It’s important to note that the LobbyChat Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Authentication And Authorization
To ensure secure access to the LobbyChat service’s protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it’s important to note that access control varies across different routes:
Protected API: Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **: The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
|---|---|
| Query | access_token |
| Authorization Header | Bearer |
| Header | wechess-access-token |
| Cookie | wechess-access-token |
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
Api Definitions
This section outlines the API endpoints available within the LobbyChat service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It’s important to understand the flexibility in how parameters can be included in requests to effectively interact with the LobbyChat service.
This service is configured to listen for HTTP requests on port 3002,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
- API Test Interface (API Face):
/ - Swagger Documentation:
/swagger - Postman Collection Download:
/getPostmanCollection - Health Checks:
/healthand/admin/health - Current Session Info:
/currentuser - Favicon:
/favicon.ico
This service is accessible via the following environment-specific URLs:
- Preview:
https://wechess.prw.mindbricks.com/lobbychat-api - Staging:
https://wechess-stage.mindbricks.co/lobbychat-api - Production:
https://wechess.mindbricks.co/lobbychat-api
Parameter Inclusion Methods: Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
Query Parameters: Included directly in the URL’s query string.
Path Parameters: Embedded within the URL’s path.
Body Parameters: Sent within the JSON body of the request.
Session Parameters: Automatically read from the session object. This method is used for parameters that are intrinsic to the user’s session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
Note on Session Parameters: Session parameters represent a unique method of parameter inclusion, relying on the context of the user’s session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the LobbyChat service’s API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
Common Parameters
The LobbyChat service’s business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
Supported Common Parameters:
-
getJoins (BOOLEAN): Controls whether to retrieve associated objects along with the main object. By default,
getJoinsis assumed to betrue. Set it tofalseif you prefer to receive only the main fields of an object, excluding its associations. -
excludeCQRS (BOOLEAN): Applicable only when
getJoinsistrue. By default,excludeCQRSis set tofalse. Enabling this parameter (true) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage. -
requestId (String): Identifies a request to enable tracking through the service’s log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom
requestId, simply include it in your query parameters. -
caching (BOOLEAN): Determines the use of caching for query API. By default, caching is enabled (
true). To ensure the freshest data directly from the database, set this parameter tofalse, bypassing the cache. -
cacheTTL (Integer): Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for
get listqueries. Setting a customcacheTTLallows you to fine-tune the cache lifespan to meet your needs. -
pageNumber (Integer): For paginated
get listAPI’s, this parameter selects which page of results to retrieve. The default is1, indicating the first page. To disable pagination and retrieve all results, setpageNumberto0. -
pageRowCount (Integer): In conjunction with paginated API’s, this parameter defines the number of records per page. The default value is
25. AdjustingpageRowCountallows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the LobbyChat service.
Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- 401 Unauthorized: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Object Structure of a Successfull Response
When the LobbyChat service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
Key Characteristics of the Response Envelope:
-
Data Presentation: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- Creation and Update API: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- Delete API: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- Get Requests: A single data object is returned in JSON format.
- Get List Requests: An array of data objects is provided, reflecting a collection of resources.
-
Data Structure and Joins: The complexity of the data structure in the response can vary based on the API’s architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- Pure Data Forms: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- Extended Data Forms: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- Join Varieties: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
Design Considerations: The structure of a API’s response data is meticulously crafted during the service’s architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
Brief Data: Certain API’s return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
HTTP Status Codes:
- 200 OK: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- 201 Created: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
Success Response Format:
For successful operations, the response includes a "status": "OK" property, signaling the successful execution of the request. The structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
Handling Errors:
For details on handling error scenarios and understanding the structure of error responses, please refer to the “Error Response” section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
Resources
LobbyChat service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
LobbyMessage resource
Resource Definition : A single lobby/public chat message between any logged-in user (guest, registered, admin). Ephemeral (24h retention), with reporting and moderation support. Muting is tracked by senderId+mutedUntil for punishment management. LobbyMessage Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| senderId | ID | User ID (guest or registered) who sent the message. References auth:user.id. | ||
| senderDisplayName | String | Display name (from user fullname at send time; allows historical display even if name changes). | ||
| content | String | Chat message body (limited at UI, backend-enforces not empty; max 500 chars). | ||
| sentAt | Date | UTC timestamp when message was sent. Used to enforce 24h retention and sorting. | ||
| reportStatus | Enum | Moderation/report workflow state: none (default), reported (user), underReview (admin). | ||
| mutedUntil | Date | If set, the message sender is muted in the lobby until this timestamp. Only admins may set. Used with senderId for lookup on enforcement. | ||
| removed | Boolean | If true, message is hidden/removed by admin moderation (soft-remove). | ||
| roomId | String | Daily room identifier (lobby-YYYY-MM-DD). Scopes message to that day. |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
reportStatus Enum Property
Property Definition : Moderation/report workflow state: none (default), reported (user), underReview (admin).Enum Options
| Name | Value | Index |
|---|---|---|
| none | "none"" |
0 |
| reported | "reported"" |
1 |
| underReview | "underReview"" |
2 |
LobbyRoom resource
Resource Definition : Daily lobby chat room. One record per day (roomId format: lobby-YYYY-MM-DD). Older rooms kept as history. LobbyRoom Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| roomId | String | Room identifier, e.g. lobby-2026-03-10 |
LobbyChatHubMessage resource
Resource Definition : Auto-generated message DataObject for the lobbyChatHub RealtimeHub. Stores all messages with typed content payloads. LobbyChatHubMessage Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| roomId | ID | Reference to the room this message belongs to | ||
| senderId | ID | Reference to the user who sent this message | ||
| senderName | String | Display name of the sender (denormalized from user profile at send time) | ||
| senderAvatar | String | Avatar URL of the sender (denormalized from user profile at send time) | ||
| messageType | Enum | Content type discriminator for this message | ||
| content | Object | Type-specific content payload (structure depends on messageType) | ||
| timestamp | Message creation time | |||
| status | Enum | Message moderation status | ||
| reaction | Object | Emoji reactions [{ emoji, userId, timestamp }] |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
messageType Enum Property
Property Definition : Content type discriminator for this messageEnum Options
| Name | Value | Index |
|---|---|---|
| text | "text"" |
0 |
| system | "system"" |
1 |
status Enum Property
Property Definition : Message moderation statusEnum Options
| Name | Value | Index |
|---|---|---|
| pending | "pending"" |
0 |
| approved | "approved"" |
1 |
| rejected | "rejected"" |
2 |
LobbyChatHubModeration resource
Resource Definition : Auto-generated moderation DataObject for the lobbyChatHub RealtimeHub. Stores block and silence actions for room-level user moderation. LobbyChatHubModeration Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| roomId | ID | Reference to the room where the moderation action applies | ||
| userId | ID | The user who is blocked or silenced | ||
| action | Enum | Moderation action type | ||
| reason | Text | Optional reason for the moderation action | ||
| duration | Integer | Duration in seconds. 0 means permanent | ||
| expiresAt | Expiry timestamp. Null means permanent | |||
| issuedBy | ID | The moderator who issued the action |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
action Enum Property
Property Definition : Moderation action typeEnum Options
| Name | Value | Index |
|---|---|---|
| blocked | "blocked"" |
0 |
| silenced | "silenced"" |
1 |
Business Api
Create Lobbymessage API
[Default create API] — This is the designated default create API for the lobbyMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Post a new lobby chat message. Enforces mute (mutedUntil > now), ensures message is not empty and under 500 chars. SenderId and senderDisplayName are populated from session.
API Frontend Description By The Backend Architect
- Attempts to send a message as a muted user yield an immediate error and UI block for sending.
- Messages must be non-empty, max 500 chars.
- Name shown is from session context at send time (persists if user later changes display name).
- Guests allowed; no editing or “threading”.
- No images/files — plain text only.
Rest Route
The createLobbyMessage API REST controller can be triggered via the following route:
/v1/lobbymessages
Rest Request Parameters
The createLobbyMessage api has got 8 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| senderId | ID | true | request.body?.[“senderId”] |
| senderDisplayName | String | true | request.body?.[“senderDisplayName”] |
| content | String | true | request.body?.[“content”] |
| sentAt | Date | true | request.body?.[“sentAt”] |
| reportStatus | Enum | true | request.body?.[“reportStatus”] |
| mutedUntil | Date | false | request.body?.[“mutedUntil”] |
| removed | Boolean | true | request.body?.[“removed”] |
| roomId | String | true | request.body?.[“roomId”] |
| senderId : User ID (guest or registered) who sent the message. References auth:user.id. | |||
| senderDisplayName : Display name (from user fullname at send time; allows historical display even if name changes). | |||
| content : Chat message body (limited at UI, backend-enforces not empty; max 500 chars). | |||
| sentAt : UTC timestamp when message was sent. Used to enforce 24h retention and sorting. | |||
| reportStatus : Moderation/report workflow state: none (default), reported (user), underReview (admin). | |||
| mutedUntil : If set, the message sender is muted in the lobby until this timestamp. Only admins may set. Used with senderId for lookup on enforcement. | |||
| removed : If true, message is hidden/removed by admin moderation (soft-remove). | |||
| roomId : Daily room identifier (lobby-YYYY-MM-DD). Scopes message to that day. |
REST Request To access the api you can use the REST controller with the path POST /v1/lobbymessages
axios({
method: 'POST',
url: '/v1/lobbymessages',
data: {
senderId:"ID",
senderDisplayName:"String",
content:"String",
sentAt:"Date",
reportStatus:"Enum",
mutedUntil:"Date",
removed:"Boolean",
roomId:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyMessage",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"lobbyMessage": {
"id": "ID",
"senderId": "ID",
"senderDisplayName": "String",
"content": "String",
"sentAt": "Date",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"mutedUntil": "Date",
"removed": "Boolean",
"roomId": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
List Lobbymessages API
[Default list API] — This is the designated default list API for the lobbyMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Fetch latest lobby chat messages from the last 24 hours (not removed). Sorted sentAt desc. Paginated by default (50 per page).
API Frontend Description By The Backend Architect
- Displays newest messages first (descending by sentAt).
- Returns only unremoved messages from last 24h.
- Loading more (scroll/pagination) only fetches within valid 24h window.
- Guests and registered users can access.
- If no messages available, renders empty chat UI.
- Default page size: 50.
Rest Route
The listLobbyMessages API REST controller can be triggered via the following route:
/v1/listlobbymessages/:roomId
Rest Request Parameters
The listLobbyMessages api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| roomId | String | true | request.params?.[“roomId”] |
| roomId : Daily room identifier (lobby-YYYY-MM-DD). Scopes message to that day… The parameter is used to query data. |
REST Request To access the api you can use the REST controller with the path GET /v1/listlobbymessages/:roomId
axios({
method: 'GET',
url: `/v1/listlobbymessages/${roomId}`,
data: {
},
params: {
}
});
REST Response
This route’s response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyMessages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"lobbyMessages": [
{
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Update Lobbymessagemoderation API
[Default update API] — This is the designated default update API for the lobbyMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update message for moderation: only admins may set removed (true), mutedUntil, or set reportStatus to underReview. All users may set reportStatus to reported on a message they wish to report. Message owner may not update content or displayName.
API Frontend Description By The Backend Architect
- If admin sets removed, UI and API should treat as deleted for all users.
- Admins can mute a sender (sets mutedUntil on relevant messages; for send-prevention, check most recent value).
- Users may only set reportStatus to ‘reported’ for reporting flows, only once per message. Duplication is tolerated silently.
- No editing of content allowed.
Rest Route
The updateLobbyMessageModeration API REST controller can be triggered via the following route:
/v1/lobbymessagemoderation/:lobbyMessageId
Rest Request Parameters
The updateLobbyMessageModeration api has got 5 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| lobbyMessageId | ID | true | request.params?.[“lobbyMessageId”] |
| reportStatus | Enum | false | request.body?.[“reportStatus”] |
| mutedUntil | Date | false | request.body?.[“mutedUntil”] |
| removed | Boolean | false | request.body?.[“removed”] |
| roomId | String | false | request.body?.[“roomId”] |
| lobbyMessageId : This id paremeter is used to select the required data object that will be updated | |||
| reportStatus : Moderation/report workflow state: none (default), reported (user), underReview (admin). | |||
| mutedUntil : If set, the message sender is muted in the lobby until this timestamp. Only admins may set. Used with senderId for lookup on enforcement. | |||
| removed : If true, message is hidden/removed by admin moderation (soft-remove). | |||
| roomId : Daily room identifier (lobby-YYYY-MM-DD). Scopes message to that day. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/lobbymessagemoderation/:lobbyMessageId
axios({
method: 'PATCH',
url: `/v1/lobbymessagemoderation/${lobbyMessageId}`,
data: {
reportStatus:"Enum",
mutedUntil:"Date",
removed:"Boolean",
roomId:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyMessage",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"lobbyMessage": {
"id": "ID",
"senderId": "ID",
"senderDisplayName": "String",
"content": "String",
"sentAt": "Date",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"mutedUntil": "Date",
"removed": "Boolean",
"roomId": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
Delete Lobbymessage API
[Default delete API] — This is the designated default delete API for the lobbyMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Physical delete of a lobby message (should only be possible for admin batch/cleanup or hard moderation). In practice, most moderation is via removed:true.
API Frontend Description By The Backend Architect
- Admin-only; normal users cannot hard-delete any message.
- UI presents “removed” status using removed:true; only admin ‘expunge’ actually deletes DB row.
- Cron clean/purge uses this API to destroy messages older than 24h.
Rest Route
The deleteLobbyMessage API REST controller can be triggered via the following route:
/v1/lobbymessages/:lobbyMessageId
Rest Request Parameters
The deleteLobbyMessage api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| lobbyMessageId | ID | true | request.params?.[“lobbyMessageId”] |
| lobbyMessageId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/lobbymessages/:lobbyMessageId
axios({
method: 'DELETE',
url: `/v1/lobbymessages/${lobbyMessageId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyMessage",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"lobbyMessage": {
"id": "ID",
"senderId": "ID",
"senderDisplayName": "String",
"content": "String",
"sentAt": "Date",
"reportStatus": "Enum",
"reportStatus_idx": "Integer",
"mutedUntil": "Date",
"removed": "Boolean",
"roomId": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": false
}
}
Ensure Lobbyroom API
Rest Route
The ensureLobbyRoom API REST controller can be triggered via the following route:
/v1/ensurelobbyroom
Rest Request Parameters
The ensureLobbyRoom api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| roomId | String | true | request.body?.[“roomId”] |
| roomId : Room identifier, e.g. lobby-2026-03-10 |
REST Request To access the api you can use the REST controller with the path POST /v1/ensurelobbyroom
axios({
method: 'POST',
url: '/v1/ensurelobbyroom',
data: {
roomId:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyRoom",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"lobbyRoom": {
"id": "ID",
"roomId": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Lobbyrooms API
Rest Route
The listLobbyRooms API REST controller can be triggered via the following route:
/v1/listlobbyrooms/:roomId
Rest Request Parameters
The listLobbyRooms api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| roomId | String | true | request.params?.[“roomId”] |
| roomId : Room identifier, e.g. lobby-2026-03-10. The parameter is used to query data. |
REST Request To access the api you can use the REST controller with the path GET /v1/listlobbyrooms/:roomId
axios({
method: 'GET',
url: `/v1/listlobbyrooms/${roomId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyRooms",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"lobbyRooms": [
{
"id": "ID",
"roomId": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
List Lobbychathubmessages API
[Default list API] — This is the designated default list API for the lobbyChatHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List messages in a lobbyChatHub hub room. Accessible by admins and room participants.
Rest Route
The listLobbyChatHubMessages API REST controller can be triggered via the following route:
/v1/v1/lobbyChatHub-messages
Rest Request Parameters
Filter Parameters
The listLobbyChatHubMessages api supports 9 optional filter parameters for filtering list results:
roomId (ID): Reference to the room this message belongs to
- Single:
?roomId=<value> - Multiple:
?roomId=<value1>&roomId=<value2> - Null:
?roomId=null
senderId (ID): Reference to the user who sent this message
- Single:
?senderId=<value> - Multiple:
?senderId=<value1>&senderId=<value2> - Null:
?senderId=null
senderName (String): Display name of the sender (denormalized from user profile at send time)
- Single (partial match, case-insensitive):
?senderName=<value> - Multiple:
?senderName=<value1>&senderName=<value2> - Null:
?senderName=null
senderAvatar (String): Avatar URL of the sender (denormalized from user profile at send time)
- Single (partial match, case-insensitive):
?senderAvatar=<value> - Multiple:
?senderAvatar=<value1>&senderAvatar=<value2> - Null:
?senderAvatar=null
messageType (Enum): Content type discriminator for this message
- Single:
?messageType=<value>(case-insensitive) - Multiple:
?messageType=<value1>&messageType=<value2> - Null:
?messageType=null
content (Object): Type-specific content payload (structure depends on messageType)
- Single:
?content=<value> - Multiple:
?content=<value1>&content=<value2> - Null:
?content=null
timestamp (String): Message creation time
- Single (partial match, case-insensitive):
?timestamp=<value> - Multiple:
?timestamp=<value1>×tamp=<value2> - Null:
?timestamp=null
status (Enum): Message moderation status
- Single:
?status=<value>(case-insensitive) - Multiple:
?status=<value1>&status=<value2> - Null:
?status=null
reaction (Object): Emoji reactions [{ emoji, userId, timestamp }]
- Single:
?reaction=<value> - Multiple:
?reaction=<value1>&reaction=<value2> - Null:
?reaction=null
REST Request To access the api you can use the REST controller with the path GET /v1/v1/lobbyChatHub-messages
axios({
method: 'GET',
url: '/v1/v1/lobbyChatHub-messages',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// roomId: '<value>' // Filter by roomId
// senderId: '<value>' // Filter by senderId
// senderName: '<value>' // Filter by senderName
// senderAvatar: '<value>' // Filter by senderAvatar
// messageType: '<value>' // Filter by messageType
// content: '<value>' // Filter by content
// timestamp: '<value>' // Filter by timestamp
// status: '<value>' // Filter by status
// reaction: '<value>' // Filter by reaction
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyChatHubMessages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"lobbyChatHubMessages": [
{
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"reaction": "Object",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Get Lobbychathubmessage API
[Default get API] — This is the designated default get API for the lobbyChatHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a single lobbyChatHub hub message by ID.
Rest Route
The getLobbyChatHubMessage API REST controller can be triggered via the following route:
/v1/v1/lobbyChatHub-messages/:id
Rest Request Parameters
The getLobbyChatHubMessage api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| lobbyChatHubMessageId | ID | true | request.params?.[“lobbyChatHubMessageId”] |
| id | String | true | request.params?.[“id”] |
| lobbyChatHubMessageId : This id paremeter is used to query the required data object. | |||
| id : This parameter will be used to select the data object that is queried |
REST Request To access the api you can use the REST controller with the path GET /v1/v1/lobbyChatHub-messages/:id
axios({
method: 'GET',
url: `/v1/v1/lobbyChatHub-messages/${id}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyChatHubMessage",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"lobbyChatHubMessage": {
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"reaction": "Object",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Lobbychathubmessage API
[Default delete API] — This is the designated default delete API for the lobbyChatHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Delete a lobbyChatHub hub message. Admins can delete any message; users can delete their own.
Rest Route
The deleteLobbyChatHubMessage API REST controller can be triggered via the following route:
/v1/v1/lobbyChatHub-messages/:id
Rest Request Parameters
The deleteLobbyChatHubMessage api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| lobbyChatHubMessageId | ID | true | request.params?.[“lobbyChatHubMessageId”] |
| id | String | true | request.params?.[“id”] |
| lobbyChatHubMessageId : This id paremeter is used to select the required data object that will be deleted | |||
| id : This parameter will be used to select the data object that want to be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/v1/lobbyChatHub-messages/:id
axios({
method: 'DELETE',
url: `/v1/v1/lobbyChatHub-messages/${id}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyChatHubMessage",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"lobbyChatHubMessage": {
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"reaction": "Object",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Lobbychathubmessage API
[Default update API] — This is the designated default update API for the lobbyChatHubMessage data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update a lobbyChatHub hub message content. Only the message sender or admins can edit.
Rest Route
The updateLobbyChatHubMessage API REST controller can be triggered via the following route:
/v1/v1/lobbyChatHub-messages/:id
Rest Request Parameters
The updateLobbyChatHubMessage api has got 5 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| lobbyChatHubMessageId | ID | true | request.params?.[“lobbyChatHubMessageId”] |
| content | Object | false | request.body?.[“content”] |
| status | Enum | false | request.body?.[“status”] |
| reaction | Object | false | request.body?.[“reaction”] |
| id | String | true | request.params?.[“id”] |
| lobbyChatHubMessageId : This id paremeter is used to select the required data object that will be updated | |||
| content : Type-specific content payload (structure depends on messageType) | |||
| status : Message moderation status | |||
| reaction : Emoji reactions [{ emoji, userId, timestamp }] | |||
| id : This parameter will be used to select the data object that want to be updated |
REST Request To access the api you can use the REST controller with the path PATCH /v1/v1/lobbyChatHub-messages/:id
axios({
method: 'PATCH',
url: `/v1/v1/lobbyChatHub-messages/${id}`,
data: {
content:"Object",
status:"Enum",
reaction:"Object",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "lobbyChatHubMessage",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"lobbyChatHubMessage": {
"id": "ID",
"roomId": "ID",
"senderId": "ID",
"senderName": "String",
"senderAvatar": "String",
"messageType": "Enum",
"messageType_idx": "Integer",
"content": "Object",
"timestamp": null,
"status": "Enum",
"status_idx": "Integer",
"reaction": "Object",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Authentication Specific Routes
Common Routes
Route: currentuser
Route Definition: Retrieves the currently authenticated user’s session information.
Route Type: sessionInfo
Access Route: GET /currentuser
Parameters
This route does not require any request parameters.
Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response Returns the session object, including user-related data and token information.
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
Error Response 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
Notes
- This route is typically used by frontend or mobile applications to fetch the current session state after login.
- The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
- Always ensure a valid access token is provided in the request to retrieve the session.
Route: permissions
*Route Definition*: Retrieves all effective permission records assigned to the currently authenticated user.
*Route Type*: permissionFetch
Access Route: GET /permissions
Parameters
This route does not require any request parameters.
Behavior
- Fetches all active permission records (
givenPermissionsentries) associated with the current user session. - Returns a full array of permission objects.
- Requires a valid session (
access token) to be available.
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
Returns an array of permission objects.
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
Each object reflects a single permission grant, aligned with the givenPermissions model:
**permissionName**: The permission the user has.**roleId**: If the permission was granted through a role. -**subjectUserId**: If directly granted to the user.**subjectUserGroupId**: If granted through a group.**objectId**: If tied to a specific object (OBAC).**canDo**: True or false flag to represent if permission is active or restricted.
Error Responses
- 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
- 500 Internal Server Error: Unexpected error fetching permissions.
Notes
- The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
- Auth service: Fetches permissions freshly from the live database (givenPermissions table).
- Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
Tip: Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
Route: permissions/:permissionName
Route Definition: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
Route Type: permissionScopeCheck
Access Route: GET /permissions/:permissionName
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| permissionName | String | Yes | request.params.permissionName |
Behavior
- Evaluates whether the current user has access to the given
permissionName. - Returns a structured object indicating:
- Whether the permission is generally granted (
canDo) - Which object IDs are explicitly included or excluded from access (
exceptions)
- Whether the permission is generally granted (
- Requires a valid session (
access token).
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
- If
canDoistrue, the user generally has the permission, but not for the objects listed inexceptions(i.e., restrictions). - If
canDoisfalse, the user does not have the permission by default — but only for the objects inexceptions, they do have permission (i.e., selective overrides). - The exceptions array contains valid UUID strings, each corresponding to an object ID (typically from the data model targeted by the permission).
Copyright
All sources, documents and other digital materials are copyright of .
About Us
For more information please visit our website: .
. .
REST API GUIDE
wechess-leaderboard-service
Version: 1.0.21
Handles ELO/stat computation and leaderboard management for registered players only. Excludes guest users entirely.
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to . For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the Leaderboard Service’s REST API. This document is designed to provide a comprehensive guide to interfacing with our Leaderboard Service exclusively through RESTful API endpoints.
Intended Audience
This documentation is intended for developers and integrators who are looking to interact with the Leaderboard Service via HTTP requests for purposes such as creating, updating, deleting and querying Leaderboard objects.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST It’s important to note that the Leaderboard Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Authentication And Authorization
To ensure secure access to the Leaderboard service’s protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it’s important to note that access control varies across different routes:
Protected API: Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **: The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
|---|---|
| Query | access_token |
| Authorization Header | Bearer |
| Header | wechess-access-token |
| Cookie | wechess-access-token |
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
Api Definitions
This section outlines the API endpoints available within the Leaderboard service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It’s important to understand the flexibility in how parameters can be included in requests to effectively interact with the Leaderboard service.
This service is configured to listen for HTTP requests on port 3001,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
- API Test Interface (API Face):
/ - Swagger Documentation:
/swagger - Postman Collection Download:
/getPostmanCollection - Health Checks:
/healthand/admin/health - Current Session Info:
/currentuser - Favicon:
/favicon.ico
This service is accessible via the following environment-specific URLs:
- Preview:
https://wechess.prw.mindbricks.com/leaderboard-api - Staging:
https://wechess-stage.mindbricks.co/leaderboard-api - Production:
https://wechess.mindbricks.co/leaderboard-api
Parameter Inclusion Methods: Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
Query Parameters: Included directly in the URL’s query string.
Path Parameters: Embedded within the URL’s path.
Body Parameters: Sent within the JSON body of the request.
Session Parameters: Automatically read from the session object. This method is used for parameters that are intrinsic to the user’s session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
Note on Session Parameters: Session parameters represent a unique method of parameter inclusion, relying on the context of the user’s session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the Leaderboard service’s API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
Common Parameters
The Leaderboard service’s business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
Supported Common Parameters:
-
getJoins (BOOLEAN): Controls whether to retrieve associated objects along with the main object. By default,
getJoinsis assumed to betrue. Set it tofalseif you prefer to receive only the main fields of an object, excluding its associations. -
excludeCQRS (BOOLEAN): Applicable only when
getJoinsistrue. By default,excludeCQRSis set tofalse. Enabling this parameter (true) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage. -
requestId (String): Identifies a request to enable tracking through the service’s log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom
requestId, simply include it in your query parameters. -
caching (BOOLEAN): Determines the use of caching for query API. By default, caching is enabled (
true). To ensure the freshest data directly from the database, set this parameter tofalse, bypassing the cache. -
cacheTTL (Integer): Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for
get listqueries. Setting a customcacheTTLallows you to fine-tune the cache lifespan to meet your needs. -
pageNumber (Integer): For paginated
get listAPI’s, this parameter selects which page of results to retrieve. The default is1, indicating the first page. To disable pagination and retrieve all results, setpageNumberto0. -
pageRowCount (Integer): In conjunction with paginated API’s, this parameter defines the number of records per page. The default value is
25. AdjustingpageRowCountallows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the Leaderboard service.
Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- 401 Unauthorized: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Object Structure of a Successfull Response
When the Leaderboard service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
Key Characteristics of the Response Envelope:
-
Data Presentation: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- Creation and Update API: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- Delete API: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- Get Requests: A single data object is returned in JSON format.
- Get List Requests: An array of data objects is provided, reflecting a collection of resources.
-
Data Structure and Joins: The complexity of the data structure in the response can vary based on the API’s architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- Pure Data Forms: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- Extended Data Forms: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- Join Varieties: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
Design Considerations: The structure of a API’s response data is meticulously crafted during the service’s architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
Brief Data: Certain API’s return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
HTTP Status Codes:
- 200 OK: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- 201 Created: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
Success Response Format:
For successful operations, the response includes a "status": "OK" property, signaling the successful execution of the request. The structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
Handling Errors:
For details on handling error scenarios and understanding the structure of error responses, please refer to the “Error Response” section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
Resources
Leaderboard service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
PlayerStats resource
Resource Definition : Stores aggregate stats for a registered chess player: ELO, win/loss history, streak, last game, etc. Excludes guests. One per registered user. PlayerStats Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| userId | ID | The registered user this record belongs to (auth:user.id). | ||
| eloRating | Integer | Current ELO rating for registered player. | ||
| totalGames | Integer | Total completed games (wins + losses + draws) for this player. | ||
| wins | Integer | Number of games won by the player. | ||
| losses | Integer | Number of games lost by the player. | ||
| draws | Integer | Number of drawn games by the player. | ||
| streak | Integer | Current win or loss streak. Positive=win streak, negative=loss streak, 0=none/neutral. | ||
| lastGameAt | Date | Timestamp of last completed game for user. | ||
| username | String | Display name for the player, publicly visible. |
LeaderboardEntry resource
Resource Definition : Holds global leaderboard standings for registered players. Rank, ELO, and season support. Excludes guests. LeaderboardEntry Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| userId | ID | The registered user this leaderboard entry represents. | ||
| currentRank | Integer | Current leaderboard rank (1=top). Lower is better. | ||
| eloRating | Integer | Player's current ELO rating (copy from playerStats). | ||
| season | String | Leaderboard season identifier (null for all-time/global, can be set for seasonal leaderboards as needed). | ||
| lastRankChangeAt | Date | Timestamp of last rank change/leaderboard update. | ||
| username | String | Display name for the player, publicly visible on leaderboard. |
Business Api
Create Playerstats API
[Default create API] — This is the designated default create API for the playerStats data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a player stats record for a newly registered player. Only registered users (never guests) should have this object. Typically used at registration or conversion.
API Frontend Description By The Backend Architect
Called only at registration or on converting guest to registered. Prepares stats for profile display.
Rest Route
The createPlayerStats API REST controller can be triggered via the following route:
/v1/playerstatses
Rest Request Parameters
The createPlayerStats api has got 9 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.body?.[“userId”] |
| eloRating | Integer | true | request.body?.[“eloRating”] |
| totalGames | Integer | true | request.body?.[“totalGames”] |
| wins | Integer | true | request.body?.[“wins”] |
| losses | Integer | true | request.body?.[“losses”] |
| draws | Integer | true | request.body?.[“draws”] |
| streak | Integer | true | request.body?.[“streak”] |
| lastGameAt | Date | false | request.body?.[“lastGameAt”] |
| username | String | false | request.body?.[“username”] |
| userId : The registered user this record belongs to (auth:user.id). | |||
| eloRating : Current ELO rating for registered player. | |||
| totalGames : Total completed games (wins + losses + draws) for this player. | |||
| wins : Number of games won by the player. | |||
| losses : Number of games lost by the player. | |||
| draws : Number of drawn games by the player. | |||
| streak : Current win or loss streak. Positive=win streak, negative=loss streak, 0=none/neutral. | |||
| lastGameAt : Timestamp of last completed game for user. | |||
| username : Display name for the player, publicly visible. |
REST Request To access the api you can use the REST controller with the path POST /v1/playerstatses
axios({
method: 'POST',
url: '/v1/playerstatses',
data: {
userId:"ID",
eloRating:"Integer",
totalGames:"Integer",
wins:"Integer",
losses:"Integer",
draws:"Integer",
streak:"Integer",
lastGameAt:"Date",
username:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "playerStats",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"playerStats": {
"id": "ID",
"userId": "ID",
"eloRating": "Integer",
"totalGames": "Integer",
"wins": "Integer",
"losses": "Integer",
"draws": "Integer",
"streak": "Integer",
"lastGameAt": "Date",
"username": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Playerstats API
[Default update API] — This is the designated default update API for the playerStats data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update player statistics when a game completes. Only called for registered users by gameplay service (M2M) or admin; guests not allowed.
API Frontend Description By The Backend Architect
System/gameplay triggers this to update stats at game end. Never called for guests.
Rest Route
The updatePlayerStats API REST controller can be triggered via the following route:
/v1/playerstatses/:playerStatsId
Rest Request Parameters
The updatePlayerStats api has got 9 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| playerStatsId | ID | true | request.params?.[“playerStatsId”] |
| eloRating | Integer | true | request.body?.[“eloRating”] |
| totalGames | Integer | true | request.body?.[“totalGames”] |
| wins | Integer | true | request.body?.[“wins”] |
| losses | Integer | true | request.body?.[“losses”] |
| draws | Integer | true | request.body?.[“draws”] |
| streak | Integer | true | request.body?.[“streak”] |
| lastGameAt | Date | false | request.body?.[“lastGameAt”] |
| username | String | false | request.body?.[“username”] |
| playerStatsId : This id paremeter is used to select the required data object that will be updated | |||
| eloRating : Current ELO rating for registered player. | |||
| totalGames : Total completed games (wins + losses + draws) for this player. | |||
| wins : Number of games won by the player. | |||
| losses : Number of games lost by the player. | |||
| draws : Number of drawn games by the player. | |||
| streak : Current win or loss streak. Positive=win streak, negative=loss streak, 0=none/neutral. | |||
| lastGameAt : Timestamp of last completed game for user. | |||
| username : Display name for the player, publicly visible. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/playerstatses/:playerStatsId
axios({
method: 'PATCH',
url: `/v1/playerstatses/${playerStatsId}`,
data: {
eloRating:"Integer",
totalGames:"Integer",
wins:"Integer",
losses:"Integer",
draws:"Integer",
streak:"Integer",
lastGameAt:"Date",
username:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "playerStats",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"playerStats": {
"id": "ID",
"userId": "ID",
"eloRating": "Integer",
"totalGames": "Integer",
"wins": "Integer",
"losses": "Integer",
"draws": "Integer",
"streak": "Integer",
"lastGameAt": "Date",
"username": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Playerstats API
[Default get API] — This is the designated default get API for the playerStats data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Fetch a single registered user’s player stats (private to user or admin).
API Frontend Description By The Backend Architect
Used to display profile stats. User can only view own; admin can view any.
Rest Route
The getPlayerStats API REST controller can be triggered via the following route:
/v1/playerstatses/:userId
Rest Request Parameters
The getPlayerStats api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : The registered user this record belongs to (auth:user.id)… The parameter is used to query data. |
REST Request To access the api you can use the REST controller with the path GET /v1/playerstatses/:userId
axios({
method: 'GET',
url: `/v1/playerstatses/${userId}`,
data: {
},
params: {
}
});
REST Response
This route’s response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "playerStats",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"playerStats": {
"isActive": true
}
}
Get Leaderboardentry API
[Default get API] — This is the designated default get API for the leaderboardEntry data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Fetch this player’s leaderboard rank entry (registered users only).
API Frontend Description By The Backend Architect
Allow user to view their own leaderboard position (or admin to view any user). Entry includes user info for display.
Rest Route
The getLeaderboardEntry API REST controller can be triggered via the following route:
/v1/leaderboardentries/:userId
Rest Request Parameters
The getLeaderboardEntry api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.params?.[“userId”] |
| userId : The registered user this leaderboard entry represents… The parameter is used to query data. |
REST Request To access the api you can use the REST controller with the path GET /v1/leaderboardentries/:userId
axios({
method: 'GET',
url: `/v1/leaderboardentries/${userId}`,
data: {
},
params: {
}
});
REST Response
This route’s response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "leaderboardEntry",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"leaderboardEntry": {
"isActive": true
}
}
List Leaderboardtopn API
[Default list API] — This is the designated default list API for the leaderboardEntry data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List top N players for leaderboard display (e.g., leaderboard page top 100). Sorted by currentRank ascending (best = 1).
API Frontend Description By The Backend Architect
Leaderboard screen populates using this API; accessible to all authenticated users (guests see empty/null result).
Rest Route
The listLeaderboardTopN API REST controller can be triggered via the following route:
/v1/leaderboardtopn
Rest Request Parameters
The listLeaderboardTopN api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| topN | Integer | false | request.query?.[“topN”] |
| topN : Number of top players to return (max 500) |
REST Request To access the api you can use the REST controller with the path GET /v1/leaderboardtopn
axios({
method: 'GET',
url: '/v1/leaderboardtopn',
data: {
},
params: {
topN:'"Integer"',
}
});
REST Response
This route’s response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "leaderboardEntries",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"leaderboardEntries": [
{
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Leaderboardentry API
Create a leaderboard entry for a registered player. Called when PlayerStats exists but LeaderboardEntry is missing.
API Frontend Description By The Backend Architect
Called by ensureLeaderboardEntry when a user has PlayerStats but no LeaderboardEntry.
Rest Route
The createLeaderboardEntry API REST controller can be triggered via the following route:
/v1/leaderboardentries
Rest Request Parameters
The createLeaderboardEntry api has got 6 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId | ID | true | request.body?.[“userId”] |
| currentRank | Integer | true | request.body?.[“currentRank”] |
| eloRating | Integer | true | request.body?.[“eloRating”] |
| season | String | false | request.body?.[“season”] |
| lastRankChangeAt | Date | false | request.body?.[“lastRankChangeAt”] |
| username | String | false | request.body?.[“username”] |
| userId : The registered user this leaderboard entry represents. | |||
| currentRank : Current leaderboard rank (1=top). Lower is better. | |||
| eloRating : Player’s current ELO rating (copy from playerStats). | |||
| season : Leaderboard season identifier (null for all-time/global, can be set for seasonal leaderboards as needed). | |||
| lastRankChangeAt : Timestamp of last rank change/leaderboard update. | |||
| username : Display name for the player, publicly visible on leaderboard. |
REST Request To access the api you can use the REST controller with the path POST /v1/leaderboardentries
axios({
method: 'POST',
url: '/v1/leaderboardentries',
data: {
userId:"ID",
currentRank:"Integer",
eloRating:"Integer",
season:"String",
lastRankChangeAt:"Date",
username:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "leaderboardEntry",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"leaderboardEntry": {
"id": "ID",
"userId": "ID",
"currentRank": "Integer",
"eloRating": "Integer",
"season": "String",
"lastRankChangeAt": "Date",
"username": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Authentication Specific Routes
Common Routes
Route: currentuser
Route Definition: Retrieves the currently authenticated user’s session information.
Route Type: sessionInfo
Access Route: GET /currentuser
Parameters
This route does not require any request parameters.
Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response Returns the session object, including user-related data and token information.
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
Error Response 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
Notes
- This route is typically used by frontend or mobile applications to fetch the current session state after login.
- The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
- Always ensure a valid access token is provided in the request to retrieve the session.
Route: permissions
*Route Definition*: Retrieves all effective permission records assigned to the currently authenticated user.
*Route Type*: permissionFetch
Access Route: GET /permissions
Parameters
This route does not require any request parameters.
Behavior
- Fetches all active permission records (
givenPermissionsentries) associated with the current user session. - Returns a full array of permission objects.
- Requires a valid session (
access token) to be available.
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
Returns an array of permission objects.
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
Each object reflects a single permission grant, aligned with the givenPermissions model:
**permissionName**: The permission the user has.**roleId**: If the permission was granted through a role. -**subjectUserId**: If directly granted to the user.**subjectUserGroupId**: If granted through a group.**objectId**: If tied to a specific object (OBAC).**canDo**: True or false flag to represent if permission is active or restricted.
Error Responses
- 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
- 500 Internal Server Error: Unexpected error fetching permissions.
Notes
- The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
- Auth service: Fetches permissions freshly from the live database (givenPermissions table).
- Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
Tip: Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
Route: permissions/:permissionName
Route Definition: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
Route Type: permissionScopeCheck
Access Route: GET /permissions/:permissionName
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| permissionName | String | Yes | request.params.permissionName |
Behavior
- Evaluates whether the current user has access to the given
permissionName. - Returns a structured object indicating:
- Whether the permission is generally granted (
canDo) - Which object IDs are explicitly included or excluded from access (
exceptions)
- Whether the permission is generally granted (
- Requires a valid session (
access token).
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
- If
canDoistrue, the user generally has the permission, but not for the objects listed inexceptions(i.e., restrictions). - If
canDoisfalse, the user does not have the permission by default — but only for the objects inexceptions, they do have permission (i.e., selective overrides). - The exceptions array contains valid UUID strings, each corresponding to an object ID (typically from the data model targeted by the permission).
Copyright
All sources, documents and other digital materials are copyright of .
About Us
For more information please visit our website: .
. .
REST API GUIDE
wechess-agenthub-service
Version: 1.0.0
AI Agent Hub
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to . For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the AgentHub Service’s REST API. This document is designed to provide a comprehensive guide to interfacing with our AgentHub Service exclusively through RESTful API endpoints.
Intended Audience
This documentation is intended for developers and integrators who are looking to interact with the AgentHub Service via HTTP requests for purposes such as creating, updating, deleting and querying AgentHub objects.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST It’s important to note that the AgentHub Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Authentication And Authorization
To ensure secure access to the AgentHub service’s protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it’s important to note that access control varies across different routes:
Protected API: Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **: The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
|---|---|
| Query | access_token |
| Authorization Header | Bearer |
| Header | wechess-access-token |
| Cookie | wechess-access-token |
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
Api Definitions
This section outlines the API endpoints available within the AgentHub service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It’s important to understand the flexibility in how parameters can be included in requests to effectively interact with the AgentHub service.
This service is configured to listen for HTTP requests on port 3006,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
- API Test Interface (API Face):
/ - Swagger Documentation:
/swagger - Postman Collection Download:
/getPostmanCollection - Health Checks:
/healthand/admin/health - Current Session Info:
/currentuser - Favicon:
/favicon.ico
This service is accessible via the following environment-specific URLs:
- Preview:
https://wechess.prw.mindbricks.com/agenthub-api - Staging:
https://wechess-stage.mindbricks.co/agenthub-api - Production:
https://wechess.mindbricks.co/agenthub-api
Parameter Inclusion Methods: Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
Query Parameters: Included directly in the URL’s query string.
Path Parameters: Embedded within the URL’s path.
Body Parameters: Sent within the JSON body of the request.
Session Parameters: Automatically read from the session object. This method is used for parameters that are intrinsic to the user’s session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
Note on Session Parameters: Session parameters represent a unique method of parameter inclusion, relying on the context of the user’s session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the AgentHub service’s API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
Common Parameters
The AgentHub service’s business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
Supported Common Parameters:
-
getJoins (BOOLEAN): Controls whether to retrieve associated objects along with the main object. By default,
getJoinsis assumed to betrue. Set it tofalseif you prefer to receive only the main fields of an object, excluding its associations. -
excludeCQRS (BOOLEAN): Applicable only when
getJoinsistrue. By default,excludeCQRSis set tofalse. Enabling this parameter (true) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage. -
requestId (String): Identifies a request to enable tracking through the service’s log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom
requestId, simply include it in your query parameters. -
caching (BOOLEAN): Determines the use of caching for query API. By default, caching is enabled (
true). To ensure the freshest data directly from the database, set this parameter tofalse, bypassing the cache. -
cacheTTL (Integer): Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for
get listqueries. Setting a customcacheTTLallows you to fine-tune the cache lifespan to meet your needs. -
pageNumber (Integer): For paginated
get listAPI’s, this parameter selects which page of results to retrieve. The default is1, indicating the first page. To disable pagination and retrieve all results, setpageNumberto0. -
pageRowCount (Integer): In conjunction with paginated API’s, this parameter defines the number of records per page. The default value is
25. AdjustingpageRowCountallows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the AgentHub service.
Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- 401 Unauthorized: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Object Structure of a Successfull Response
When the AgentHub service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
Key Characteristics of the Response Envelope:
-
Data Presentation: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- Creation and Update API: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- Delete API: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- Get Requests: A single data object is returned in JSON format.
- Get List Requests: An array of data objects is provided, reflecting a collection of resources.
-
Data Structure and Joins: The complexity of the data structure in the response can vary based on the API’s architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- Pure Data Forms: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- Extended Data Forms: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- Join Varieties: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
Design Considerations: The structure of a API’s response data is meticulously crafted during the service’s architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
Brief Data: Certain API’s return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
HTTP Status Codes:
- 200 OK: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- 201 Created: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
Success Response Format:
For successful operations, the response includes a "status": "OK" property, signaling the successful execution of the request. The structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
Handling Errors:
For details on handling error scenarios and understanding the structure of error responses, please refer to the “Error Response” section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
Resources
AgentHub service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
Sys_agentOverride resource
Resource Definition : Runtime overrides for design-time agents. Null fields use the design default. Sys_agentOverride Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| agentName | String | Design-time agent name this override applies to. | ||
| provider | String | Override AI provider (e.g., openai, anthropic). | ||
| model | String | Override model name. | ||
| systemPrompt | Text | Override system prompt. | ||
| temperature | Double | Override temperature (0-2). | ||
| maxTokens | Integer | Override max tokens. | ||
| responseFormat | String | Override response format (text/json). | ||
| selectedTools | Object | Array of tool names from the catalog that this agent can use. | ||
| guardrails | Object | Override guardrails: { maxToolCalls, timeout, maxTokenBudget }. | ||
| enabled | Boolean | Enable or disable this agent. | ||
| updatedBy | ID | User who last updated this override. |
Sys_agentExecution resource
Resource Definition : Agent execution log. Records each agent invocation with input, output, and performance metrics. Sys_agentExecution Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| agentName | String | Agent that was executed. | ||
| agentType | Enum | Whether this was a design-time or dynamic agent. | ||
| source | Enum | How the agent was triggered. | ||
| userId | ID | User who triggered the execution. | ||
| input | Object | Request input (truncated for large payloads). | ||
| output | Object | Response output (truncated for large payloads). | ||
| toolCalls | Integer | Number of tool calls made during execution. | ||
| tokenUsage | Object | Token usage: { prompt, completion, total }. | ||
| durationMs | Integer | Execution time in milliseconds. | ||
| status | Enum | Execution status. | ||
| error | Text | Error message if execution failed. |
Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
agentType Enum Property
Property Definition : Whether this was a design-time or dynamic agent.Enum Options
| Name | Value | Index |
|---|---|---|
| design | "design"" |
0 |
| dynamic | "dynamic"" |
1 |
source Enum Property
Property Definition : How the agent was triggered.Enum Options
| Name | Value | Index |
|---|---|---|
| rest | "rest"" |
0 |
| sse | "sse"" |
1 |
| kafka | "kafka"" |
2 |
| agent | "agent"" |
3 |
status Enum Property
Property Definition : Execution status.Enum Options
| Name | Value | Index |
|---|---|---|
| success | "success"" |
0 |
| error | "error"" |
1 |
| timeout | "timeout"" |
2 |
Sys_toolCatalog resource
Resource Definition : Cached tool catalog discovered from project services. Refreshed periodically. Sys_toolCatalog Resource Properties
| Name | Type | Required | Default | Definition |
|---|---|---|---|---|
| toolName | String | Full tool name (e.g., service:apiName). | ||
| serviceName | String | Source service name. | ||
| description | Text | Tool description. | ||
| parameters | Object | JSON Schema of tool parameters. | ||
| lastRefreshed | Date | When this tool was last discovered/refreshed. |
Business Api
Get Agentoverride API
[Default get API] — This is the designated default get API for the sys_agentOverride data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The getAgentOverride API REST controller can be triggered via the following route:
/v1/agentoverride/:sys_agentOverrideId
Rest Request Parameters
The getAgentOverride api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| sys_agentOverrideId | ID | true | request.params?.[“sys_agentOverrideId”] |
| sys_agentOverrideId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/agentoverride/:sys_agentOverrideId
axios({
method: 'GET',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
List Agentoverrides API
[Default list API] — This is the designated default list API for the sys_agentOverride data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The listAgentOverrides API REST controller can be triggered via the following route:
/v1/agentoverrides
Rest Request Parameters
The listAgentOverrides api has got no request parameters.
REST Request To access the api you can use the REST controller with the path GET /v1/agentoverrides
axios({
method: 'GET',
url: '/v1/agentoverrides',
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverrides",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_agentOverrides": [
{
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Update Agentoverride API
[Default update API] — This is the designated default update API for the sys_agentOverride data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The updateAgentOverride API REST controller can be triggered via the following route:
/v1/agentoverride/:sys_agentOverrideId
Rest Request Parameters
The updateAgentOverride api has got 10 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| sys_agentOverrideId | ID | true | request.params?.[“sys_agentOverrideId”] |
| provider | String | request.body?.[“provider”] | |
| model | String | request.body?.[“model”] | |
| systemPrompt | Text | request.body?.[“systemPrompt”] | |
| temperature | Double | request.body?.[“temperature”] | |
| maxTokens | Integer | request.body?.[“maxTokens”] | |
| responseFormat | String | request.body?.[“responseFormat”] | |
| selectedTools | Object | request.body?.[“selectedTools”] | |
| guardrails | Object | request.body?.[“guardrails”] | |
| enabled | Boolean | request.body?.[“enabled”] | |
| sys_agentOverrideId : This id paremeter is used to select the required data object that will be updated | |||
| provider : Override AI provider (e.g., openai, anthropic). | |||
| model : Override model name. | |||
| systemPrompt : Override system prompt. | |||
| temperature : Override temperature (0-2). | |||
| maxTokens : Override max tokens. | |||
| responseFormat : Override response format (text/json). | |||
| selectedTools : Array of tool names from the catalog that this agent can use. | |||
| guardrails : Override guardrails: { maxToolCalls, timeout, maxTokenBudget }. | |||
| enabled : Enable or disable this agent. |
REST Request To access the api you can use the REST controller with the path PATCH /v1/agentoverride/:sys_agentOverrideId
axios({
method: 'PATCH',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
provider:"String",
model:"String",
systemPrompt:"Text",
temperature:"Double",
maxTokens:"Integer",
responseFormat:"String",
selectedTools:"Object",
guardrails:"Object",
enabled:"Boolean",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
Create Agentoverride API
[Default create API] — This is the designated default create API for the sys_agentOverride data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The createAgentOverride API REST controller can be triggered via the following route:
/v1/agentoverride
Rest Request Parameters
The createAgentOverride api has got 9 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| agentName | String | true | request.body?.[“agentName”] |
| provider | String | false | request.body?.[“provider”] |
| model | String | false | request.body?.[“model”] |
| systemPrompt | Text | false | request.body?.[“systemPrompt”] |
| temperature | Double | false | request.body?.[“temperature”] |
| maxTokens | Integer | false | request.body?.[“maxTokens”] |
| responseFormat | String | false | request.body?.[“responseFormat”] |
| selectedTools | Object | false | request.body?.[“selectedTools”] |
| guardrails | Object | false | request.body?.[“guardrails”] |
| agentName : Design-time agent name this override applies to. | |||
| provider : Override AI provider (e.g., openai, anthropic). | |||
| model : Override model name. | |||
| systemPrompt : Override system prompt. | |||
| temperature : Override temperature (0-2). | |||
| maxTokens : Override max tokens. | |||
| responseFormat : Override response format (text/json). | |||
| selectedTools : Array of tool names from the catalog that this agent can use. | |||
| guardrails : Override guardrails: { maxToolCalls, timeout, maxTokenBudget }. |
REST Request To access the api you can use the REST controller with the path POST /v1/agentoverride
axios({
method: 'POST',
url: '/v1/agentoverride',
data: {
agentName:"String",
provider:"String",
model:"String",
systemPrompt:"Text",
temperature:"Double",
maxTokens:"Integer",
responseFormat:"String",
selectedTools:"Object",
guardrails:"Object",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
Delete Agentoverride API
[Default delete API] — This is the designated default delete API for the sys_agentOverride data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The deleteAgentOverride API REST controller can be triggered via the following route:
/v1/agentoverride/:sys_agentOverrideId
Rest Request Parameters
The deleteAgentOverride api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| sys_agentOverrideId | ID | true | request.params?.[“sys_agentOverrideId”] |
| sys_agentOverrideId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/agentoverride/:sys_agentOverrideId
axios({
method: 'DELETE',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": false
}
}
List Toolcatalog API
[Default list API] — This is the designated default list API for the sys_toolCatalog data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The listToolCatalog API REST controller can be triggered via the following route:
/v1/toolcatalog
Rest Request Parameters
Filter Parameters
The listToolCatalog api supports 1 optional filter parameter for filtering list results:
serviceName (String): Source service name.
- Single (partial match, case-insensitive):
?serviceName=<value> - Multiple:
?serviceName=<value1>&serviceName=<value2> - Null:
?serviceName=null
REST Request To access the api you can use the REST controller with the path GET /v1/toolcatalog
axios({
method: 'GET',
url: '/v1/toolcatalog',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// serviceName: '<value>' // Filter by serviceName
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_toolCatalogs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_toolCatalogs": [
{
"id": "ID",
"toolName": "String",
"serviceName": "String",
"description": "Text",
"parameters": "Object",
"lastRefreshed": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Get Toolcatalogentry API
[Default get API] — This is the designated default get API for the sys_toolCatalog data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The getToolCatalogEntry API REST controller can be triggered via the following route:
/v1/toolcatalogentry/:sys_toolCatalogId
Rest Request Parameters
The getToolCatalogEntry api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| sys_toolCatalogId | ID | true | request.params?.[“sys_toolCatalogId”] |
| sys_toolCatalogId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/toolcatalogentry/:sys_toolCatalogId
axios({
method: 'GET',
url: `/v1/toolcatalogentry/${sys_toolCatalogId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_toolCatalog",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_toolCatalog": {
"id": "ID",
"toolName": "String",
"serviceName": "String",
"description": "Text",
"parameters": "Object",
"lastRefreshed": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
List Agentexecutions API
[Default list API] — This is the designated default list API for the sys_agentExecution data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The listAgentExecutions API REST controller can be triggered via the following route:
/v1/agentexecutions
Rest Request Parameters
Filter Parameters
The listAgentExecutions api supports 5 optional filter parameters for filtering list results:
agentName (String): Agent that was executed.
- Single (partial match, case-insensitive):
?agentName=<value> - Multiple:
?agentName=<value1>&agentName=<value2> - Null:
?agentName=null
agentType (Enum): Whether this was a design-time or dynamic agent.
- Single:
?agentType=<value>(case-insensitive) - Multiple:
?agentType=<value1>&agentType=<value2> - Null:
?agentType=null
source (Enum): How the agent was triggered.
- Single:
?source=<value>(case-insensitive) - Multiple:
?source=<value1>&source=<value2> - Null:
?source=null
userId (ID): User who triggered the execution.
- Single:
?userId=<value> - Multiple:
?userId=<value1>&userId=<value2> - Null:
?userId=null
status (Enum): Execution status.
- Single:
?status=<value>(case-insensitive) - Multiple:
?status=<value1>&status=<value2> - Null:
?status=null
REST Request To access the api you can use the REST controller with the path GET /v1/agentexecutions
axios({
method: 'GET',
url: '/v1/agentexecutions',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// agentName: '<value>' // Filter by agentName
// agentType: '<value>' // Filter by agentType
// source: '<value>' // Filter by source
// userId: '<value>' // Filter by userId
// status: '<value>' // Filter by status
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentExecutions",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_agentExecutions": [
{
"id": "ID",
"agentName": "String",
"agentType": "Enum",
"agentType_idx": "Integer",
"source": "Enum",
"source_idx": "Integer",
"userId": "ID",
"input": "Object",
"output": "Object",
"toolCalls": "Integer",
"tokenUsage": "Object",
"durationMs": "Integer",
"status": "Enum",
"status_idx": "Integer",
"error": "Text",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Get Agentexecution API
[Default get API] — This is the designated default get API for the sys_agentExecution data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Rest Route
The getAgentExecution API REST controller can be triggered via the following route:
/v1/agentexecution/:sys_agentExecutionId
Rest Request Parameters
The getAgentExecution api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| sys_agentExecutionId | ID | true | request.params?.[“sys_agentExecutionId”] |
| sys_agentExecutionId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/agentexecution/:sys_agentExecutionId
axios({
method: 'GET',
url: `/v1/agentexecution/${sys_agentExecutionId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentExecution",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_agentExecution": {
"id": "ID",
"agentName": "String",
"agentType": "Enum",
"agentType_idx": "Integer",
"source": "Enum",
"source_idx": "Integer",
"userId": "ID",
"input": "Object",
"output": "Object",
"toolCalls": "Integer",
"tokenUsage": "Object",
"durationMs": "Integer",
"status": "Enum",
"status_idx": "Integer",
"error": "Text",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
Authentication Specific Routes
Common Routes
Route: currentuser
Route Definition: Retrieves the currently authenticated user’s session information.
Route Type: sessionInfo
Access Route: GET /currentuser
Parameters
This route does not require any request parameters.
Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response Returns the session object, including user-related data and token information.
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
Error Response 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
Notes
- This route is typically used by frontend or mobile applications to fetch the current session state after login.
- The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
- Always ensure a valid access token is provided in the request to retrieve the session.
Route: permissions
*Route Definition*: Retrieves all effective permission records assigned to the currently authenticated user.
*Route Type*: permissionFetch
Access Route: GET /permissions
Parameters
This route does not require any request parameters.
Behavior
- Fetches all active permission records (
givenPermissionsentries) associated with the current user session. - Returns a full array of permission objects.
- Requires a valid session (
access token) to be available.
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
Returns an array of permission objects.
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
Each object reflects a single permission grant, aligned with the givenPermissions model:
**permissionName**: The permission the user has.**roleId**: If the permission was granted through a role. -**subjectUserId**: If directly granted to the user.**subjectUserGroupId**: If granted through a group.**objectId**: If tied to a specific object (OBAC).**canDo**: True or false flag to represent if permission is active or restricted.
Error Responses
- 401 Unauthorized: No active session found.
{
"status": "ERR",
"message": "No login found"
}
- 500 Internal Server Error: Unexpected error fetching permissions.
Notes
- The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
- Auth service: Fetches permissions freshly from the live database (givenPermissions table).
- Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
Tip: Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
Route: permissions/:permissionName
Route Definition: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
Route Type: permissionScopeCheck
Access Route: GET /permissions/:permissionName
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| permissionName | String | Yes | request.params.permissionName |
Behavior
- Evaluates whether the current user has access to the given
permissionName. - Returns a structured object indicating:
- Whether the permission is generally granted (
canDo) - Which object IDs are explicitly included or excluded from access (
exceptions)
- Whether the permission is generally granted (
- Requires a valid session (
access token).
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
Success Response
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
- If
canDoistrue, the user generally has the permission, but not for the objects listed inexceptions(i.e., restrictions). - If
canDoisfalse, the user does not have the permission by default — but only for the objects inexceptions, they do have permission (i.e., selective overrides). - The exceptions array contains valid UUID strings, each corresponding to an object ID (typically from the data model targeted by the permission).
Copyright
All sources, documents and other digital materials are copyright of .
About Us
For more information please visit our website: .
. .
REST API GUIDE
BFF SERVICE
Version: 1.0.2
BFF service is a microservice that acts as a bridge between the client and the backend services. It provides a unified API for the client to interact with multiple backend services, simplifying the communication process and improving performance.
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to.
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the BFF Service’s REST API. This document is designed to provide a comprehensive guide to interfacing with our BFF Service exclusively through RESTful API endpoints.
Intended Audience
This documentation is intended for developers and integrators who are looking to interact with the BFF Service via HTTP requests for purposes such as listing, filtering, and searching data.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It’s important to note that the BFF Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Resources
Elastic Index Resource
Resource Definition: A virtual resource representing dynamic search data from a specified index.
Route: List Records
Route Definition: Returns a paginated list from the elastic index.
Route Type: list
Default access route: POST /:indexName/list
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| sortOrder | String | No | query.sortOrder |
| q | String | No | query.q |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/${indexName}/list`,
data: {
filters: "Object"
},
params: {
page: "Number",
limit: "Number",
sortBy: "String",
sortOrder: "String",
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a "status": "OK" property.
---Default access route: GET /:indexName/list
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| sortOrder | String | No | query.sortOrder |
| q | String | No | query.q |
axios({
method: "GET",
url: `/${indexName}/list`,
data:{},
params: {
page: "Number",
limit: "Number",
sortBy: "String",
sortOrder: "String",
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Count Records
Route Definition: Counts matching documents in the elastic index.
Route Type: count
Default access route: POST /:indexName/count
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| q | String | No | query.q |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/${indexName}/count`,
data: {
filters: "Object"
},
params: {
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Default access route: GET /:indexName/count
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| q | String | No | query.q |
axios({
method: "GET",
url: `/${indexName}/count`,
data:{},
params: {
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Index Schema
Route Definition: Returns the schema for the elastic index.
Route Type: get
Default access route: GET /:indexName/schema
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
axios({
method: "GET",
url: `/${indexName}/schema`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Filters
GET /:indexName/filters
Route Type: get
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| page | Number | No | query.page |
| limit | Number | No | query.limit |
axios({
method: "GET",
url: `/${indexName}/filters`,
data:{},
params: {
page: "Number",
limit: "Number"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
POST /:indexName/filters
Route Type: create
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/${indexName}/filters`,
data: {
filterName: "String",
conditions: "Object"
},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
DELETE /:indexName/filters/:filterId
Route Type: delete
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| filterId | String | Yes | path.param |
axios({
method: "DELETE",
url: `/${indexName}/filters/${filterId}`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get One Record
Route Type: get
Default access route: GET /:indexName/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| indexName | String | Yes | path.param |
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/${indexName}/${id}`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get All Aggregated Records
Route Definition: Retrieves a full list of aggregated view data.
Route Type: list
Default access route: GET /playerProfileView
Example:
axios({
method: "GET",
url: `/playerProfileView`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Single Aggregated Record
Route Definition: Retrieves a specific aggregated document by ID.
Route Type: get
Default access route: GET /playerProfileView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/playerProfileView/${id}`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get All Aggregated Records
Route Definition: Retrieves a full list of aggregated view data.
Route Type: list
Default access route: GET /chessGameDetailView
Example:
axios({
method: "GET",
url: `/chessGameDetailView`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Single Aggregated Record
Route Definition: Retrieves a specific aggregated document by ID.
Route Type: get
Default access route: GET /chessGameDetailView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/chessGameDetailView/${id}`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get All Aggregated Records
Route Definition: Retrieves a full list of aggregated view data.
Route Type: list
Default access route: GET /lobbyChatMessageView
Example:
axios({
method: "GET",
url: `/lobbyChatMessageView`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Single Aggregated Record
Route Definition: Retrieves a specific aggregated document by ID.
Route Type: get
Default access route: GET /lobbyChatMessageView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/lobbyChatMessageView/${id}`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get All Aggregated Records
Route Definition: Retrieves a full list of aggregated view data.
Route Type: list
Default access route: GET /invitationNotificationView
Example:
axios({
method: "GET",
url: `/invitationNotificationView`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Single Aggregated Record
Route Definition: Retrieves a specific aggregated document by ID.
Route Type: get
Default access route: GET /invitationNotificationView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/invitationNotificationView/${id}`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get All Aggregated Records
Route Definition: Retrieves a full list of aggregated view data.
Route Type: list
Default access route: GET /gameTerminatedNotificationView
Example:
axios({
method: "GET",
url: `/gameTerminatedNotificationView`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Single Aggregated Record
Route Definition: Retrieves a specific aggregated document by ID.
Route Type: get
Default access route: GET /gameTerminatedNotificationView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/gameTerminatedNotificationView/${id}`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get All Aggregated Records
Route Definition: Retrieves a full list of aggregated view data.
Route Type: list
Default access route: GET /chatModerationNotificationView
Example:
axios({
method: "GET",
url: `/chatModerationNotificationView`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Single Aggregated Record
Route Definition: Retrieves a specific aggregated document by ID.
Route Type: get
Default access route: GET /chatModerationNotificationView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/chatModerationNotificationView/${id}`,
data: {},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: List Records
Route Definition: Returns a paginated list from the elastic index.
Route Type: list
Default access route: POST /chessGameListView/list
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| sortOrder | String | No | query.sortOrder |
| q | String | No | query.q |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/chessGameListView/list`,
data: {
filters: "Object"
},
params: {
page: "Number",
limit: "Number",
sortBy: "String",
sortOrder: "String",
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Default access route: GET /chessGameListView/list
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| sortOrder | String | No | query.sortOrder |
| q | String | No | query.q |
axios({
method: "GET",
url: `/chessGameListView/list`,
data:{},
params: {
page: "Number",
limit: "Number",
sortBy: "String",
sortOrder: "String",
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Count Records
Route Definition: Counts matching documents in the elastic index.
Route Type: count
Default access route: POST /chessGameListView/count
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| q | String | No | query.q |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/chessGameListView/count`,
data: {
filters: "Object"
},
params: {
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Default access route: GET /chessGameListView/count
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| q | String | No | query.q |
axios({
method: "GET",
url: `/chessGameListView/count`,
data:{},
params: {
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Index Schema
Route Definition: Returns the schema for the elastic index.
Route Type: get
Default access route: GET /chessGameListView/schema
axios({
method: "GET",
url: `/chessGameListView/schema`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Filters
GET /chessGameListView/filters
Route Type: get
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
axios({
method: "GET",
url: `/chessGameListView/filters`,
data:{},
params: {
page: "Number",
limit: "Number"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
POST /chessGameListView/filters
Route Type: create
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/chessGameListView/filters`,
data: {
"filters":"Object"
},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
DELETE /chessGameListView/filters/:filterId
Route Type: delete
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| filterId | ID | Yes | path.param |
axios({
method: "DELETE",
url: `/chessGameListView/filters/${filterId}`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get One Record
Route Type: get
Default access route: GET /chessGameListView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/chessGameListView/${id}`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: List Records
Route Definition: Returns a paginated list from the elastic index.
Route Type: list
Default access route: POST /leaderboardTopView/list
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| sortOrder | String | No | query.sortOrder |
| q | String | No | query.q |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/leaderboardTopView/list`,
data: {
filters: "Object"
},
params: {
page: "Number",
limit: "Number",
sortBy: "String",
sortOrder: "String",
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Default access route: GET /leaderboardTopView/list
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| sortOrder | String | No | query.sortOrder |
| q | String | No | query.q |
axios({
method: "GET",
url: `/leaderboardTopView/list`,
data:{},
params: {
page: "Number",
limit: "Number",
sortBy: "String",
sortOrder: "String",
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Count Records
Route Definition: Counts matching documents in the elastic index.
Route Type: count
Default access route: POST /leaderboardTopView/count
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| q | String | No | query.q |
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/leaderboardTopView/count`,
data: {
filters: "Object"
},
params: {
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Default access route: GET /leaderboardTopView/count
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| q | String | No | query.q |
axios({
method: "GET",
url: `/leaderboardTopView/count`,
data:{},
params: {
q: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get Index Schema
Route Definition: Returns the schema for the elastic index.
Route Type: get
Default access route: GET /leaderboardTopView/schema
axios({
method: "GET",
url: `/leaderboardTopView/schema`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Filters
GET /leaderboardTopView/filters
Route Type: get
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
axios({
method: "GET",
url: `/leaderboardTopView/filters`,
data:{},
params: {
page: "Number",
limit: "Number"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
POST /leaderboardTopView/filters
Route Type: create
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| filters | Object | Yes | body |
axios({
method: "POST",
url: `/leaderboardTopView/filters`,
data: {
"filters":"Object"
},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
DELETE /leaderboardTopView/filters/:filterId
Route Type: delete
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| filterId | ID | Yes | path.param |
axios({
method: "DELETE",
url: `/leaderboardTopView/filters/${filterId}`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
Route: Get One Record
Route Type: get
Default access route: GET /leaderboardTopView/:id
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| id | ID | Yes | path.param |
axios({
method: "GET",
url: `/leaderboardTopView/${id}`,
data:{},
params: {}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a “status”: “OK” property.
REST API GUIDE
NOTIFICATION SERVICE
Version: 1.0.7
The Notification service is a microservice that allows sending notifications through SMS, Email, and Push channels. Providers can be configured dynamically through the .env file.
Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to.
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
Documentation Scope
Welcome to the official documentation for the Notification Service REST API. This document provides a comprehensive overview of the available endpoints, how they work, and how to use them efficiently.
Intended Audience
This documentation is intended for developers, architects, and system administrators involved in the design, implementation, and maintenance of the Notification Service. It assumes familiarity with microservices architecture and RESTful APIs.
Overview
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It’s important to note that the Notification Service also supports alternative methods of interaction, such as messaging via a Kafka message broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
Routes
Route: Register Device
Route Definition: Registers a device for a user.
Route Type: create
Default access route: POST /devices/register
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| device | Object | Yes | body |
| userId | ID | Yes | req.userId |
axios({
method: "POST",
url: `/devices/register`,
data: {
device:"Object"
},
params:{}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a "status": "OK" property. Any validation errors will return status code 400 with an error message.
Route: Unregister Device
Route Definition: Removes a registered device.
Route Type: delete
Default access route: DELETE /devices/unregister/:deviceId
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| deviceId | ID | Yes | path.param |
| userId | ID | Yes | req.userId |
axios({
method: "DELETE",
url: `/devices/unregister/${deviceId}`,
data:{},
params:{}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a "status": "OK" property. Any validation errors will return status code 400 with an error message.
Route: Get Notifications
Route Definition: Retrieves a paginated list of notifications.
Route Type: get
Default access route: GET /notifications
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| page | Number | No | query.page |
| limit | Number | No | query.limit |
| sortBy | String | No | query.sortBy |
| userId | ID | Yes | req.userId |
axios({
method: "GET",
url: `/notifications`,
data:{},
params: {
page: "Number",
limit: "Number",
sortBy: "String"
}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a "status": "OK" property. Any validation errors will return status code 400 with an error message.
Route: Send Notification
Route Definition: Sends a notification to specified recipients.
Route Type: create
Default access route: POST /notifications
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| notification | Object | Yes | body |
axios({
method: "POST",
url: `/notifications`,
data: {
notification:"Object"
},
params:{}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a "status": "OK" property. Any validation errors will return status code 400 with an error message.
Route: Mark Notifications as Seen
Route Definition: Marks selected notifications as seen.
Route Type: update
Default access route: POST /notifications/seen
Parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| notificationIds | Array | Yes | body |
| userId | ID | Yes | req.userId |
axios({
method: "POST",
url: `/notifications/seen`,
data: {
notificationIds:"Object"
},
params:{}
});
The API response is encapsulated within a JSON envelope. Successful operations return an HTTP status code of 200 for get, list, update, or delete requests, and 201 for create requests. Each successful response includes a "status": "OK" property. Any validation errors will return status code 400 with an error message.
Generated by Mindbricks Genesis Engine