Automated Reasoning
ZBrain’s automated reasoning API empowers users to build intelligent, logic-driven systems by enabling seamless rule extraction, variable management, and dynamic reasoning based on structured knowledge bases. Designed for enterprise-grade AI solutions, this robust API suite simplifies the entire reasoning lifecycle, from importing knowledge bases and extracting logical rules and variables to querying them in real time and managing custom additions. With endpoints tailored for customization, testing, historical tracking, and cost estimation, users gain full control over how their applications interact with rule-based engines and structured datasets.
This documentation offers detailed descriptions of each endpoint, including their functionality, required parameters, request/response structures, and best practices to help you optimize implementation and performance. From dynamic variable extraction to logical inference execution, this API serves as a foundational component for building reliable AI systems rooted in consistent, explainable knowledge.
Base URLs
ZBrain Import Microservice:
https://app.zbrain.ai:3003/api
ZBrain Content Microservice:
https://app.zbrain.ai:3000/api
Authentication
To interact with the Automated Reasoning API, you must authenticate all requests. Each API call requires the inclusion of the proper authentication credentials, typically in the form of an authentication token or API key, which will be included in the request headers or query parameters.
To interact with the Automated Reasoning API, authentication is required for all API endpoints. Requests must include the relevant authentication parameters to ensure secure access.
Endpoints overview
1. Trigger automated reasoning
This endpoint initiates the automated reasoning process by extracting logical rules and variables from an imported knowledge base.
Endpoint:
/automated-reasoning
Method: POST
Service: zbrain-import-microservice
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Request body:
Sample response:
2. Retrieve knowledge base variables
Retrieve the list of variables extracted from a knowledge base. These variables are key to logical inferences and are used in dynamic reasoning processes.
Endpoint:
/kb-variables/:id
Method: GET
Service: zbrain-import-microservice
Required parameters:
Replace
:id
in the URL with the specific knowledge base ID.
Optional query parameters:
sortingKey
: The field by which to sort the results (e.g., variable).sortingOrder
: Order of sorting, either asc (ascending) or desc (descending).
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Sample response:
3. Retrieve knowledge base rules
Fetch the logical rules that were extracted from a knowledge base. These rules are essential for applying logical reasoning and decision-making in AI applications.
Endpoint:
/kb-rules/:id
Method: GET
Service: zbrain-import-microservice
Required parameters:
Replace
:id
in the URL with the specific knowledge base ID.
Optional query parameters:
sortingKey
: The field to sort by (e.g., rule).sortingOrder
: Sorting order, asc (ascending) or desc (descending).
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Sample response:
4. Add custom rules or variables
Add new custom rules or variables to a knowledge base. This helps extend or modify the reasoning process by integrating user-defined logic.
Endpoint:
/add-custom-rules-or-variables
Method: POST
Service: zbrain-import-microservice
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Request body for adding a variable:
Request body for adding a rule:
Sample response:
5. Update or delete rules
Modify or remove existing rules in the knowledge base. This is useful for maintaining the accuracy and relevance.
Endpoint:
/rules
Method: PUT
Service: zbrain-import-microservice
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Request body:
Sample response:
6. Update or delete variables
Update or remove variables within a knowledge base. Changes to variables may be necessary to reflect new insights or data structures.
Endpoint:
/variables
Method: PUT
Service: zbrain-import-microservice
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Request body:
Sample response:
7. Run playground query
Execute reasoning queries directly against the knowledge base using the playground. This is useful for testing or prototyping reasoning queries.
Endpoint:
/playground
Method: POST
Service: zbrain-import-microservice
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Request body
Sample response:
8. Retrieve playground history
Access the history of queries that were executed in the playground. This allows for the review of past interactions and the refinement of queries.
Endpoint:
/playground-history/:knowledgeBaseId
Method: GET
Service: zbrain-content-microservice
Optional query parameters:
skip
: Number of records to skip (for pagination).limit
: Number of records to return.sortingKey
: Field to sort by (e.g., query).sortingOrder
: Order of sorting (asc/desc).
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Sample response:
9. Estimate automated reasoning cost
Calculate the cost of running automated reasoning on a knowledge base, including prompt and completion credits.
Endpoint:
/estimate-automated-reasoning-cost
Method: GET
Service:
zbrain-import-microservice
Required query parameters:
model
: Model to use for reasoning.knowledgeBaseId
: Unique ID for your specific knowledge base.
Request headers:
"Authorization": "Bearer <API Key>"
"Content-Type": "application/json"
Sample response:
Last updated