# AI Fitness & Nutrition Coach - REST API Reference
> Complete REST API documentation for all services in AI Fitness & Nutrition Coach
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](#introduction)
- [Auth Service REST API](#auth-service-rest-api-guide)
- [AiCoach Service REST API](#aicoach-service-rest-api-guide)
- [Subscription Service REST API](#subscription-service-rest-api-guide)
- [AgentHub Service REST API](#agenthub-service-rest-api-guide)
- [Bff Service REST API](#bff-service-rest-api-guide)
- [Notification Service REST API](#notification-service-rest-api-guide)
---
## Introduction
# AI Fitness & Nutrition Coach
Version : 1.0.146
aifitapp is a subscription-based, AI-powered fitness and nutrition platform that generates personalized training programs and dietary plans using evidence-based principles. Users interact with an intelligent chatbot to receive customized workout regimes, meal recommendations, exercise and food alternatives, and educational guidance—all governed by strict safety and scientific protocols.
## How to Use Project Documents
The `Aifitapp` 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://appaili.prw.mindbricks.com/auth-api` |
| **Staging** | `https://appaili-stage.mindbricks.co/auth-api` |
| **Production** | `https://appaili.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 `Aifitapp` 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](/document/docs/auth-service/rest-api-guide.html)
* **Event Guide** – helpful for event-driven or cross-service integrations
[Auth Event Guide](/document/docs/auth-service/event-guide.html)
* **Service Design Document** – overall structure, patterns, and logic
[Auth Service Design](/document/docs/auth-service/service-design.html)
> **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](/document/docs/bff-service/rest-api-guide.html)
* **Event Guide** – syncing strategies across replicas
[BFF Event Guide](/document/docs/bff-service/event-guide.html)
* **Service Design** – aggregation patterns and index structures
[BFF Service Design](/document/docs/bff-service/service-design.html)
> **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 `AI Fitness & Nutrition Coach` 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](#using-the-bff-backend-for-frontend-service).
### Available Business Services
### aiCoach Service
**Description:** AI-powered fitness coaching service that generates personalized evidence-based training programs and nutrition plans, manages chatbowt interactions with full validation chains, handles dynamic program modifications via AI tool calls, tracks weaight measurements, enforces moderation and quotas, and provides admin endpoints for moderation history and usage analytics.a
**Documentation:**
* [REST API Guide](/document/docs/aiCoach-service/rest-api-guide.html)
* [Event Guide](/document/docs/aiCoach-service/event-guide.html)
* [Service Design](/document/docs/aiCoach-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://appaili.prw.mindbricks.com/aicoach-api` |
| **Staging** | `https://appaili-stage.mindbricks.co/aicoach-api` |
| **Production** | `https://appaili.mindbricks.co/aicoach-api` |
### subscription Service
**Description:** Manages the single premium subscription plan lifecycle including activation, status tracking, cancellation, and admin-configurable pricing. Provides subscription status validation endpoints for other services to gate access to AI-powered featuresa.z
**Documentation:**
* [REST API Guide](/document/docs/subscription-service/rest-api-guide.html)
* [Event Guide](/document/docs/subscription-service/event-guide.html)
* [Service Design](/document/docs/subscription-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://appaili.prw.mindbricks.com/subscription-api` |
| **Staging** | `https://appaili-stage.mindbricks.co/subscription-api` |
| **Production** | `https://appaili.mindbricks.co/subscription-api` |
### agentHub Service
**Description:** AI Agent Hub
**Documentation:**
* [REST API Guide](/document/docs/agentHub-service/rest-api-guide.html)
* [Event Guide](/document/docs/agentHub-service/event-guide.html)
* [Service Design](/document/docs/agentHub-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://appaili.prw.mindbricks.com/agenthub-api` |
| **Staging** | `https://appaili-stage.mindbricks.co/agenthub-api` |
| **Production** | `https://appaili.mindbricks.co/agenthub-api` |
## Connect via MCP (Model Context Protocol)
All backend services in the `Aifitapp` 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://appaili.prw.mindbricks.com/mcpbff-api/mcp` | `https://appaili.prw.mindbricks.com/mcpbff-api/mcp/sse` |
| **Staging** | `https://appaili-stage.mindbricks.co/mcpbff-api/mcp` | `https://appaili-stage.mindbricks.co/mcpbff-api/mcp/sse` |
| **Production** | `https://appaili.mindbricks.co/mcpbff-api/mcp` | `https://appaili.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_here`
API 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`:
```json
{
"mcpServers": {
"appaili": {
"url": "https://appaili.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`):
```json
{
"mcpServers": {
"appaili": {
"url": "https://appaili.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 `AI Fitness & Nutrition Coach` 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
## aifitapp-auth-service
**Version:** `1.0.6`
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 | appaili-access-token|
| Cookie | appaili-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:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://appaili.prw.mindbricks.com/auth-api`
* **Staging:** `https://appaili-stage.mindbricks.co/auth-api`
* **Production:** `https://appaili.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, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. 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 to `false`, 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 list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows 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.
```js
{
"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:
```json
{
"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 |
| ---- | ---- | -------- | ------- | ---------- |
| **email** | 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.* |
| **activityLevel** | Enum | | | *User's general daily activity level, used as the TDEE activity multiplier.* |
| **availableEquipment** | String | | | *List of equipment available to the user for training program generation.* |
| **country** | String | | | *User's country of residence, used for regional food suggestions and cuisine preferences.* |
| **dateOfBirth** | Date | | | *User's date of birth, used for age-based calorie and program calculations.* |
| **dietaryRestrictions** | String | | | *List of user dietary restrictions or allergies for meal plan customization.* |
| **fitnessGoal** | Enum | | | *User's primary fitness goal driving program and nutrition recommendations.* |
| **height** | Float | | | *User's height in centimeters, used for BMR and TDEE calculations.* |
| **sex** | Enum | | | *User's biological sex, used for BMR calculations and program customization.* |
| **trainingExperience** | Enum | | | *User's training experience level, influencing program complexity and progression rates.* |
| **weeklyTrainingDays** | Integer | | | *Number of days per week the user is available to train, used for program split selection.* |
| **weight** | Float | | | *User's current body weight in kilograms, used for calorie and macro calculations.* |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### activityLevel Enum Property
*Property Definition* : User's general daily activity level, used as the TDEE activity multiplier.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **sedentary** | `"sedentary""` | 0 |
| **lightTraining** | `"lightTraining""` | 1 |
| **moderate** | `"moderate""` | 2 |
| **heavyTraining** | `"heavyTraining""` | 3 |
| **athlete** | `"athlete""` | 4 |
##### fitnessGoal Enum Property
*Property Definition* : User's primary fitness goal driving program and nutrition recommendations.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **fatLoss** | `"fatLoss""` | 0 |
| **muscleGain** | `"muscleGain""` | 1 |
| **recomposition** | `"recomposition""` | 2 |
| **strengthMaintenance** | `"strengthMaintenance""` | 3 |
| **generalHealth** | `"generalHealth""` | 4 |
##### sex Enum Property
*Property Definition* : User's biological sex, used for BMR calculations and program customization.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **male** | `"male""` | 0 |
| **female** | `"female""` | 1 |
##### trainingExperience Enum Property
*Property Definition* : User's training experience level, influencing program complexity and progression rates.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **beginner** | `"beginner""` | 0 |
| **intermediate** | `"intermediate""` | 1 |
| **advanced** | `"advanced""` | 2 |
### 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**
```js
axios({
method: 'GET',
url: `/v1/users/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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 14 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"] |
| activityLevel | Enum | false | request.body?.["activityLevel"] |
| availableEquipment | String | false | request.body?.["availableEquipment"] |
| country | String | false | request.body?.["country"] |
| dateOfBirth | Date | false | request.body?.["dateOfBirth"] |
| dietaryRestrictions | String | false | request.body?.["dietaryRestrictions"] |
| fitnessGoal | Enum | false | request.body?.["fitnessGoal"] |
| height | Float | false | request.body?.["height"] |
| sex | Enum | false | request.body?.["sex"] |
| trainingExperience | Enum | false | request.body?.["trainingExperience"] |
| weeklyTrainingDays | Integer | false | request.body?.["weeklyTrainingDays"] |
| weight | Float | false | request.body?.["weight"] |
**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
**activityLevel** : User's general daily activity level, used as the TDEE activity multiplier.
**availableEquipment** : List of equipment available to the user for training program generation.
**country** : User's country of residence, used for regional food suggestions and cuisine preferences.
**dateOfBirth** : User's date of birth, used for age-based calorie and program calculations.
**dietaryRestrictions** : List of user dietary restrictions or allergies for meal plan customization.
**fitnessGoal** : User's primary fitness goal driving program and nutrition recommendations.
**height** : User's height in centimeters, used for BMR and TDEE calculations.
**sex** : User's biological sex, used for BMR calculations and program customization.
**trainingExperience** : User's training experience level, influencing program complexity and progression rates.
**weeklyTrainingDays** : Number of days per week the user is available to train, used for program split selection.
**weight** : User's current body weight in kilograms, used for calorie and macro calculations.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/users/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/users/${userId}`,
data: {
fullname:"String",
avatar:"String",
activityLevel:"Enum",
availableEquipment:"String",
country:"String",
dateOfBirth:"Date",
dietaryRestrictions:"String",
fitnessGoal:"Enum",
height:"Float",
sex:"Enum",
trainingExperience:"Enum",
weeklyTrainingDays:"Integer",
weight:"Float",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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 14 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"] |
| activityLevel | Enum | false | request.body?.["activityLevel"] |
| availableEquipment | String | false | request.body?.["availableEquipment"] |
| country | String | false | request.body?.["country"] |
| dateOfBirth | Date | false | request.body?.["dateOfBirth"] |
| dietaryRestrictions | String | false | request.body?.["dietaryRestrictions"] |
| fitnessGoal | Enum | false | request.body?.["fitnessGoal"] |
| height | Float | false | request.body?.["height"] |
| sex | Enum | false | request.body?.["sex"] |
| trainingExperience | Enum | false | request.body?.["trainingExperience"] |
| weeklyTrainingDays | Integer | false | request.body?.["weeklyTrainingDays"] |
| weight | Float | false | request.body?.["weight"] |
**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
**activityLevel** : User's general daily activity level, used as the TDEE activity multiplier.
**availableEquipment** : List of equipment available to the user for training program generation.
**country** : User's country of residence, used for regional food suggestions and cuisine preferences.
**dateOfBirth** : User's date of birth, used for age-based calorie and program calculations.
**dietaryRestrictions** : List of user dietary restrictions or allergies for meal plan customization.
**fitnessGoal** : User's primary fitness goal driving program and nutrition recommendations.
**height** : User's height in centimeters, used for BMR and TDEE calculations.
**sex** : User's biological sex, used for BMR calculations and program customization.
**trainingExperience** : User's training experience level, influencing program complexity and progression rates.
**weeklyTrainingDays** : Number of days per week the user is available to train, used for program split selection.
**weight** : User's current body weight in kilograms, used for calorie and macro calculations.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/profile/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/profile/${userId}`,
data: {
fullname:"String",
avatar:"String",
activityLevel:"Enum",
availableEquipment:"String",
country:"String",
dateOfBirth:"Date",
dietaryRestrictions:"String",
fitnessGoal:"Enum",
height:"Float",
sex:"Enum",
trainingExperience:"Enum",
weeklyTrainingDays:"Integer",
weight:"Float",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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 15 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| avatar | String | false | request.body?.["avatar"] |
| email | String | true | request.body?.["email"] |
| password | String | true | request.body?.["password"] |
| fullname | String | true | request.body?.["fullname"] |
| activityLevel | Enum | false | request.body?.["activityLevel"] |
| availableEquipment | String | false | request.body?.["availableEquipment"] |
| country | String | false | request.body?.["country"] |
| dateOfBirth | Date | false | request.body?.["dateOfBirth"] |
| dietaryRestrictions | String | false | request.body?.["dietaryRestrictions"] |
| fitnessGoal | Enum | false | request.body?.["fitnessGoal"] |
| height | Float | false | request.body?.["height"] |
| sex | Enum | true | request.body?.["sex"] |
| trainingExperience | Enum | false | request.body?.["trainingExperience"] |
| weeklyTrainingDays | Integer | false | request.body?.["weeklyTrainingDays"] |
| weight | Float | false | request.body?.["weight"] |
**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
**activityLevel** : User's general daily activity level, used as the TDEE activity multiplier.
**availableEquipment** : List of equipment available to the user for training program generation.
**country** : User's country of residence, used for regional food suggestions and cuisine preferences.
**dateOfBirth** : User's date of birth, used for age-based calorie and program calculations.
**dietaryRestrictions** : List of user dietary restrictions or allergies for meal plan customization.
**fitnessGoal** : User's primary fitness goal driving program and nutrition recommendations.
**height** : User's height in centimeters, used for BMR and TDEE calculations.
**sex** : User's biological sex, used for BMR calculations and program customization.
**trainingExperience** : User's training experience level, influencing program complexity and progression rates.
**weeklyTrainingDays** : Number of days per week the user is available to train, used for program split selection.
**weight** : User's current body weight in kilograms, used for calorie and macro calculations.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/users**
```js
axios({
method: 'POST',
url: '/v1/users',
data: {
avatar:"String",
email:"String",
password:"String",
fullname:"String",
activityLevel:"Enum",
availableEquipment:"String",
country:"String",
dateOfBirth:"Date",
dietaryRestrictions:"String",
fitnessGoal:"Enum",
height:"Float",
sex:"Enum",
trainingExperience:"Enum",
weeklyTrainingDays:"Integer",
weight:"Float",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
axios({
method: 'DELETE',
url: `/v1/users/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
axios({
method: 'DELETE',
url: `/v1/archiveprofile/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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 8 optional filter parameters for filtering list results:
**email** (`String`): A string value to represent the user's email.
- Single (partial match, case-insensitive): `?email=`
- Multiple: `?email=&email=`
- Null: `?email=null`
**fullname** (`String`): A string value to represent the fullname of the user
- Single (partial match, case-insensitive): `?fullname=`
- Multiple: `?fullname=&fullname=`
- Null: `?fullname=null`
**roleId** (`String`): A string value to represent the roleId of the user.
- Single (partial match, case-insensitive): `?roleId=`
- Multiple: `?roleId=&roleId=`
- Null: `?roleId=null`
**activityLevel** (`Enum`): User's general daily activity level, used as the TDEE activity multiplier.
- Single: `?activityLevel=` (case-insensitive)
- Multiple: `?activityLevel=&activityLevel=`
- Null: `?activityLevel=null`
**country** (`String`): User's country of residence, used for regional food suggestions and cuisine preferences.
- Single (partial match, case-insensitive): `?country=`
- Multiple: `?country=&country=`
- Null: `?country=null`
**fitnessGoal** (`Enum`): User's primary fitness goal driving program and nutrition recommendations.
- Single: `?fitnessGoal=` (case-insensitive)
- Multiple: `?fitnessGoal=&fitnessGoal=`
- Null: `?fitnessGoal=null`
**sex** (`Enum`): User's biological sex, used for BMR calculations and program customization.
- Single: `?sex=` (case-insensitive)
- Multiple: `?sex=&sex=`
- Null: `?sex=null`
**trainingExperience** (`Enum`): User's training experience level, influencing program complexity and progression rates.
- Single: `?trainingExperience=` (case-insensitive)
- Multiple: `?trainingExperience=&trainingExperience=`
- Null: `?trainingExperience=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/users**
```js
axios({
method: 'GET',
url: '/v1/users',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// email: '' // Filter by email
// fullname: '' // Filter by fullname
// roleId: '' // Filter by roleId
// activityLevel: '' // Filter by activityLevel
// country: '' // Filter by country
// fitnessGoal: '' // Filter by fitnessGoal
// sex: '' // Filter by sex
// trainingExperience: '' // Filter by trainingExperience
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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 6 optional filter parameters for filtering list results:
**roleId** (`String`): A string value to represent the roleId of the user.
- Single (partial match, case-insensitive): `?roleId=`
- Multiple: `?roleId=&roleId=`
- Null: `?roleId=null`
**activityLevel** (`Enum`): User's general daily activity level, used as the TDEE activity multiplier.
- Single: `?activityLevel=` (case-insensitive)
- Multiple: `?activityLevel=&activityLevel=`
- Null: `?activityLevel=null`
**country** (`String`): User's country of residence, used for regional food suggestions and cuisine preferences.
- Single (partial match, case-insensitive): `?country=`
- Multiple: `?country=&country=`
- Null: `?country=null`
**fitnessGoal** (`Enum`): User's primary fitness goal driving program and nutrition recommendations.
- Single: `?fitnessGoal=` (case-insensitive)
- Multiple: `?fitnessGoal=&fitnessGoal=`
- Null: `?fitnessGoal=null`
**sex** (`Enum`): User's biological sex, used for BMR calculations and program customization.
- Single: `?sex=` (case-insensitive)
- Multiple: `?sex=&sex=`
- Null: `?sex=null`
**trainingExperience** (`Enum`): User's training experience level, influencing program complexity and progression rates.
- Single: `?trainingExperience=` (case-insensitive)
- Multiple: `?trainingExperience=&trainingExperience=`
- Null: `?trainingExperience=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/searchusers**
```js
axios({
method: 'GET',
url: '/v1/searchusers',
data: {
},
params: {
keyword:'"String"',
// Filter parameters (see Filter Parameters section above)
// roleId: '' // Filter by roleId
// activityLevel: '' // Filter by activityLevel
// country: '' // Filter by country
// fitnessGoal: '' // Filter by fitnessGoal
// sex: '' // Filter by sex
// trainingExperience: '' // Filter by trainingExperience
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
axios({
method: 'PATCH',
url: `/v1/userrole/${userId}`,
data: {
roleId:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
axios({
method: 'PATCH',
url: `/v1/userpassword/${userId}`,
data: {
oldPassword:"String",
newPassword:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
axios({
method: 'PATCH',
url: `/v1/userpasswordbyadmin/${userId}`,
data: {
password:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
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.
```json
{
"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**
```js
axios({
method: 'GET',
url: `/v1/streamtest/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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 15 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"] |
| email | String | true | request.body?.["email"] |
| activityLevel | Enum | false | request.body?.["activityLevel"] |
| availableEquipment | String | false | request.body?.["availableEquipment"] |
| country | String | false | request.body?.["country"] |
| dateOfBirth | Date | false | request.body?.["dateOfBirth"] |
| dietaryRestrictions | String | false | request.body?.["dietaryRestrictions"] |
| fitnessGoal | Enum | false | request.body?.["fitnessGoal"] |
| height | Float | false | request.body?.["height"] |
| sex | Enum | true | request.body?.["sex"] |
| trainingExperience | Enum | false | request.body?.["trainingExperience"] |
| weeklyTrainingDays | Integer | false | request.body?.["weeklyTrainingDays"] |
| weight | Float | false | request.body?.["weight"] |
**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.
**activityLevel** : User's general daily activity level, used as the TDEE activity multiplier.
**availableEquipment** : List of equipment available to the user for training program generation.
**country** : User's country of residence, used for regional food suggestions and cuisine preferences.
**dateOfBirth** : User's date of birth, used for age-based calorie and program calculations.
**dietaryRestrictions** : List of user dietary restrictions or allergies for meal plan customization.
**fitnessGoal** : User's primary fitness goal driving program and nutrition recommendations.
**height** : User's height in centimeters, used for BMR and TDEE calculations.
**sex** : User's biological sex, used for BMR calculations and program customization.
**trainingExperience** : User's training experience level, influencing program complexity and progression rates.
**weeklyTrainingDays** : Number of days per week the user is available to train, used for program split selection.
**weight** : User's current body weight in kilograms, used for calorie and macro calculations.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/registeruser**
```js
axios({
method: 'POST',
url: '/v1/registeruser',
data: {
avatar:"String",
password:"String",
fullname:"String",
email:"String",
activityLevel:"Enum",
availableEquipment:"String",
country:"String",
dateOfBirth:"Date",
dietaryRestrictions:"String",
fitnessGoal:"Enum",
height:"Float",
sex:"Enum",
trainingExperience:"Enum",
weeklyTrainingDays:"Integer",
weight:"Float",
},
params: {
}
});
```
**REST Response**
```json
{
"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",
"activityLevel": "Enum",
"activityLevel_idx": "Integer",
"availableEquipment": "String",
"country": "String",
"dateOfBirth": "Date",
"dietaryRestrictions": "String",
"fitnessGoal": "Enum",
"fitnessGoal_idx": "Integer",
"height": "Float",
"sex": "Enum",
"sex_idx": "Integer",
"trainingExperience": "Enum",
"trainingExperience_idx": "Integer",
"weeklyTrainingDays": "Integer",
"weight": "Float",
"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**
```js
axios({
method: 'GET',
url: `/v1/useravatarsfiles/${userAvatarsFileId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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=`
- Multiple: `?mimeType=&mimeType=`
- Null: `?mimeType=null`
**ownerId** (`ID`): ID of the user who uploaded the file (from session).
- Single: `?ownerId=`
- Multiple: `?ownerId=&ownerId=`
- Null: `?ownerId=null`
**userId** (`ID`): Reference to the owner user record.
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/useravatarsfiles**
```js
axios({
method: 'GET',
url: '/v1/useravatarsfiles',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// mimeType: '' // Filter by mimeType
// ownerId: '' // Filter by ownerId
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"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**
```js
axios({
method: 'DELETE',
url: `/v1/useravatarsfiles/${userAvatarsFileId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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 `session` object in the JSON body.
- Note that `username` parameter should have the email of the user as value.
You can also send an `email` parameter instead of `username` parameter.
If both sent only `username` parameter will be read.
```js
// 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.
```json
{
"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.
```js
// 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` |
- `keyId` is optional.
If provided, retrieves the public key corresponding to the specific `keyId`.
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.
```js
// Sample GET /publickey call
axios.get("/publickey", {
params: {
keyId: "currentKeyIdOptional"
}
});
````
**Success Response**
Returns the active public key and its associated keyId.
```json
{
"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 `/publickey` route 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.
```js
// 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.
```json
{
"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.
```json
{
"status": "ERR",
"message": "Cannot relogin"
}
````
**Notes**
- The `/relogin` route 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 `emailVerificationRequiredForLogin` is active.
- During a separate user action to verify or update email addresses.
- When login fails with `EmailVerificationNeeded` and frontend initiates verification.
### Email Verification Flow
1. **Frontend calls `/verification-services/email-verification/start`** with 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).
2. **User receives the code and enters it into the frontend application.**
3. **Frontend calls `/verification-services/email-verification/complete`** with the `email` and the received `secretCode`.
- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s `emailVerified` flag is set to `true`, 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 |
|-----------|--------|----------|-----------------------------|
| email | String | Yes | The email address to verify |
```json
{
"email": "user@example.com"
}
````
#### Success Response
Secret code details (in development environment). Confirms that the verification step has been started.
```json
{
"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 |
|-------------|--------|----------|-------------------------------------|
| email | String | Yes | The user email being verified |
| secretCode | String | Yes | The secret code received via email |
```json
{
"email": "user@example.com",
"secretCode": "123456"
}
````
#### Success Response
Returns confirmation that the email has been verified.
```json
{
"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 `mobileVerificationRequiredForLogin` is active.
- During a separate user action to verify or update mobile numbers.
- When login fails with `MobileVerificationNeeded` and frontend initiates verification.
### Mobile Verification Flow
1. **Frontend calls `/verification-services/mobile-verification/start`** with 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).
2. **User receives the code and enters it into the frontend application.**
3. **Frontend calls `/verification-services/mobile-verification/complete`** with the `email` and the received `secretCode`.
- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s `mobileVerified` flag is set to `true`, 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 |
|-----------|--------|----------|-------------------------------------|
| email | String | Yes | The email address associated with the mobile number to verify |
```json
{
"email": "user@example.com"
}
````
**Success Response**
Secret code details (in development environment). Confirms that the verification step has been started.
```json
{
"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 |
|-------------|--------|----------|------------------------------------|
| email | String | Yes | The user's email being verified |
| secretCode | String | Yes | The secret code received via SMS |
```json
{
"email": "user@example.com",
"secretCode": "123456"
}
````
**Success Response**
Returns confirmation that the mobile number has been verified.
```json
{
"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 `sessionNeedsEmail2FA` is `true`
- When the backend enforces two-factor authentication for a sensitive operation
### Email 2FA Flow
1. **Frontend calls `/verification-services/email-2factor-verification/start`** with 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.
2. **User receives the code and enters it into the frontend application.**
3. **Frontend calls `/verification-services/email-2factor-verification/complete`** with the `userId`, `sessionId`, and the `secretCode`.
- 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 |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"client": "login-page",
"reason": "Login requires email 2FA"
}
````
#### Success Response
```json
{
"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 |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"secretCode": "123456"
}
````
#### Success Response
Returns an updated session with 2FA disabled:
```json
{
"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
1. **Frontend calls `/verification-services/mobile-2factor-verification/start`** with 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).
2. **User receives the code and enters it in the frontend app.**
3. **Frontend calls `/verification-services/mobile-2factor-verification/complete`** with the `userId`, `sessionId`, and `secretCode`.
- Mindbricks validates the code for expiration and correctness.
- If valid, the session flag `sessionNeedsMobile2FA` is 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 |
```json
{
"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.
```json
{
"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 |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"secretCode": "654321"
}
````
**Success Response**
Returns the updated session with `sessionNeedsMobile2FA: false`.
```json
{
"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
1. **Frontend calls `/verification-services/password-reset-by-email/start`** with 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).
2. **User receives the code and enters it into the frontend along with the new password.**
3. **Frontend calls `/verification-services/password-reset-by-email/complete`** with the `email`, the `secretCode`, and the new `password`.
- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s password is reset, their `emailVerified` flag is set to `true`, 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 |
|-----------|--------|----------|-------------------------------------|
| email | String | Yes | The email address of the user |
```json
{
"email": "user@example.com"
}
````
**Success Response**
Returns secret code details (only in development environment) and confirmation that the verification step has been started.
```json
{
"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 |
|-------------|--------|----------|----------------------------------------------|
| email | 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 |
```json
{
"email": "user@example.com",
"secretCode": "123456",
"password": "newSecurePassword123"
}
````
**Success Response**
```json
{
"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
1. **Frontend calls `/verification-services/password-reset-by-mobile/start`** with 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).
2. **User receives the code via SMS and enters it into the frontend app.**
3. **Frontend calls `/verification-services/password-reset-by-mobile/complete`** with the user's `email`, the `secretCode`, and the new `password`.
- 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 |
```json
{
"mobile": "+905551234567"
}
````
### Success Response
Returns the verification context (code returned only in development):
```json
{
"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 |
|-------------|--------|----------|-------------------------------------------------|
| email | String | Yes | The email address of the user |
| secretCode | String | Yes | The code received via SMS |
| password | String | Yes | The new password to assign |
```json
{
"email": "user@example.com",
"secretCode": "123456",
"password": "NewSecurePassword123!"
}
````
### Success Response
```json
{
"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.
```js
// 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 (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"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.
```json
{
"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`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, 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
## aifitapp-aicoach-service
**Version:** `1.0.116`
AI-powered fitness coaching service that generates personalized evidence-based training programs and nutrition plans, manages chatbowt interactions with full validation chains, handles dynamic program modifications via AI tool calls, tracks weaight measurements, enforces moderation and quotas, and provides admin endpoints for moderation history and usage analytics.a
## 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 AiCoach Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our AiCoach Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the AiCoach Service via HTTP requests for purposes such as creating, updating, deleting and querying AiCoach 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 AiCoach 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 AiCoach 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 | appaili-access-token|
| Cookie | appaili-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 AiCoach 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 AiCoach 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:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://appaili.prw.mindbricks.com/aicoach-api`
* **Staging:** `https://appaili-stage.mindbricks.co/aicoach-api`
* **Production:** `https://appaili.mindbricks.co/aicoach-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 AiCoach 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 `AiCoach` 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, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. 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 to `false`, 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 list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows 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 `AiCoach` 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.
```js
{
"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 `AiCoach` 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:
```json
{
"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
AiCoach 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.
### ChatMessage resource
*Resource Definition* : Individual chat messages in coach conversations. Stores user, assistant, and system messages with content flagging status and tool call metadata.
*ChatMessage Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **content** | Text | | | *Message content* |
| **conversationId** | ID | | | *Reference to the parent conversation* |
| **flagged** | Boolean | | | *True if the message was detected as off-topic or abusive* |
| **role** | Enum | | | *Message sender role* |
| **toolCallData** | Text | | | *JSON string of tool call metadata from AI processing* |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### role Enum Property
*Property Definition* : Message sender role*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **user** | `"user""` | 0 |
| **assistant** | `"assistant""` | 1 |
| **system** | `"system""` | 2 |
### CoachConversation resource
*Resource Definition* : Chat conversation container per user for the AI fitness coach chatbot.
*CoachConversation Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **status** | Enum | | | *Conversation status* |
| **userId** | ID | | | *Reference to the user who owns this conversation* |
#### 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* : Conversation status*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **active** | `"active""` | 0 |
| **closed** | `"closed""` | 1 |
### MealPlan resource
*Resource Definition* : Stores AI-generated meal plans per user including calorie targets, macro distribution, and training/rest day differentiation. Created and modified exclusively by AI tool calls.
*MealPlan Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **carbGrams** | Float | | | *Daily carbohydrate target in grams* |
| **dailyCalorieTarget** | Integer | | | *Daily calorie target in kcal* |
| **fatGrams** | Float | | | *Daily fat target in grams* |
| **notes** | Text | | | *Additional AI-generated nutritional guidance* |
| **proteinGrams** | Float | | | *Daily protein target in grams* |
| **restDayCalories** | Integer | | | *Calorie target on rest days* |
| **restDayCarbGrams** | Float | | | *Carb target on rest days* |
| **status** | Enum | | | *Meal plan status* |
| **trainingDayCalories** | Integer | | | *Calorie target on training days* |
| **trainingDayCarbGrams** | Float | | | *Carb target on training days* |
| **userId** | ID | | | *Reference to the user who owns this meal plan* |
#### 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* : Meal plan status*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **active** | `"active""` | 0 |
| **archived** | `"archived""` | 1 |
### ModerationRecord resource
*Resource Definition* : Tracks user offenses and moderation actions for accurate progressive penalty escalation and admin review.
*ModerationRecord Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **action** | Enum | | | *Moderation action taken* |
| **offenseType** | String | | | *Description of the violation* |
| **reason** | Text | | | *Detailed reason for the moderation action* |
| **suspensionExpiresAt** | Date | | | *When a temporary suspension ends (null for lifetime bans and reversals)* |
| **userId** | ID | | | *Reference to the user who was moderated* |
| **content** | String | | | ** |
#### 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 taken*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **suspension24h** | `"suspension24h""` | 0 |
| **suspension1week** | `"suspension1week""` | 1 |
| **lifetimeBan** | `"lifetimeBan""` | 2 |
| **banReversal** | `"banReversal""` | 3 |
### PlanMeal resource
*Resource Definition* : Individual meals within a meal plan with food details and macro breakdown. Created and modified exclusively by AI tool calls.
*PlanMeal Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **carbs** | Float | | | *Carb grams for this meal* |
| **fat** | Float | | | *Fat grams for this meal* |
| **foods** | Text | | | *Food items and quantities description* |
| **mealLabel** | String | | | *Meal label (e.g. breakfast, lunch, dinner, snack)* |
| **mealPlanId** | ID | | | *Reference to the parent meal plan* |
| **protein** | Float | | | *Protein grams for this meal* |
| **sortOrder** | Integer | | | *Display sort order within the meal plan* |
| **totalCalories** | Integer | | | *Total calories for this meal* |
### ProgramExercise resource
*Resource Definition* : Individual exercises within a training program with sets, reps, RIR targets, and progression rules. Created and modified exclusively by AI tool calls.
*ProgramExercise Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **dayLabel** | String | | | *Training day label (e.g. pushDay, upperA, legDay)* |
| **exerciseName** | String | | | *Name of the exercise* |
| **movementType** | Enum | | | *Movement type classification* |
| **muscleGroup** | String | | | *Target muscle group* |
| **progressionRule** | Text | | | *Progression instructions (e.g. double progression model)* |
| **repMax** | Integer | | | *Maximum rep target* |
| **repMin** | Integer | | | *Minimum rep target* |
| **rirTarget** | Integer | | | *Reps In Reserve target (0-3)* |
| **sets** | Integer | | | *Number of working sets* |
| **sortOrder** | Integer | | | *Display sort order within the training day* |
| **trainingProgramId** | ID | | | *Reference to the parent training program* |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### movementType Enum Property
*Property Definition* : Movement type classification*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **lengthened** | `"lengthened""` | 0 |
| **shortened** | `"shortened""` | 1 |
| **compound** | `"compound""` | 2 |
### QuotaConfig resource
*Resource Definition* : System-wide message quota configuration. Admin-managed single record that defines message limits per period.
*QuotaConfig Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **quotaLimit** | Integer | | | *Maximum messages allowed per period* |
| **quotaPeriod** | Enum | | | *Period over which the quota is measured* |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### quotaPeriod Enum Property
*Property Definition* : Period over which the quota is measured*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **daily** | `"daily""` | 0 |
| **weekly** | `"weekly""` | 1 |
| **monthly** | `"monthly""` | 2 |
### TrainingProgram resource
*Resource Definition* : Stores AI-generated training programs per user including split type, deload schedule, cardio guidelines, and step targets. Created and modified exclusively by AI tool calls.
*TrainingProgram Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **cardioDurationMinutes** | Integer | | | *Recommended cardio duration in minutes* |
| **cardioFrequencyPerWeek** | Integer | | | *Recommended cardio sessions per week* |
| **cardioType** | String | | | *Type of cardio recommended (e.g. zone2)* |
| **dailyStepTarget** | Integer | | | *Daily step target for NEAT (7000-12000)* |
| **deloadIntervalWeeks** | Integer | | | *Weeks between deload periods, typically 6-8* |
| **notes** | Text | | | *Additional AI-generated notes and guidance* |
| **splitType** | String | | | *Training split type (e.g. fullBody, upperLower, pushPullLegs)* |
| **status** | Enum | | | *Program status* |
| **userId** | ID | | | *Reference to the user who owns this training program* |
#### 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* : Program status*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **active** | `"active""` | 0 |
| **archived** | `"archived""` | 1 |
### UserQuota resource
*Resource Definition* : Per-user message quota consumption tracking against the system-wide quota configuration.
*UserQuota Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **messageCount** | Integer | | | *Number of messages consumed in the current period* |
| **periodEnd** | Date | | | *End of the current quota period* |
| **periodStart** | Date | | | *Start of the current quota period* |
| **userId** | ID | | | *Reference to the user whose quota is being tracked* |
### WeightLog resource
*Resource Definition* : User-reported weight measurements used for weekly average calculations and dynamic calorie adjustments by the AI coach.
*WeightLog Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **measuredAt** | Date | | | *Date and time of measurement* |
| **userId** | ID | | | *Reference to the user who recorded this weight* |
| **weightKg** | Float | | | *Body weight in kilograms* |
### BanAppeals resource
*BanAppeals Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **moderationRecordId** | ID | | | *id of the mod record* |
| **userId** | ID | | | ** |
| **appealReason** | String | | | ** |
| **status** | Enum | | | ** |
#### 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 |
| **approved** | `"approved""` | 1 |
| **rejected** | `"rejected""` | 2 |
### AdditionalQuota resource
*AdditionalQuota Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **userId** | String | | | ** |
| **additionalMessage** | Integer | | | ** |
| **status** | Enum | | | ** |
| **currency** | String | | | ** |
| **pricePaid** | Integer | | | ** |
| **statusUpdatedAt** | Date | | | ** |
| **activatedAt** | Date | | | ** |
| **cancelledAt** | Date | | | ** |
| **periodEnd** | Date | | | ** |
| **periodStart** | Date | | | ** |
| **paymentConfirmation** | Enum | | | *An automatic property that is used to check the confirmed status of the payment set by webhooks.* |
#### 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 |
| **cancelled** | `"cancelled""` | 1 |
| **failed** | `"failed""` | 2 |
| **active** | `"active""` | 3 |
| **expired** | `"expired""` | 4 |
##### paymentConfirmation Enum Property
*Property Definition* : An automatic property that is used to check the confirmed status of the payment set by webhooks.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **processing** | `"processing""` | 1 |
| **paid** | `"paid""` | 2 |
| **canceled** | `"canceled""` | 3 |
### Sys_additionalQuotaPayment resource
*Resource Definition* : A payment storage object to store the payment life cyle of orders based on additionalQuota object. It is autocreated based on the source object's checkout config
*Sys_additionalQuotaPayment Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **ownerId** | ID | | | * An ID value to represent owner user who created the order* |
| **orderId** | ID | | | *an ID value to represent the orderId which is the ID parameter of the source additionalQuota object* |
| **paymentId** | String | | | *A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type* |
| **paymentStatus** | String | | | *A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.* |
| **statusLiteral** | String | | | *A string value to represent the logical payment status which belongs to the application lifecycle itself.* |
| **redirectUrl** | String | | | *A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.* |
### Sys_paymentCustomer resource
*Resource Definition* : A payment storage object to store the customer values of the payment platform
*Sys_paymentCustomer Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **userId** | ID | | | * An ID value to represent the user who is created as a stripe customer* |
| **customerId** | String | | | *A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway* |
| **platform** | String | | | *A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.* |
### Sys_paymentMethod resource
*Resource Definition* : A payment storage object to store the payment methods of the platform customers
*Sys_paymentMethod Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **paymentMethodId** | String | | | *A string value to represent the id of the payment method on the payment platform.* |
| **userId** | ID | | | * An ID value to represent the user who owns the payment method* |
| **customerId** | String | | | *A string value to represent the customer id which is generated on the payment gateway.* |
| **cardHolderName** | String | | | *A string value to represent the name of the card holder. It can be different than the registered customer.* |
| **cardHolderZip** | String | | | *A string value to represent the zip code of the card holder. It is used for address verification in specific countries.* |
| **platform** | String | | | *A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.* |
| **cardInfo** | Object | | | *A Json value to store the card details of the payment method.* |
## Business Api
### `Create Chatmessage` API
**[Default create API]** — This is the designated default `create` API for the `chatMessage` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Send a message to the AI fitness coach. Enforces the full validation chain: subscription check → ban status check → quota check → content flagging → AI processing → tool call execution → quota increment. Returns both the user message and the AI response.
**API Frontend Description By The Backend Architect**
# Chat Message Creation
- This is the primary interaction endpoint for the AI fitness coach.
- User sends a message and receives an AI response in the same call.
- The response includes the created user message and an aiResponse object containing the AI's reply and any tool calls executed.
- If the message is flagged, aiResponse.flagged will be true.
- Handle quota exceeded (403) and suspension (403) errors gracefully.
**Rest Route**
The `createChatMessage` API REST controller can be triggered via the following route:
`/v1/chatmessages`
**Rest Request Parameters**
The `createChatMessage` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| conversationId | ID | true | request.body?.["conversationId"] |
| content | Text | true | request.body?.["content"] |
**conversationId** : The conversation to send the message to
**content** : The message content
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/chatmessages**
```js
axios({
method: 'POST',
url: '/v1/chatmessages',
data: {
conversationId:"ID",
content:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chatMessage",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"chatMessage": {
"id": "ID",
"content": "Text",
"conversationId": "ID",
"flagged": "Boolean",
"role": "Enum",
"role_idx": "Integer",
"toolCallData": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Coachconversation` API
**[Default create API]** — This is the designated default `create` API for the `coachConversation` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a new coach conversation. Requires active subscription and no active ban.
**Rest Route**
The `createCoachConversation` API REST controller can be triggered via the following route:
`/v1/coachconversations`
**Rest Request Parameters**
The `createCoachConversation` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/coachconversations**
```js
axios({
method: 'POST',
url: '/v1/coachconversations',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "coachConversation",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"coachConversation": {
"id": "ID",
"status": "Enum",
"status_idx": "Integer",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"activeSubscriptions": "Object"
}
```
### `Create Quotaconfig` API
**[Default create API]** — This is the designated default `create` API for the `quotaConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a quota configuration record. Admin only.
**Rest Route**
The `createQuotaConfig` API REST controller can be triggered via the following route:
`/v1/quotaconfigs`
**Rest Request Parameters**
The `createQuotaConfig` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| quotaLimit | Integer | true | request.body?.["quotaLimit"] |
| quotaPeriod | Enum | true | request.body?.["quotaPeriod"] |
**quotaLimit** : Maximum messages allowed per period
**quotaPeriod** : Period over which the quota is measured
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/quotaconfigs**
```js
axios({
method: 'POST',
url: '/v1/quotaconfigs',
data: {
quotaLimit:"Integer",
quotaPeriod:"Enum",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "quotaConfig",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"quotaConfig": {
"id": "ID",
"quotaLimit": "Integer",
"quotaPeriod": "Enum",
"quotaPeriod_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Weightlog` API
**[Default create API]** — This is the designated default `create` API for the `weightLog` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Report a weight measurement. Requires active subscription and no active ban.
**Rest Route**
The `createWeightLog` API REST controller can be triggered via the following route:
`/v1/weightlogs`
**Rest Request Parameters**
The `createWeightLog` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| measuredAt | Date | true | request.body?.["measuredAt"] |
| weightKg | Float | true | request.body?.["weightKg"] |
**measuredAt** : Date and time of measurement
**weightKg** : Body weight in kilograms
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/weightlogs**
```js
axios({
method: 'POST',
url: '/v1/weightlogs',
data: {
measuredAt:"Date",
weightKg:"Float",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "weightLog",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"weightLog": {
"id": "ID",
"measuredAt": "Date",
"userId": "ID",
"weightKg": "Float",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Chatmessage` API
**[Default get API]** — This is the designated default `get` API for the `chatMessage` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a chat message by ID with parent conversation ownership validation.
**Rest Route**
The `getChatMessage` API REST controller can be triggered via the following route:
`/v1/chatmessages/:chatMessageId`
**Rest Request Parameters**
The `getChatMessage` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| chatMessageId | ID | true | request.params?.["chatMessageId"] |
**chatMessageId** : 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/chatmessages/:chatMessageId**
```js
axios({
method: 'GET',
url: `/v1/chatmessages/${chatMessageId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chatMessage",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"chatMessage": {
"id": "ID",
"content": "Text",
"conversationId": "ID",
"flagged": "Boolean",
"role": "Enum",
"role_idx": "Integer",
"toolCallData": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Coachconversation` API
**[Default get API]** — This is the designated default `get` API for the `coachConversation` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a conversation by ID. Users see their own, admins can see any.
**Rest Route**
The `getCoachConversation` API REST controller can be triggered via the following route:
`/v1/coachconversations/:coachConversationId`
**Rest Request Parameters**
The `getCoachConversation` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| coachConversationId | ID | true | request.params?.["coachConversationId"] |
**coachConversationId** : 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/coachconversations/:coachConversationId**
```js
axios({
method: 'GET',
url: `/v1/coachconversations/${coachConversationId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "coachConversation",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"coachConversation": {
"id": "ID",
"status": "Enum",
"status_idx": "Integer",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Mealplan` API
**[Default get API]** — This is the designated default `get` API for the `mealPlan` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a meal plan by ID with meals. Users see their own, admins can see any.
**Rest Route**
The `getMealPlan` API REST controller can be triggered via the following route:
`/v1/mealplans/:mealPlanId`
**Rest Request Parameters**
The `getMealPlan` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| mealPlanId | ID | true | request.params?.["mealPlanId"] |
**mealPlanId** : 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/mealplans/:mealPlanId**
```js
axios({
method: 'GET',
url: `/v1/mealplans/${mealPlanId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "mealPlan",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"mealPlan": {
"id": "ID",
"carbGrams": "Float",
"dailyCalorieTarget": "Integer",
"fatGrams": "Float",
"notes": "Text",
"proteinGrams": "Float",
"restDayCalories": "Integer",
"restDayCarbGrams": "Float",
"status": "Enum",
"status_idx": "Integer",
"trainingDayCalories": "Integer",
"trainingDayCarbGrams": "Float",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"meals": [
{
"id": "ID",
"carbs": "Float",
"fat": "Float",
"foods": "Text",
"mealLabel": "String",
"mealPlanId": "ID",
"protein": "Float",
"sortOrder": "Integer",
"totalCalories": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
]
}
}
```
### `Get Moderationrecord` API
**[Default get API]** — This is the designated default `get` API for the `moderationRecord` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a moderation record by ID. Admin only.
**Rest Route**
The `getModerationRecord` API REST controller can be triggered via the following route:
`/v1/moderationrecords/:moderationRecordId`
**Rest Request Parameters**
The `getModerationRecord` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| moderationRecordId | ID | true | request.params?.["moderationRecordId"] |
**moderationRecordId** : 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/moderationrecords/:moderationRecordId**
```js
axios({
method: 'GET',
url: `/v1/moderationrecords/${moderationRecordId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "moderationRecord",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"moderationRecord": {
"id": "ID",
"action": "Enum",
"action_idx": "Integer",
"offenseType": "String",
"reason": "Text",
"suspensionExpiresAt": "Date",
"userId": "ID",
"content": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Get Myquota` API
Get the current user's quota usage for the active period.
**Rest Route**
The `getMyQuota` API REST controller can be triggered via the following route:
`/v1/my-quota`
**Rest Request Parameters**
The `getMyQuota` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/my-quota**
```js
axios({
method: 'GET',
url: '/v1/my-quota',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userQuota",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userQuota": {
"id": "ID",
"messageCount": "Integer",
"periodEnd": "Date",
"periodStart": "Date",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Planmeal` API
**[Default get API]** — This is the designated default `get` API for the `planMeal` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a plan meal by ID with parent ownership validation.
**Rest Route**
The `getPlanMeal` API REST controller can be triggered via the following route:
`/v1/planmeals/:planMealId`
**Rest Request Parameters**
The `getPlanMeal` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| planMealId | ID | true | request.params?.["planMealId"] |
**planMealId** : 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/planmeals/:planMealId**
```js
axios({
method: 'GET',
url: `/v1/planmeals/${planMealId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "planMeal",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"planMeal": {
"id": "ID",
"carbs": "Float",
"fat": "Float",
"foods": "Text",
"mealLabel": "String",
"mealPlanId": "ID",
"protein": "Float",
"sortOrder": "Integer",
"totalCalories": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Programexercise` API
**[Default get API]** — This is the designated default `get` API for the `programExercise` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a program exercise by ID with parent ownership validation.
**Rest Route**
The `getProgramExercise` API REST controller can be triggered via the following route:
`/v1/programexercises/:programExerciseId`
**Rest Request Parameters**
The `getProgramExercise` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| programExerciseId | ID | true | request.params?.["programExerciseId"] |
**programExerciseId** : 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/programexercises/:programExerciseId**
```js
axios({
method: 'GET',
url: `/v1/programexercises/${programExerciseId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "programExercise",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"programExercise": {
"id": "ID",
"dayLabel": "String",
"exerciseName": "String",
"movementType": "Enum",
"movementType_idx": "Integer",
"muscleGroup": "String",
"progressionRule": "Text",
"repMax": "Integer",
"repMin": "Integer",
"rirTarget": "Integer",
"sets": "Integer",
"sortOrder": "Integer",
"trainingProgramId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Quotaconfig` API
**[Default get API]** — This is the designated default `get` API for the `quotaConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a quota configuration record.
**Rest Route**
The `getQuotaConfig` API REST controller can be triggered via the following route:
`/v1/quotaconfigs/:quotaConfigId`
**Rest Request Parameters**
The `getQuotaConfig` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| quotaConfigId | ID | true | request.params?.["quotaConfigId"] |
**quotaConfigId** : 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/quotaconfigs/:quotaConfigId**
```js
axios({
method: 'GET',
url: `/v1/quotaconfigs/${quotaConfigId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "quotaConfig",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"quotaConfig": {
"id": "ID",
"quotaLimit": "Integer",
"quotaPeriod": "Enum",
"quotaPeriod_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Trainingprogram` API
**[Default get API]** — This is the designated default `get` API for the `trainingProgram` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a training program by ID. Users see their own programs, admins can see any.
**Rest Route**
The `getTrainingProgram` API REST controller can be triggered via the following route:
`/v1/trainingprograms/:trainingProgramId`
**Rest Request Parameters**
The `getTrainingProgram` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| trainingProgramId | ID | true | request.params?.["trainingProgramId"] |
**trainingProgramId** : 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/trainingprograms/:trainingProgramId**
```js
axios({
method: 'GET',
url: `/v1/trainingprograms/${trainingProgramId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "trainingProgram",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"trainingProgram": {
"id": "ID",
"cardioDurationMinutes": "Integer",
"cardioFrequencyPerWeek": "Integer",
"cardioType": "String",
"dailyStepTarget": "Integer",
"deloadIntervalWeeks": "Integer",
"notes": "Text",
"splitType": "String",
"status": "Enum",
"status_idx": "Integer",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"exercises": [
{
"id": "ID",
"dayLabel": "String",
"exerciseName": "String",
"movementType": "Enum",
"movementType_idx": "Integer",
"muscleGroup": "String",
"progressionRule": "Text",
"repMax": "Integer",
"repMin": "Integer",
"rirTarget": "Integer",
"sets": "Integer",
"sortOrder": "Integer",
"trainingProgramId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
]
}
}
```
### `Get Userquota` API
**[Default get API]** — This is the designated default `get` API for the `userQuota` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a user quota record. Users see their own, admins can see any.
**Rest Route**
The `getUserQuota` API REST controller can be triggered via the following route:
`/v1/userquotas/:userQuotaId`
**Rest Request Parameters**
The `getUserQuota` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userQuotaId | ID | true | request.params?.["userQuotaId"] |
**userQuotaId** : 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/userquotas/:userQuotaId**
```js
axios({
method: 'GET',
url: `/v1/userquotas/${userQuotaId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userQuota",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userQuota": {
"id": "ID",
"messageCount": "Integer",
"periodEnd": "Date",
"periodStart": "Date",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"additionalQuota": "Object"
}
```
### `Get Weightlog` API
**[Default get API]** — This is the designated default `get` API for the `weightLog` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get a weight log entry by ID.
**Rest Route**
The `getWeightLog` API REST controller can be triggered via the following route:
`/v1/weightlogs/:weightLogId`
**Rest Request Parameters**
The `getWeightLog` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| weightLogId | ID | true | request.params?.["weightLogId"] |
**weightLogId** : 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/weightlogs/:weightLogId**
```js
axios({
method: 'GET',
url: `/v1/weightlogs/${weightLogId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "weightLog",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"weightLog": {
"id": "ID",
"measuredAt": "Date",
"userId": "ID",
"weightKg": "Float",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Chatmessages` API
**[Default list API]** — This is the designated default `list` API for the `chatMessage` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List chat messages for a conversation with parent ownership validation.
**Rest Route**
The `listChatMessages` API REST controller can be triggered via the following route:
`/v1/chatmessages`
**Rest Request Parameters**
The `listChatMessages` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| conversationId | ID | true | request.query?.["conversationId"] |
**conversationId** : The conversation to list messages for
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/chatmessages**
```js
axios({
method: 'GET',
url: '/v1/chatmessages',
data: {
},
params: {
conversationId:'"ID"',
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "chatMessages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"chatMessages": [
{
"id": "ID",
"content": "Text",
"conversationId": "ID",
"flagged": "Boolean",
"role": "Enum",
"role_idx": "Integer",
"toolCallData": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Coachconversations` API
**[Default list API]** — This is the designated default `list` API for the `coachConversation` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List conversations. Users see their own, admins can see all.
**Rest Route**
The `listCoachConversations` API REST controller can be triggered via the following route:
`/v1/coachconversations`
**Rest Request Parameters**
**Filter Parameters**
The `listCoachConversations` api supports 2 optional filter parameters for filtering list results:
**status** (`Enum`): Conversation status
- Single: `?status=` (case-insensitive)
- Multiple: `?status=&status=`
- Null: `?status=null`
**userId** (`ID`): Reference to the user who owns this conversation
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/coachconversations**
```js
axios({
method: 'GET',
url: '/v1/coachconversations',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// status: '' // Filter by status
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "coachConversations",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"coachConversations": [
{
"id": "ID",
"status": "Enum",
"status_idx": "Integer",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Mealplans` API
**[Default list API]** — This is the designated default `list` API for the `mealPlan` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List meal plans. Users see their own, admins can see all.
**Rest Route**
The `listMealPlans` API REST controller can be triggered via the following route:
`/v1/mealplans`
**Rest Request Parameters**
**Filter Parameters**
The `listMealPlans` api supports 2 optional filter parameters for filtering list results:
**status** (`Enum`): Meal plan status
- Single: `?status=` (case-insensitive)
- Multiple: `?status=&status=`
- Null: `?status=null`
**userId** (`ID`): Reference to the user who owns this meal plan
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/mealplans**
```js
axios({
method: 'GET',
url: '/v1/mealplans',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// status: '' // Filter by status
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "mealPlans",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"mealPlans": [
{
"id": "ID",
"carbGrams": "Float",
"dailyCalorieTarget": "Integer",
"fatGrams": "Float",
"notes": "Text",
"proteinGrams": "Float",
"restDayCalories": "Integer",
"restDayCarbGrams": "Float",
"status": "Enum",
"status_idx": "Integer",
"trainingDayCalories": "Integer",
"trainingDayCarbGrams": "Float",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Moderationrecords` API
**[Default list API]** — This is the designated default `list` API for the `moderationRecord` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List moderation records. Admin only. Supports filtering by userId and action.
**Rest Route**
The `listModerationRecords` API REST controller can be triggered via the following route:
`/v1/moderationrecords`
**Rest Request Parameters**
**Filter Parameters**
The `listModerationRecords` api supports 2 optional filter parameters for filtering list results:
**action** (`Enum`): Moderation action taken
- Single: `?action=` (case-insensitive)
- Multiple: `?action=&action=`
- Null: `?action=null`
**userId** (`ID`): Reference to the user who was moderated
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/moderationrecords**
```js
axios({
method: 'GET',
url: '/v1/moderationrecords',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// action: '' // Filter by action
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "moderationRecords",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"moderationRecords": [
{
"id": "ID",
"action": "Enum",
"action_idx": "Integer",
"offenseType": "String",
"reason": "Text",
"suspensionExpiresAt": "Date",
"userId": "ID",
"content": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Planmeals` API
**[Default list API]** — This is the designated default `list` API for the `planMeal` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List meals for a meal plan with parent ownership validation.
**Rest Route**
The `listPlanMeals` API REST controller can be triggered via the following route:
`/v1/planmeals`
**Rest Request Parameters**
The `listPlanMeals` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| mealPlanId | ID | true | request.query?.["mealPlanId"] |
**mealPlanId** : The meal plan ID to list meals for
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/planmeals**
```js
axios({
method: 'GET',
url: '/v1/planmeals',
data: {
},
params: {
mealPlanId:'"ID"',
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "planMeals",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"planMeals": [
{
"id": "ID",
"carbs": "Float",
"fat": "Float",
"foods": "Text",
"mealLabel": "String",
"mealPlanId": "ID",
"protein": "Float",
"sortOrder": "Integer",
"totalCalories": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Programexercises` API
**[Default list API]** — This is the designated default `list` API for the `programExercise` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List exercises for a training program. Validates parent program ownership.
**Rest Route**
The `listProgramExercises` API REST controller can be triggered via the following route:
`/v1/programexercises`
**Rest Request Parameters**
The `listProgramExercises` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| trainingProgramId | ID | true | request.query?.["trainingProgramId"] |
**trainingProgramId** : The training program ID to list exercises for
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/programexercises**
```js
axios({
method: 'GET',
url: '/v1/programexercises',
data: {
},
params: {
trainingProgramId:'"ID"',
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "programExercises",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"programExercises": [
{
"id": "ID",
"dayLabel": "String",
"exerciseName": "String",
"movementType": "Enum",
"movementType_idx": "Integer",
"muscleGroup": "String",
"progressionRule": "Text",
"repMax": "Integer",
"repMin": "Integer",
"rirTarget": "Integer",
"sets": "Integer",
"sortOrder": "Integer",
"trainingProgramId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Quotaconfigs` API
**[Default list API]** — This is the designated default `list` API for the `quotaConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List quota configuration records.
**Rest Route**
The `listQuotaConfigs` API REST controller can be triggered via the following route:
`/v1/quotaconfigs`
**Rest Request Parameters**
The `listQuotaConfigs` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/quotaconfigs**
```js
axios({
method: 'GET',
url: '/v1/quotaconfigs',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "quotaConfigs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"quotaConfigs": [
{
"id": "ID",
"quotaLimit": "Integer",
"quotaPeriod": "Enum",
"quotaPeriod_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Trainingprograms` API
**[Default list API]** — This is the designated default `list` API for the `trainingProgram` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List training programs. Users see their own programs, admins can see all.
**Rest Route**
The `listTrainingPrograms` API REST controller can be triggered via the following route:
`/v1/trainingprograms`
**Rest Request Parameters**
**Filter Parameters**
The `listTrainingPrograms` api supports 2 optional filter parameters for filtering list results:
**status** (`Enum`): Program status
- Single: `?status=` (case-insensitive)
- Multiple: `?status=&status=`
- Null: `?status=null`
**userId** (`ID`): Reference to the user who owns this training program
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/trainingprograms**
```js
axios({
method: 'GET',
url: '/v1/trainingprograms',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// status: '' // Filter by status
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "trainingPrograms",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"trainingPrograms": [
{
"id": "ID",
"cardioDurationMinutes": "Integer",
"cardioFrequencyPerWeek": "Integer",
"cardioType": "String",
"dailyStepTarget": "Integer",
"deloadIntervalWeeks": "Integer",
"notes": "Text",
"splitType": "String",
"status": "Enum",
"status_idx": "Integer",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Userquotas` API
**[Default list API]** — This is the designated default `list` API for the `userQuota` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all user quotas. Admin only.
**Rest Route**
The `listUserQuotas` API REST controller can be triggered via the following route:
`/v1/userquotas`
**Rest Request Parameters**
**Filter Parameters**
The `listUserQuotas` api supports 1 optional filter parameter for filtering list results:
**userId** (`ID`): Reference to the user whose quota is being tracked
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/userquotas**
```js
axios({
method: 'GET',
url: '/v1/userquotas',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userQuotas",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"userQuotas": [
{
"id": "ID",
"messageCount": "Integer",
"periodEnd": "Date",
"periodStart": "Date",
"userId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Weightlogs` API
**[Default list API]** — This is the designated default `list` API for the `weightLog` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List weight log entries. Users see their own, admins see all.
**Rest Route**
The `listWeightLogs` API REST controller can be triggered via the following route:
`/v1/weightlogs`
**Rest Request Parameters**
The `listWeightLogs` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/weightlogs**
```js
axios({
method: 'GET',
url: '/v1/weightlogs',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "weightLogs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"weightLogs": [
{
"id": "ID",
"measuredAt": "Date",
"userId": "ID",
"weightKg": "Float",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Quotaconfig` API
**[Default update API]** — This is the designated default `update` API for the `quotaConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update a quota configuration record. Admin only.
**Rest Route**
The `updateQuotaConfig` API REST controller can be triggered via the following route:
`/v1/quotaconfigs/:quotaConfigId`
**Rest Request Parameters**
The `updateQuotaConfig` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| quotaConfigId | ID | true | request.params?.["quotaConfigId"] |
| quotaLimit | Integer | false | request.body?.["quotaLimit"] |
| quotaPeriod | Enum | false | request.body?.["quotaPeriod"] |
**quotaConfigId** : This id paremeter is used to select the required data object that will be updated
**quotaLimit** : Maximum messages allowed per period
**quotaPeriod** : Period over which the quota is measured
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/quotaconfigs/:quotaConfigId**
```js
axios({
method: 'PATCH',
url: `/v1/quotaconfigs/${quotaConfigId}`,
data: {
quotaLimit:"Integer",
quotaPeriod:"Enum",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "quotaConfig",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"quotaConfig": {
"id": "ID",
"quotaLimit": "Integer",
"quotaPeriod": "Enum",
"quotaPeriod_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Moderationrecord` API
**Rest Route**
The `deleteModerationRecord` API REST controller can be triggered via the following route:
`/v1/moderationrecords/:moderationRecordId`
**Rest Request Parameters**
The `deleteModerationRecord` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| moderationRecordId | ID | true | request.params?.["moderationRecordId"] |
**moderationRecordId** : 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/moderationrecords/:moderationRecordId**
```js
axios({
method: 'DELETE',
url: `/v1/moderationrecords/${moderationRecordId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "moderationRecord",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"moderationRecord": {
"id": "ID",
"action": "Enum",
"action_idx": "Integer",
"offenseType": "String",
"reason": "Text",
"suspensionExpiresAt": "Date",
"userId": "ID",
"content": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": false
}
}
```
### `Do Deletemealplan` API
**Rest Route**
The `deletemealplan` API REST controller can be triggered via the following route:
`/v1/deletemealplan/:mealPlanId`
**Rest Request Parameters**
The `deletemealplan` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| mealPlanId | ID | true | request.params?.["mealPlanId"] |
**mealPlanId** : 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/deletemealplan/:mealPlanId**
```js
axios({
method: 'DELETE',
url: `/v1/deletemealplan/${mealPlanId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "mealPlan",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"mealPlan": {
"id": "ID",
"carbGrams": "Float",
"dailyCalorieTarget": "Integer",
"fatGrams": "Float",
"notes": "Text",
"proteinGrams": "Float",
"restDayCalories": "Integer",
"restDayCarbGrams": "Float",
"status": "Enum",
"status_idx": "Integer",
"trainingDayCalories": "Integer",
"trainingDayCarbGrams": "Float",
"userId": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Do Deletetrainingprogram` API
**Rest Route**
The `deletetrainingprogram` API REST controller can be triggered via the following route:
`/v1/deletetrainingprogram/:trainingProgramId`
**Rest Request Parameters**
The `deletetrainingprogram` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| trainingProgramId | ID | true | request.params?.["trainingProgramId"] |
**trainingProgramId** : 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/deletetrainingprogram/:trainingProgramId**
```js
axios({
method: 'DELETE',
url: `/v1/deletetrainingprogram/${trainingProgramId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "trainingProgram",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"trainingProgram": {
"id": "ID",
"cardioDurationMinutes": "Integer",
"cardioFrequencyPerWeek": "Integer",
"cardioType": "String",
"dailyStepTarget": "Integer",
"deloadIntervalWeeks": "Integer",
"notes": "Text",
"splitType": "String",
"status": "Enum",
"status_idx": "Integer",
"userId": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Moderationrecord` API
**Rest Route**
The `updateModerationRecord` API REST controller can be triggered via the following route:
`/v1/moderationrecords/:moderationRecordId`
**Rest Request Parameters**
The `updateModerationRecord` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| moderationRecordId | ID | true | request.params?.["moderationRecordId"] |
| action | String | true | request.body?.["action"] |
| content | String | false | request.body?.["content"] |
**moderationRecordId** : This id paremeter is used to select the required data object that will be updated
**action** :
**content** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/moderationrecords/:moderationRecordId**
```js
axios({
method: 'PATCH',
url: `/v1/moderationrecords/${moderationRecordId}`,
data: {
action:"String",
content:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "moderationRecord",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"moderationRecord": {
"id": "ID",
"action": "Enum",
"action_idx": "Integer",
"offenseType": "String",
"reason": "Text",
"suspensionExpiresAt": "Date",
"userId": "ID",
"content": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Do Listmymoderationrecords` API
**Rest Route**
The `listmymoderationrecords` API REST controller can be triggered via the following route:
`/v1/listmymoderationrecords`
**Rest Request Parameters**
**Filter Parameters**
The `listmymoderationrecords` api supports 1 optional filter parameter for filtering list results:
**action** (`Enum`): Moderation action taken
- Single: `?action=` (case-insensitive)
- Multiple: `?action=&action=`
- Null: `?action=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listmymoderationrecords**
```js
axios({
method: 'GET',
url: '/v1/listmymoderationrecords',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// action: '' // Filter by action
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "moderationRecords",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"moderationRecords": [
{
"id": "ID",
"action": "Enum",
"action_idx": "Integer",
"offenseType": "String",
"reason": "Text",
"suspensionExpiresAt": "Date",
"userId": "ID",
"content": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Banappeals` API
**Rest Route**
The `listBanAppeals` API REST controller can be triggered via the following route:
`/v1/banappealses`
**Rest Request Parameters**
The `listBanAppeals` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | false | request.query?.["userId"] |
| status | ID | false | request.query?.["status"] |
**userId** :
**status** :
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/banappealses**
```js
axios({
method: 'GET',
url: '/v1/banappealses',
data: {
},
params: {
userId:'"ID"',
status:'"ID"',
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "banAppealses",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"banAppealses": [
{
"id": "ID",
"moderationRecordId": "ID",
"userId": "ID",
"appealReason": "String",
"status": "Enum",
"status_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"showmoderationRecord": [
{
"offenseType": "String",
"reason": "Text",
"userId": "ID",
"content": "String"
},
{},
{}
]
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Banappeal` API
**Rest Route**
The `createBanAppeal` API REST controller can be triggered via the following route:
`/v1/banappeal`
**Rest Request Parameters**
The `createBanAppeal` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| moderationRecordId | ID | true | request.body?.["moderationRecordId"] |
| appealReason | String | true | request.body?.["appealReason"] |
| status | Enum | true | request.body?.["status"] |
**moderationRecordId** : id of the mod record
**appealReason** :
**status** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/banappeal**
```js
axios({
method: 'POST',
url: '/v1/banappeal',
data: {
moderationRecordId:"ID",
appealReason:"String",
status:"Enum",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "banAppeals",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"banAppeals": {
"id": "ID",
"moderationRecordId": "ID",
"userId": "ID",
"appealReason": "String",
"status": "Enum",
"status_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Banappeal` API
**Rest Route**
The `updateBanAppeal` API REST controller can be triggered via the following route:
`/v1/banappeal/:banAppealsId`
**Rest Request Parameters**
The `updateBanAppeal` api has got 4 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| banAppealsId | ID | true | request.params?.["banAppealsId"] |
| status | Enum | true | request.body?.["status"] |
| moderationRecordId | ID | false | request.body?.["moderationRecordId"] |
| appealReason | String | false | request.body?.["appealReason"] |
**banAppealsId** : This id paremeter is used to select the required data object that will be updated
**status** :
**moderationRecordId** : id of the mod record
**appealReason** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/banappeal/:banAppealsId**
```js
axios({
method: 'PATCH',
url: `/v1/banappeal/${banAppealsId}`,
data: {
status:"Enum",
moderationRecordId:"ID",
appealReason:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "banAppeals",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"banAppeals": {
"id": "ID",
"moderationRecordId": "ID",
"userId": "ID",
"appealReason": "String",
"status": "Enum",
"status_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Additionalquota` API
**Rest Route**
The `createAdditionalQuota` API REST controller can be triggered via the following route:
`/v1/additionalquotas`
**Rest Request Parameters**
The `createAdditionalQuota` api has got 9 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| additionalMessage | Integer | true | request.body?.["additionalMessage"] |
| status | Enum | true | request.body?.["status"] |
| currency | String | true | request.body?.["currency"] |
| pricePaid | Integer | true | request.body?.["pricePaid"] |
| statusUpdatedAt | Date | false | request.body?.["statusUpdatedAt"] |
| activatedAt | Date | false | request.body?.["activatedAt"] |
| cancelledAt | Date | false | request.body?.["cancelledAt"] |
| periodEnd | Date | false | request.body?.["periodEnd"] |
| periodStart | Date | false | request.body?.["periodStart"] |
**additionalMessage** :
**status** :
**currency** :
**pricePaid** :
**statusUpdatedAt** :
**activatedAt** :
**cancelledAt** :
**periodEnd** :
**periodStart** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/additionalquotas**
```js
axios({
method: 'POST',
url: '/v1/additionalquotas',
data: {
additionalMessage:"Integer",
status:"Enum",
currency:"String",
pricePaid:"Integer",
statusUpdatedAt:"Date",
activatedAt:"Date",
cancelledAt:"Date",
periodEnd:"Date",
periodStart:"Date",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "additionalQuota",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"additionalQuota": {
"id": "ID",
"userId": "String",
"additionalMessage": "Integer",
"status": "Enum",
"status_idx": "Integer",
"currency": "String",
"pricePaid": "Integer",
"statusUpdatedAt": "Date",
"activatedAt": "Date",
"cancelledAt": "Date",
"periodEnd": "Date",
"periodStart": "Date",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Myadditionalquota` API
**Rest Route**
The `getMyAdditionalQuota` API REST controller can be triggered via the following route:
`/v1/myadditionalquota`
**Rest Request Parameters**
The `getMyAdditionalQuota` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/myadditionalquota**
```js
axios({
method: 'GET',
url: '/v1/myadditionalquota',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "additionalQuota",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"additionalQuota": {
"id": "ID",
"userId": "String",
"additionalMessage": "Integer",
"status": "Enum",
"status_idx": "Integer",
"currency": "String",
"pricePaid": "Integer",
"statusUpdatedAt": "Date",
"activatedAt": "Date",
"cancelledAt": "Date",
"periodEnd": "Date",
"periodStart": "Date",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"myaddQuota": "Object"
}
```
### `Get Additionalquotapayment` API
This route is used to get the payment information by ID.
**Rest Route**
The `getAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/additionalquotapayment/:sys_additionalQuotaPaymentId`
**Rest Request Parameters**
The `getAdditionalQuotaPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_additionalQuotaPaymentId | ID | true | request.params?.["sys_additionalQuotaPaymentId"] |
**sys_additionalQuotaPaymentId** : 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/additionalquotapayment/:sys_additionalQuotaPaymentId**
```js
axios({
method: 'GET',
url: `/v1/additionalquotapayment/${sys_additionalQuotaPaymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_additionalQuotaPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Additionalquotapayments` API
This route is used to list all payments.
**Rest Route**
The `listAdditionalQuotaPayments` API REST controller can be triggered via the following route:
`/v1/additionalquotapayments`
**Rest Request Parameters**
**Filter Parameters**
The `listAdditionalQuotaPayments` api supports 6 optional filter parameters for filtering list results:
**ownerId** (`ID`): An ID value to represent owner user who created the order
- Single: `?ownerId=`
- Multiple: `?ownerId=&ownerId=`
- Null: `?ownerId=null`
**orderId** (`ID`): an ID value to represent the orderId which is the ID parameter of the source additionalQuota object
- Single: `?orderId=`
- Multiple: `?orderId=&orderId=`
- Null: `?orderId=null`
**paymentId** (`String`): A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
- Single (partial match, case-insensitive): `?paymentId=`
- Multiple: `?paymentId=&paymentId=`
- Null: `?paymentId=null`
**paymentStatus** (`String`): A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
- Single (partial match, case-insensitive): `?paymentStatus=`
- Multiple: `?paymentStatus=&paymentStatus=`
- Null: `?paymentStatus=null`
**statusLiteral** (`String`): A string value to represent the logical payment status which belongs to the application lifecycle itself.
- Single (partial match, case-insensitive): `?statusLiteral=`
- Multiple: `?statusLiteral=&statusLiteral=`
- Null: `?statusLiteral=null`
**redirectUrl** (`String`): A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
- Single (partial match, case-insensitive): `?redirectUrl=`
- Multiple: `?redirectUrl=&redirectUrl=`
- Null: `?redirectUrl=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/additionalquotapayments**
```js
axios({
method: 'GET',
url: '/v1/additionalquotapayments',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// ownerId: '' // Filter by ownerId
// orderId: '' // Filter by orderId
// paymentId: '' // Filter by paymentId
// paymentStatus: '' // Filter by paymentStatus
// statusLiteral: '' // Filter by statusLiteral
// redirectUrl: '' // Filter by redirectUrl
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayments",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_additionalQuotaPayments": [
{
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Additionalquotapayment` API
This route is used to create a new payment.
**Rest Route**
The `createAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/additionalquotapayment`
**Rest Request Parameters**
The `createAdditionalQuotaPayment` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId | ID | true | request.body?.["orderId"] |
| paymentId | String | true | request.body?.["paymentId"] |
| paymentStatus | String | true | request.body?.["paymentStatus"] |
| statusLiteral | String | true | request.body?.["statusLiteral"] |
| redirectUrl | String | false | request.body?.["redirectUrl"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source additionalQuota object
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/additionalquotapayment**
```js
axios({
method: 'POST',
url: '/v1/additionalquotapayment',
data: {
orderId:"ID",
paymentId:"String",
paymentStatus:"String",
statusLiteral:"String",
redirectUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayment",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"sys_additionalQuotaPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Additionalquotapayment` API
This route is used to update an existing payment.
**Rest Route**
The `updateAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/additionalquotapayment/:sys_additionalQuotaPaymentId`
**Rest Request Parameters**
The `updateAdditionalQuotaPayment` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_additionalQuotaPaymentId | ID | true | request.params?.["sys_additionalQuotaPaymentId"] |
| paymentId | String | false | request.body?.["paymentId"] |
| paymentStatus | String | false | request.body?.["paymentStatus"] |
| statusLiteral | String | false | request.body?.["statusLiteral"] |
| redirectUrl | String | false | request.body?.["redirectUrl"] |
**sys_additionalQuotaPaymentId** : This id paremeter is used to select the required data object that will be updated
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/additionalquotapayment/:sys_additionalQuotaPaymentId**
```js
axios({
method: 'PATCH',
url: `/v1/additionalquotapayment/${sys_additionalQuotaPaymentId}`,
data: {
paymentId:"String",
paymentStatus:"String",
statusLiteral:"String",
redirectUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayment",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"sys_additionalQuotaPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Additionalquotapayment` API
This route is used to delete a payment.
**Rest Route**
The `deleteAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/additionalquotapayment/:sys_additionalQuotaPaymentId`
**Rest Request Parameters**
The `deleteAdditionalQuotaPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_additionalQuotaPaymentId | ID | true | request.params?.["sys_additionalQuotaPaymentId"] |
**sys_additionalQuotaPaymentId** : 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/additionalquotapayment/:sys_additionalQuotaPaymentId**
```js
axios({
method: 'DELETE',
url: `/v1/additionalquotapayment/${sys_additionalQuotaPaymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayment",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"sys_additionalQuotaPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Additionalquotapaymentbyorderid` API
This route is used to get the payment information by order id.
**Rest Route**
The `getAdditionalQuotaPaymentByOrderId` API REST controller can be triggered via the following route:
`/v1/additionalQuotapaymentbyorderid/:orderId`
**Rest Request Parameters**
The `getAdditionalQuotaPaymentByOrderId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId | ID | true | request.params?.["orderId"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source additionalQuota object. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/additionalQuotapaymentbyorderid/:orderId**
```js
axios({
method: 'GET',
url: `/v1/additionalQuotapaymentbyorderid/${orderId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_additionalQuotaPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Additionalquotapaymentbypaymentid` API
This route is used to get the payment information by payment id.
**Rest Route**
The `getAdditionalQuotaPaymentByPaymentId` API REST controller can be triggered via the following route:
`/v1/additionalQuotapaymentbypaymentid/:paymentId`
**Rest Request Parameters**
The `getAdditionalQuotaPaymentByPaymentId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| paymentId | String | true | request.params?.["paymentId"] |
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/additionalQuotapaymentbypaymentid/:paymentId**
```js
axios({
method: 'GET',
url: `/v1/additionalQuotapaymentbypaymentid/${paymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_additionalQuotaPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_additionalQuotaPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Start Additionalquotapayment` API
Start payment for additionalQuota
**Rest Route**
The `startAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/startadditionalquotapayment/:additionalQuotaId`
**Rest Request Parameters**
The `startAdditionalQuotaPayment` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| additionalQuotaId | ID | true | request.params?.["additionalQuotaId"] |
| paymentUserParams | Object | true | request.body?.["paymentUserParams"] |
**additionalQuotaId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to start a stripe payment process. Must include paymentMethodId.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/startadditionalquotapayment/:additionalQuotaId**
```js
axios({
method: 'PATCH',
url: `/v1/startadditionalquotapayment/${additionalQuotaId}`,
data: {
paymentUserParams:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "additionalQuota",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"additionalQuota": {
"id": "ID",
"userId": "String",
"additionalMessage": "Integer",
"status": "Enum",
"status_idx": "Integer",
"currency": "String",
"pricePaid": "Integer",
"statusUpdatedAt": "Date",
"activatedAt": "Date",
"cancelledAt": "Date",
"periodEnd": "Date",
"periodStart": "Date",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Refresh Additionalquotapayment` API
Refresh payment info for additionalQuota from Stripe
**Rest Route**
The `refreshAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/refreshadditionalquotapayment/:additionalQuotaId`
**Rest Request Parameters**
The `refreshAdditionalQuotaPayment` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| additionalQuotaId | ID | true | request.params?.["additionalQuotaId"] |
| paymentUserParams | Object | false | request.body?.["paymentUserParams"] |
**additionalQuotaId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to refresh a stripe payment process
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/refreshadditionalquotapayment/:additionalQuotaId**
```js
axios({
method: 'PATCH',
url: `/v1/refreshadditionalquotapayment/${additionalQuotaId}`,
data: {
paymentUserParams:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "additionalQuota",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"additionalQuota": {
"id": "ID",
"userId": "String",
"additionalMessage": "Integer",
"status": "Enum",
"status_idx": "Integer",
"currency": "String",
"pricePaid": "Integer",
"statusUpdatedAt": "Date",
"activatedAt": "Date",
"cancelledAt": "Date",
"periodEnd": "Date",
"periodStart": "Date",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Callback Additionalquotapayment` API
Refresh payment values by gateway webhook call for additionalQuota
**Rest Route**
The `callbackAdditionalQuotaPayment` API REST controller can be triggered via the following route:
`/v1/callbackadditionalquotapayment`
**Rest Request Parameters**
The `callbackAdditionalQuotaPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| additionalQuotaId | ID | false | request.body?.["additionalQuotaId"] |
**additionalQuotaId** : The order id parameter that will be read from webhook callback params
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/callbackadditionalquotapayment**
```js
axios({
method: 'POST',
url: '/v1/callbackadditionalquotapayment',
data: {
additionalQuotaId:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "additionalQuota",
"method": "POST",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"additionalQuota": {
"id": "ID",
"userId": "String",
"additionalMessage": "Integer",
"status": "Enum",
"status_idx": "Integer",
"currency": "String",
"pricePaid": "Integer",
"statusUpdatedAt": "Date",
"activatedAt": "Date",
"cancelledAt": "Date",
"periodEnd": "Date",
"periodStart": "Date",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Get Paymentcustomerbyuserid` API
This route is used to get the payment customer information by user id.
**Rest Route**
The `getPaymentCustomerByUserId` API REST controller can be triggered via the following route:
`/v1/paymentcustomers/:userId`
**Rest Request Parameters**
The `getPaymentCustomerByUserId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : An ID value to represent the user who is created as a stripe customer. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomers/:userId**
```js
axios({
method: 'GET',
url: `/v1/paymentcustomers/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentCustomer",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_paymentCustomer": {
"id": "ID",
"userId": "ID",
"customerId": "String",
"platform": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Paymentcustomers` API
This route is used to list all payment customers.
**Rest Route**
The `listPaymentCustomers` API REST controller can be triggered via the following route:
`/v1/paymentcustomers`
**Rest Request Parameters**
**Filter Parameters**
The `listPaymentCustomers` api supports 3 optional filter parameters for filtering list results:
**userId** (`ID`): An ID value to represent the user who is created as a stripe customer
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**customerId** (`String`): A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway
- Single (partial match, case-insensitive): `?customerId=`
- Multiple: `?customerId=&customerId=`
- Null: `?customerId=null`
**platform** (`String`): A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.
- Single (partial match, case-insensitive): `?platform=`
- Multiple: `?platform=&platform=`
- Null: `?platform=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomers**
```js
axios({
method: 'GET',
url: '/v1/paymentcustomers',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// userId: '' // Filter by userId
// customerId: '' // Filter by customerId
// platform: '' // Filter by platform
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentCustomers",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_paymentCustomers": [
{
"id": "ID",
"userId": "ID",
"customerId": "String",
"platform": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Paymentcustomermethods` API
This route is used to list all payment customer methods.
**Rest Route**
The `listPaymentCustomerMethods` API REST controller can be triggered via the following route:
`/v1/paymentcustomermethods/:userId`
**Rest Request Parameters**
The `listPaymentCustomerMethods` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : An ID value to represent the user who owns the payment method. The parameter is used to query data.
**Filter Parameters**
The `listPaymentCustomerMethods` api supports 6 optional filter parameters for filtering list results:
**paymentMethodId** (`String`): A string value to represent the id of the payment method on the payment platform.
- Single (partial match, case-insensitive): `?paymentMethodId=`
- Multiple: `?paymentMethodId=&paymentMethodId=`
- Null: `?paymentMethodId=null`
**customerId** (`String`): A string value to represent the customer id which is generated on the payment gateway.
- Single (partial match, case-insensitive): `?customerId=`
- Multiple: `?customerId=&customerId=`
- Null: `?customerId=null`
**cardHolderName** (`String`): A string value to represent the name of the card holder. It can be different than the registered customer.
- Single (partial match, case-insensitive): `?cardHolderName=`
- Multiple: `?cardHolderName=&cardHolderName=`
- Null: `?cardHolderName=null`
**cardHolderZip** (`String`): A string value to represent the zip code of the card holder. It is used for address verification in specific countries.
- Single (partial match, case-insensitive): `?cardHolderZip=`
- Multiple: `?cardHolderZip=&cardHolderZip=`
- Null: `?cardHolderZip=null`
**platform** (`String`): A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.
- Single (partial match, case-insensitive): `?platform=`
- Multiple: `?platform=&platform=`
- Null: `?platform=null`
**cardInfo** (`Object`): A Json value to store the card details of the payment method.
- Single: `?cardInfo=`
- Multiple: `?cardInfo=&cardInfo=`
- Null: `?cardInfo=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomermethods/:userId**
```js
axios({
method: 'GET',
url: `/v1/paymentcustomermethods/${userId}`,
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// paymentMethodId: '' // Filter by paymentMethodId
// customerId: '' // Filter by customerId
// cardHolderName: '' // Filter by cardHolderName
// cardHolderZip: '' // Filter by cardHolderZip
// platform: '' // Filter by platform
// cardInfo: '' // Filter by cardInfo
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentMethods",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_paymentMethods": [
{
"id": "ID",
"paymentMethodId": "String",
"userId": "ID",
"customerId": "String",
"cardHolderName": "String",
"cardHolderZip": "String",
"platform": "String",
"cardInfo": "Object",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### 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.
```js
// 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 (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"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.
```json
{
"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`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, 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
## aifitapp-subscription-service
**Version:** `1.0.24`
Manages the single premium subscription plan lifecycle including activation, status tracking, cancellation, and admin-configurable pricing. Provides subscription status validation endpoints for other services to gate access to AI-powered featuresa.z
## 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 Subscription Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our Subscription Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the Subscription Service via HTTP requests for purposes such as creating, updating, deleting and querying Subscription 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 Subscription 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 Subscription 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 | appaili-access-token|
| Cookie | appaili-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 Subscription 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 Subscription 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:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://appaili.prw.mindbricks.com/subscription-api`
* **Staging:** `https://appaili-stage.mindbricks.co/subscription-api`
* **Production:** `https://appaili.mindbricks.co/subscription-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 Subscription 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 `Subscription` 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, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. 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 to `false`, 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 list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows 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 `Subscription` 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.
```js
{
"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 `Subscription` 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:
```json
{
"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
Subscription 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.
### PricingConfig resource
*Resource Definition* : Stores the current premium subscription pricing configuration. Admin-managed, single system-wide record.
*PricingConfig Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **currency** | String | | | *Currency code for pricing (e.g., usd).* |
| **description** | Text | | | *Human-readable description of the subscription plan.* |
| **price** | Integer | | | *Current subscription price in cents (e.g., 999 = $9.99).* |
| **type** | Enum | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### type Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **subscription** | `"subscription""` | 0 |
| **quota** | `"quota""` | 1 |
### Subscription resource
*Resource Definition* : Represents a user's premium subscription record, serving as the Stripe payment object. Tracks payment status, price paid, and subscription lifecycle dates.
*Subscription Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **activatedAt** | Date | | | *Timestamp when the subscription was activated after successful payment.* |
| **cancelledAt** | Date | | | *Timestamp when the subscription was cancelled by the user.* |
| **currency** | String | | | *Currency code for the payment (e.g., usd).* |
| **pricePaid** | Integer | | | *Amount paid in cents at the time of subscription activation.* |
| **status** | Enum | | | *Current subscription status managed by Stripe payment flow.* |
| **statusUpdatedAt** | Date | | | *Timestamp of the last status update, auto-managed by Stripe payment flow.* |
| **userId** | ID | | | *Reference to the user who owns this subscription.* |
| **paymentConfirmation** | Enum | | | *An automatic property that is used to check the confirmed status of the payment set by webhooks.* |
#### 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* : Current subscription status managed by Stripe payment flow.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **active** | `"active""` | 1 |
| **cancelled** | `"cancelled""` | 2 |
| **expired** | `"expired""` | 3 |
| **failed** | `"failed""` | 4 |
##### paymentConfirmation Enum Property
*Property Definition* : An automatic property that is used to check the confirmed status of the payment set by webhooks.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **processing** | `"processing""` | 1 |
| **paid** | `"paid""` | 2 |
| **canceled** | `"canceled""` | 3 |
### Sys_subscriptionPayment resource
*Resource Definition* : A payment storage object to store the payment life cyle of orders based on subscription object. It is autocreated based on the source object's checkout config
*Sys_subscriptionPayment Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **ownerId** | ID | | | * An ID value to represent owner user who created the order* |
| **orderId** | ID | | | *an ID value to represent the orderId which is the ID parameter of the source subscription object* |
| **paymentId** | String | | | *A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type* |
| **paymentStatus** | String | | | *A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.* |
| **statusLiteral** | String | | | *A string value to represent the logical payment status which belongs to the application lifecycle itself.* |
| **redirectUrl** | String | | | *A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.* |
### Sys_paymentCustomer resource
*Resource Definition* : A payment storage object to store the customer values of the payment platform
*Sys_paymentCustomer Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **userId** | ID | | | * An ID value to represent the user who is created as a stripe customer* |
| **customerId** | String | | | *A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway* |
| **platform** | String | | | *A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.* |
### Sys_paymentMethod resource
*Resource Definition* : A payment storage object to store the payment methods of the platform customers
*Sys_paymentMethod Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **paymentMethodId** | String | | | *A string value to represent the id of the payment method on the payment platform.* |
| **userId** | ID | | | * An ID value to represent the user who owns the payment method* |
| **customerId** | String | | | *A string value to represent the customer id which is generated on the payment gateway.* |
| **cardHolderName** | String | | | *A string value to represent the name of the card holder. It can be different than the registered customer.* |
| **cardHolderZip** | String | | | *A string value to represent the zip code of the card holder. It is used for address verification in specific countries.* |
| **platform** | String | | | *A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.* |
| **cardInfo** | Object | | | *A Json value to store the card details of the payment method.* |
## Business Api
### `Cancel Subscription` API
Cancel the authenticated user's active subscription. Sets the subscription status to cancelled and records the cancellation timestamp.
**API Frontend Description By The Backend Architect**
Call this endpoint when the user confirms they want to cancel their subscription. After successful cancellation, inform the user that they will lose access to AI features. The response contains the updated subscription record with status 'cancelled'.
**Rest Route**
The `cancelSubscription` API REST controller can be triggered via the following route:
`/v1/subscriptions/:subscriptionId/cancel`
**Rest Request Parameters**
The `cancelSubscription` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId | ID | true | request.params?.["subscriptionId"] |
**subscriptionId** : This id paremeter is used to select the required data object that will be updated
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/subscriptions/:subscriptionId/cancel**
```js
axios({
method: 'POST',
url: `/v1/subscriptions/${subscriptionId}/cancel`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "POST",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Check Subscriptionstatus` API
Machine-to-machine endpoint for other services to validate if a user has an active subscription. Returns the active subscription record if one exists, or an empty list if not.
**Rest Route**
The `checkSubscriptionStatus` API REST controller can be triggered via the following route:
`/v1/check-status`
**Rest Request Parameters**
The `checkSubscriptionStatus` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.body?.["userId"] |
**userId** : The user ID to check subscription status for.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/check-status**
```js
axios({
method: 'POST',
url: '/v1/check-status',
data: {
userId:"ID",
},
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.
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscriptions",
"method": "POST",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"subscriptions": [
{
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Pricingconfig` API
**[Default create API]** — This is the designated default `create` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a new pricing configuration record. Admin-only operation for setting up subscription pricing.
**Rest Route**
The `createPricingConfig` API REST controller can be triggered via the following route:
`/v1/pricingconfigs`
**Rest Request Parameters**
The `createPricingConfig` api has got 4 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| currency | String | true | request.body?.["currency"] |
| description | Text | false | request.body?.["description"] |
| price | Integer | true | request.body?.["price"] |
| type | Enum | true | request.body?.["type"] |
**currency** : Currency code for pricing (e.g., usd).
**description** : Human-readable description of the subscription plan.
**price** : Current subscription price in cents (e.g., 999 = $9.99).
**type** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/pricingconfigs**
```js
axios({
method: 'POST',
url: '/v1/pricingconfigs',
data: {
currency:"String",
description:"Text",
price:"Integer",
type:"Enum",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "pricingConfig",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"pricingConfig": {
"id": "ID",
"currency": "String",
"description": "Text",
"price": "Integer",
"type": "Enum",
"type_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Pricingconfig` API
**[Default delete API]** — This is the designated default `delete` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Delete a pricing configuration record. Admin-only operation.
**Rest Route**
The `deletePricingConfig` API REST controller can be triggered via the following route:
`/v1/pricingconfigs/:pricingConfigId`
**Rest Request Parameters**
The `deletePricingConfig` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| pricingConfigId | ID | true | request.params?.["pricingConfigId"] |
**pricingConfigId** : 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/pricingconfigs/:pricingConfigId**
```js
axios({
method: 'DELETE',
url: `/v1/pricingconfigs/${pricingConfigId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "pricingConfig",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"pricingConfig": {
"id": "ID",
"currency": "String",
"description": "Text",
"price": "Integer",
"type": "Enum",
"type_idx": "Integer",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Mysubscription` API
Retrieve the currently authenticated user's active subscription. Returns the active subscription if one exists.
**API Frontend Description By The Backend Architect**
Use this endpoint to check if the current user has an active subscription before allowing access to AI features. If a 404 is returned, the user does not have an active subscription and should be prompted to subscribe.
**Rest Route**
The `getMySubscription` API REST controller can be triggered via the following route:
`/v1/my-subscription`
**Rest Request Parameters**
The `getMySubscription` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/my-subscription**
```js
axios({
method: 'GET',
url: '/v1/my-subscription',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Pricingconfig` API
**[Default get API]** — This is the designated default `get` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Retrieve a pricing configuration record. Accessible to all authenticated users to view current subscription pricing.
**API Frontend Description By The Backend Architect**
Use this endpoint to display the current subscription price to users before they initiate payment.
**Rest Route**
The `getPricingConfig` API REST controller can be triggered via the following route:
`/v1/pricingconfigs/:pricingConfigId`
**Rest Request Parameters**
The `getPricingConfig` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| pricingConfigId | ID | true | request.params?.["pricingConfigId"] |
**pricingConfigId** : 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/pricingconfigs/:pricingConfigId**
```js
axios({
method: 'GET',
url: `/v1/pricingconfigs/${pricingConfigId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "pricingConfig",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"pricingConfig": {
"id": "ID",
"currency": "String",
"description": "Text",
"price": "Integer",
"type": "Enum",
"type_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Subscription` API
**[Default get API]** — This is the designated default `get` API for the `subscription` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Retrieve a subscription record by its ID. Owners can view their own subscriptions; admins can view any.
**Rest Route**
The `getSubscription` API REST controller can be triggered via the following route:
`/v1/subscriptions/:subscriptionId`
**Rest Request Parameters**
The `getSubscription` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId | ID | true | request.params?.["subscriptionId"] |
**subscriptionId** : 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/subscriptions/:subscriptionId**
```js
axios({
method: 'GET',
url: `/v1/subscriptions/${subscriptionId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Pricingconfigs` API
**[Default list API]** — This is the designated default `list` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all pricing configuration records. Accessible to authenticated users.
**Rest Route**
The `listPricingConfigs` API REST controller can be triggered via the following route:
`/v1/pricingconfigs`
**Rest Request Parameters**
The `listPricingConfigs` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/pricingconfigs**
```js
axios({
method: 'GET',
url: '/v1/pricingconfigs',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "pricingConfigs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"pricingConfigs": [
{
"id": "ID",
"currency": "String",
"description": "Text",
"price": "Integer",
"type": "Enum",
"type_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Subscriptions` API
**[Default list API]** — This is the designated default `list` API for the `subscription` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all subscriptions. Admin-only endpoint for monitoring subscription records.
**Rest Route**
The `listSubscriptions` API REST controller can be triggered via the following route:
`/v1/subscriptions`
**Rest Request Parameters**
**Filter Parameters**
The `listSubscriptions` api supports 3 optional filter parameters for filtering list results:
**status** (`Enum`): Current subscription status managed by Stripe payment flow.
- Single: `?status=` (case-insensitive)
- Multiple: `?status=&status=`
- Null: `?status=null`
**userId** (`ID`): Reference to the user who owns this subscription.
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.
- Single: `?paymentConfirmation=` (case-insensitive)
- Multiple: `?paymentConfirmation=&paymentConfirmation=`
- Null: `?paymentConfirmation=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/subscriptions**
```js
axios({
method: 'GET',
url: '/v1/subscriptions',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// status: '' // Filter by status
// userId: '' // Filter by userId
// paymentConfirmation: '' // Filter by paymentConfirmation
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscriptions",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"subscriptions": [
{
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Pricingconfig` API
**[Default update API]** — This is the designated default `update` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update the subscription pricing configuration. Admin-only operation for adjusting price, currency, or description without code deployment.
**Rest Route**
The `updatePricingConfig` API REST controller can be triggered via the following route:
`/v1/pricingconfigs/:pricingConfigId`
**Rest Request Parameters**
The `updatePricingConfig` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| pricingConfigId | ID | true | request.params?.["pricingConfigId"] |
| currency | String | false | request.body?.["currency"] |
| description | Text | false | request.body?.["description"] |
| price | Integer | false | request.body?.["price"] |
| type | Enum | false | request.body?.["type"] |
**pricingConfigId** : This id paremeter is used to select the required data object that will be updated
**currency** : Currency code for pricing (e.g., usd).
**description** : Human-readable description of the subscription plan.
**price** : Current subscription price in cents (e.g., 999 = $9.99).
**type** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/pricingconfigs/:pricingConfigId**
```js
axios({
method: 'PATCH',
url: `/v1/pricingconfigs/${pricingConfigId}`,
data: {
currency:"String",
description:"Text",
price:"Integer",
type:"Enum",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "pricingConfig",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"pricingConfig": {
"id": "ID",
"currency": "String",
"description": "Text",
"price": "Integer",
"type": "Enum",
"type_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Subscription` API
**Rest Route**
The `createSubscription` API REST controller can be triggered via the following route:
`/v1/subscriptions`
**Rest Request Parameters**
The `createSubscription` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| activatedAt | Date | false | request.body?.["activatedAt"] |
| cancelledAt | Date | false | request.body?.["cancelledAt"] |
| currency | String | true | request.body?.["currency"] |
| pricePaid | Integer | true | request.body?.["pricePaid"] |
| statusUpdatedAt | Date | false | request.body?.["statusUpdatedAt"] |
**activatedAt** : Timestamp when the subscription was activated after successful payment.
**cancelledAt** : Timestamp when the subscription was cancelled by the user.
**currency** : Currency code for the payment (e.g., usd).
**pricePaid** : Amount paid in cents at the time of subscription activation.
**statusUpdatedAt** : Timestamp of the last status update, auto-managed by Stripe payment flow.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/subscriptions**
```js
axios({
method: 'POST',
url: '/v1/subscriptions',
data: {
activatedAt:"Date",
cancelledAt:"Date",
currency:"String",
pricePaid:"Integer",
statusUpdatedAt:"Date",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Do Test` API
**Rest Route**
The `test` API REST controller can be triggered via the following route:
`/v1/test`
**Rest Request Parameters**
The `test` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/test**
```js
axios({
method: 'GET',
url: '/v1/test',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "pricingConfigs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"pricingConfigs": [
{
"id": "ID",
"currency": "String",
"description": "Text",
"price": "Integer",
"type": "Enum",
"type_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Subscriptionpayment` API
This route is used to get the payment information by ID.
**Rest Route**
The `getSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/subscriptionpayment/:sys_subscriptionPaymentId`
**Rest Request Parameters**
The `getSubscriptionPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_subscriptionPaymentId | ID | true | request.params?.["sys_subscriptionPaymentId"] |
**sys_subscriptionPaymentId** : 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/subscriptionpayment/:sys_subscriptionPaymentId**
```js
axios({
method: 'GET',
url: `/v1/subscriptionpayment/${sys_subscriptionPaymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_subscriptionPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Subscriptionpayments` API
This route is used to list all payments.
**Rest Route**
The `listSubscriptionPayments` API REST controller can be triggered via the following route:
`/v1/subscriptionpayments`
**Rest Request Parameters**
**Filter Parameters**
The `listSubscriptionPayments` api supports 6 optional filter parameters for filtering list results:
**ownerId** (`ID`): An ID value to represent owner user who created the order
- Single: `?ownerId=`
- Multiple: `?ownerId=&ownerId=`
- Null: `?ownerId=null`
**orderId** (`ID`): an ID value to represent the orderId which is the ID parameter of the source subscription object
- Single: `?orderId=`
- Multiple: `?orderId=&orderId=`
- Null: `?orderId=null`
**paymentId** (`String`): A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
- Single (partial match, case-insensitive): `?paymentId=`
- Multiple: `?paymentId=&paymentId=`
- Null: `?paymentId=null`
**paymentStatus** (`String`): A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
- Single (partial match, case-insensitive): `?paymentStatus=`
- Multiple: `?paymentStatus=&paymentStatus=`
- Null: `?paymentStatus=null`
**statusLiteral** (`String`): A string value to represent the logical payment status which belongs to the application lifecycle itself.
- Single (partial match, case-insensitive): `?statusLiteral=`
- Multiple: `?statusLiteral=&statusLiteral=`
- Null: `?statusLiteral=null`
**redirectUrl** (`String`): A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
- Single (partial match, case-insensitive): `?redirectUrl=`
- Multiple: `?redirectUrl=&redirectUrl=`
- Null: `?redirectUrl=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/subscriptionpayments**
```js
axios({
method: 'GET',
url: '/v1/subscriptionpayments',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// ownerId: '' // Filter by ownerId
// orderId: '' // Filter by orderId
// paymentId: '' // Filter by paymentId
// paymentStatus: '' // Filter by paymentStatus
// statusLiteral: '' // Filter by statusLiteral
// redirectUrl: '' // Filter by redirectUrl
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayments",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_subscriptionPayments": [
{
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Subscriptionpayment` API
This route is used to create a new payment.
**Rest Route**
The `createSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/subscriptionpayment`
**Rest Request Parameters**
The `createSubscriptionPayment` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId | ID | true | request.body?.["orderId"] |
| paymentId | String | true | request.body?.["paymentId"] |
| paymentStatus | String | true | request.body?.["paymentStatus"] |
| statusLiteral | String | true | request.body?.["statusLiteral"] |
| redirectUrl | String | false | request.body?.["redirectUrl"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source subscription object
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/subscriptionpayment**
```js
axios({
method: 'POST',
url: '/v1/subscriptionpayment',
data: {
orderId:"ID",
paymentId:"String",
paymentStatus:"String",
statusLiteral:"String",
redirectUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayment",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"sys_subscriptionPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Subscriptionpayment` API
This route is used to update an existing payment.
**Rest Route**
The `updateSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/subscriptionpayment/:sys_subscriptionPaymentId`
**Rest Request Parameters**
The `updateSubscriptionPayment` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_subscriptionPaymentId | ID | true | request.params?.["sys_subscriptionPaymentId"] |
| paymentId | String | false | request.body?.["paymentId"] |
| paymentStatus | String | false | request.body?.["paymentStatus"] |
| statusLiteral | String | false | request.body?.["statusLiteral"] |
| redirectUrl | String | false | request.body?.["redirectUrl"] |
**sys_subscriptionPaymentId** : This id paremeter is used to select the required data object that will be updated
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/subscriptionpayment/:sys_subscriptionPaymentId**
```js
axios({
method: 'PATCH',
url: `/v1/subscriptionpayment/${sys_subscriptionPaymentId}`,
data: {
paymentId:"String",
paymentStatus:"String",
statusLiteral:"String",
redirectUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayment",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"sys_subscriptionPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Subscriptionpayment` API
This route is used to delete a payment.
**Rest Route**
The `deleteSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/subscriptionpayment/:sys_subscriptionPaymentId`
**Rest Request Parameters**
The `deleteSubscriptionPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_subscriptionPaymentId | ID | true | request.params?.["sys_subscriptionPaymentId"] |
**sys_subscriptionPaymentId** : 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/subscriptionpayment/:sys_subscriptionPaymentId**
```js
axios({
method: 'DELETE',
url: `/v1/subscriptionpayment/${sys_subscriptionPaymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayment",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"sys_subscriptionPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Subscriptionpaymentbyorderid` API
This route is used to get the payment information by order id.
**Rest Route**
The `getSubscriptionPaymentByOrderId` API REST controller can be triggered via the following route:
`/v1/subscriptionpaymentbyorderid/:orderId`
**Rest Request Parameters**
The `getSubscriptionPaymentByOrderId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId | ID | true | request.params?.["orderId"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source subscription object. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/subscriptionpaymentbyorderid/:orderId**
```js
axios({
method: 'GET',
url: `/v1/subscriptionpaymentbyorderid/${orderId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_subscriptionPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Subscriptionpaymentbypaymentid` API
This route is used to get the payment information by payment id.
**Rest Route**
The `getSubscriptionPaymentByPaymentId` API REST controller can be triggered via the following route:
`/v1/subscriptionpaymentbypaymentid/:paymentId`
**Rest Request Parameters**
The `getSubscriptionPaymentByPaymentId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| paymentId | String | true | request.params?.["paymentId"] |
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/subscriptionpaymentbypaymentid/:paymentId**
```js
axios({
method: 'GET',
url: `/v1/subscriptionpaymentbypaymentid/${paymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_subscriptionPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_subscriptionPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Start Subscriptionpayment` API
Start payment for subscription
**Rest Route**
The `startSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/startsubscriptionpayment/:subscriptionId`
**Rest Request Parameters**
The `startSubscriptionPayment` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId | ID | true | request.params?.["subscriptionId"] |
| paymentUserParams | Object | true | request.body?.["paymentUserParams"] |
**subscriptionId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to start a stripe payment process. Must include paymentMethodId.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/startsubscriptionpayment/:subscriptionId**
```js
axios({
method: 'PATCH',
url: `/v1/startsubscriptionpayment/${subscriptionId}`,
data: {
paymentUserParams:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Refresh Subscriptionpayment` API
Refresh payment info for subscription from Stripe
**Rest Route**
The `refreshSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/refreshsubscriptionpayment/:subscriptionId`
**Rest Request Parameters**
The `refreshSubscriptionPayment` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId | ID | true | request.params?.["subscriptionId"] |
| paymentUserParams | Object | false | request.body?.["paymentUserParams"] |
**subscriptionId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to refresh a stripe payment process
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/refreshsubscriptionpayment/:subscriptionId**
```js
axios({
method: 'PATCH',
url: `/v1/refreshsubscriptionpayment/${subscriptionId}`,
data: {
paymentUserParams:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Callback Subscriptionpayment` API
Refresh payment values by gateway webhook call for subscription
**Rest Route**
The `callbackSubscriptionPayment` API REST controller can be triggered via the following route:
`/v1/callbacksubscriptionpayment`
**Rest Request Parameters**
The `callbackSubscriptionPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId | ID | false | request.body?.["subscriptionId"] |
**subscriptionId** : The order id parameter that will be read from webhook callback params
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/callbacksubscriptionpayment**
```js
axios({
method: 'POST',
url: '/v1/callbacksubscriptionpayment',
data: {
subscriptionId:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "subscription",
"method": "POST",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"subscription": {
"id": "ID",
"activatedAt": "Date",
"cancelledAt": "Date",
"currency": "String",
"pricePaid": "Integer",
"status": "Enum",
"status_idx": "Integer",
"statusUpdatedAt": "Date",
"userId": "ID",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Get Paymentcustomerbyuserid` API
This route is used to get the payment customer information by user id.
**Rest Route**
The `getPaymentCustomerByUserId` API REST controller can be triggered via the following route:
`/v1/paymentcustomers/:userId`
**Rest Request Parameters**
The `getPaymentCustomerByUserId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : An ID value to represent the user who is created as a stripe customer. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomers/:userId**
```js
axios({
method: 'GET',
url: `/v1/paymentcustomers/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentCustomer",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_paymentCustomer": {
"id": "ID",
"userId": "ID",
"customerId": "String",
"platform": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Paymentcustomers` API
This route is used to list all payment customers.
**Rest Route**
The `listPaymentCustomers` API REST controller can be triggered via the following route:
`/v1/paymentcustomers`
**Rest Request Parameters**
**Filter Parameters**
The `listPaymentCustomers` api supports 3 optional filter parameters for filtering list results:
**userId** (`ID`): An ID value to represent the user who is created as a stripe customer
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**customerId** (`String`): A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway
- Single (partial match, case-insensitive): `?customerId=`
- Multiple: `?customerId=&customerId=`
- Null: `?customerId=null`
**platform** (`String`): A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.
- Single (partial match, case-insensitive): `?platform=`
- Multiple: `?platform=&platform=`
- Null: `?platform=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomers**
```js
axios({
method: 'GET',
url: '/v1/paymentcustomers',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// userId: '' // Filter by userId
// customerId: '' // Filter by customerId
// platform: '' // Filter by platform
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentCustomers",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_paymentCustomers": [
{
"id": "ID",
"userId": "ID",
"customerId": "String",
"platform": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Paymentcustomermethods` API
This route is used to list all payment customer methods.
**Rest Route**
The `listPaymentCustomerMethods` API REST controller can be triggered via the following route:
`/v1/paymentcustomermethods/:userId`
**Rest Request Parameters**
The `listPaymentCustomerMethods` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : An ID value to represent the user who owns the payment method. The parameter is used to query data.
**Filter Parameters**
The `listPaymentCustomerMethods` api supports 6 optional filter parameters for filtering list results:
**paymentMethodId** (`String`): A string value to represent the id of the payment method on the payment platform.
- Single (partial match, case-insensitive): `?paymentMethodId=`
- Multiple: `?paymentMethodId=&paymentMethodId=`
- Null: `?paymentMethodId=null`
**customerId** (`String`): A string value to represent the customer id which is generated on the payment gateway.
- Single (partial match, case-insensitive): `?customerId=`
- Multiple: `?customerId=&customerId=`
- Null: `?customerId=null`
**cardHolderName** (`String`): A string value to represent the name of the card holder. It can be different than the registered customer.
- Single (partial match, case-insensitive): `?cardHolderName=`
- Multiple: `?cardHolderName=&cardHolderName=`
- Null: `?cardHolderName=null`
**cardHolderZip** (`String`): A string value to represent the zip code of the card holder. It is used for address verification in specific countries.
- Single (partial match, case-insensitive): `?cardHolderZip=`
- Multiple: `?cardHolderZip=&cardHolderZip=`
- Null: `?cardHolderZip=null`
**platform** (`String`): A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.
- Single (partial match, case-insensitive): `?platform=`
- Multiple: `?platform=&platform=`
- Null: `?platform=null`
**cardInfo** (`Object`): A Json value to store the card details of the payment method.
- Single: `?cardInfo=`
- Multiple: `?cardInfo=&cardInfo=`
- Null: `?cardInfo=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomermethods/:userId**
```js
axios({
method: 'GET',
url: `/v1/paymentcustomermethods/${userId}`,
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// paymentMethodId: '' // Filter by paymentMethodId
// customerId: '' // Filter by customerId
// cardHolderName: '' // Filter by cardHolderName
// cardHolderZip: '' // Filter by cardHolderZip
// platform: '' // Filter by platform
// cardInfo: '' // Filter by cardInfo
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentMethods",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_paymentMethods": [
{
"id": "ID",
"paymentMethodId": "String",
"userId": "ID",
"customerId": "String",
"cardHolderName": "String",
"cardHolderZip": "String",
"platform": "String",
"cardInfo": "Object",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### 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.
```js
// 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 (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"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.
```json
{
"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`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, 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
## aifitapp-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 | appaili-access-token|
| Cookie | appaili-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:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://appaili.prw.mindbricks.com/agenthub-api`
* **Staging:** `https://appaili-stage.mindbricks.co/agenthub-api`
* **Production:** `https://appaili.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, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. 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 to `false`, 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 list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows 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.
```js
{
"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:
```json
{
"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**
```js
axios({
method: 'GET',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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**
```js
axios({
method: 'GET',
url: '/v1/agentoverrides',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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**
```js
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**
```json
{
"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**
```js
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**
```json
{
"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**
```js
axios({
method: 'DELETE',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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=`
- Multiple: `?serviceName=&serviceName=`
- Null: `?serviceName=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/toolcatalog**
```js
axios({
method: 'GET',
url: '/v1/toolcatalog',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// serviceName: '' // Filter by serviceName
}
});
```
**REST Response**
```json
{
"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**
```js
axios({
method: 'GET',
url: `/v1/toolcatalogentry/${sys_toolCatalogId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"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=`
- Multiple: `?agentName=&agentName=`
- Null: `?agentName=null`
**agentType** (`Enum`): Whether this was a design-time or dynamic agent.
- Single: `?agentType=` (case-insensitive)
- Multiple: `?agentType=&agentType=`
- Null: `?agentType=null`
**source** (`Enum`): How the agent was triggered.
- Single: `?source=` (case-insensitive)
- Multiple: `?source=&source=`
- Null: `?source=null`
**userId** (`ID`): User who triggered the execution.
- Single: `?userId=`
- Multiple: `?userId=