BaridiBaridi BI API Integration Guide
Overview
The BaridiBaridi BI APIs provide comprehensive business intelligence and customer evaluation services. The API is built using FastAPI and follows OpenAPI 3.1.0 specifications.
Base URL: https://apis.bi.baridibaridi.co.tz
OpenAPI Specification: https://apis.bi.baridibaridi.co.tz/openapi.json
API Services
The API provides two main service categories:
- Customer Evaluation API - Credit evaluation and package recommendations
- Dashboard API - Customer asset tracking and statistics
Customer Evaluation API
The Customer Evaluation API uses a Random Forest Classifier for intelligent credit evaluation and package recommendations based on customer data and AC unit configurations.
Create Enhanced Evaluation
Submit a comprehensive customer evaluation with AC units configuration.
Endpoint: POST /api/evaluation/v1/evaluations
Request Body Parameters
| Parameter | Type | Required | Constraints | Description |
|---|---|---|---|---|
customer_name | string | Yes | min: 1, max: 255 chars | Full name of the customer or business entity |
customer_zoho_id | string | Yes | max: 255 chars | Unique identifier from Zoho CRM system |
phone | string | No | max: 20 chars | Customer contact phone number |
email | string | No | max: 255 chars | Customer email address |
address | string | No | max: 500 chars | Physical address of the customer/business |
business_type | string | Yes | min: 1, max: 100 chars | Type of business (e.g., Restaurant, Hotel, Office) |
business_age | integer/string | Yes | - | Age of the business in years or category string |
is_seasonal_business | boolean | Yes | - | Whether the business operates seasonally |
property_type | string | Yes | enum: Commercial, Corporate | Classification of the property type |
property_size | string | Yes | max: 100 chars | Size description of the property (e.g., Small, Medium, Large) |
ac_units | object | Yes | See AC Units table | Configuration of air conditioning units needed |
package_type | string | Yes | enum: Commercial, Corporate | Service package type for pricing calculation |
estimated_cost | number | Yes | min: 0 | Total estimated cost for the installation/service |
route_data | object | Yes | See Route Data table | Geographic and routing information |
additional_requirements | string | No | - | Any special requirements or notes |
preferred_date | string | No | - | Preferred date for installation/service |
preferred_time | string | No | - | Preferred time slot (e.g., Morning, Afternoon, Evening) |
AC Units Object (ac_units)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
small | integer | Yes | min: 0, max: 200 | Number of small AC units required |
medium | integer | Yes | min: 0, max: 200 | Number of medium AC units required |
large | integer | Yes | min: 0, max: 200 | Number of large AC units required |
Route Data Object (route_data)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
distance | string | Yes | max: 20 chars | Distance from warehouse to customer (e.g., “15.2 km”) |
duration | string | Yes | max: 20 chars | Estimated travel duration (e.g., “25 min”) |
fuel_cost | string | Yes | max: 50 chars | Estimated fuel cost for the trip (e.g., “TZS 12,150”) |
route_type | string | Yes | max: 50 chars | Type of route (e.g., “Real Roads”, “Highways”) |
coordinates | object | Yes | See below | Warehouse and customer location coordinates |
Coordinates Object (route_data.coordinates)
| Field | Type | Required | Description |
|---|---|---|---|
warehouse | object | Yes | Warehouse location with lat and lng fields |
warehouse.lat | number | Yes | Warehouse latitude coordinate |
warehouse.lng | number | Yes | Warehouse longitude coordinate |
customer | object | Yes | Customer location with lat and lng fields |
customer.lat | number | Yes | Customer latitude coordinate |
customer.lng | number | Yes | Customer longitude coordinate |
Request Body Example:
{
"customer_name": "Example Restaurant Ltd",
"customer_zoho_id": "ZCRM_12345",
"phone": "+255712345678",
"email": "contact@example.com",
"address": "123 Main Street, Dar es Salaam",
"business_type": "Restaurant",
"business_age": 5,
"is_seasonal_business": false,
"property_type": "Commercial",
"property_size": "Large",
"ac_units": {
"small": 2,
"medium": 3,
"large": 1
},
"package_type": "Commercial",
"estimated_cost": 15000000,
"route_data": {
"distance": "15.2 km",
"duration": "25 min",
"fuel_cost": "TZS 12,150",
"route_type": "Real Roads",
"coordinates": {
"warehouse": {
"lat": -6.7924,
"lng": 39.2083
},
"customer": {
"lat": -6.8160,
"lng": 39.2803
}
}
},
"additional_requirements": "Installation needed on weekends",
"preferred_date": "2025-12-15",
"preferred_time": "Morning"
}Response:
{
"success": true,
"data": {
"evaluation_id": "eval_12345",
"credit_score": 85,
"recommendation": "Approved",
"risk_level": "Low"
},
"message": "Evaluation completed successfully"
}cURL Example:
curl -X POST "https://apis.bi.baridibaridi.co.tz/api/evaluation/v1/evaluations" \
-H "Content-Type: application/json" \
-d '{
"customer_name": "Example Restaurant Ltd",
"customer_zoho_id": "ZCRM_12345",
"business_type": "Restaurant",
"business_age": 5,
"is_seasonal_business": false,
"property_type": "Commercial",
"property_size": "Large",
"ac_units": {
"small": 2,
"medium": 3,
"large": 1
},
"package_type": "Commercial",
"estimated_cost": 15000000,
"route_data": {
"distance": "15.2 km",
"duration": "25 min",
"fuel_cost": "TZS 12,150",
"route_type": "Real Roads",
"coordinates": {
"warehouse": {"lat": -6.7924, "lng": 39.2083},
"customer": {"lat": -6.8160, "lng": 39.2803}
}
}
}'Get Package Recommendation
Get intelligent package recommendations based on AC unit configuration.
Endpoint: POST /api/evaluation/v1/package-recommendation
Query Parameters
| Parameter | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
ac_units_small | integer | No | 0 | min: 0 | Number of small AC units to calculate for |
ac_units_medium | integer | No | 0 | min: 0 | Number of medium AC units to calculate for |
ac_units_large | integer | No | 0 | min: 0 | Number of large AC units to calculate for |
Response:
{
"package": "Commercial",
"total_units": 6,
"total_cost": 8500000,
"breakdown": {
"small": {
"count": 2,
"cost": 2000000
},
"medium": {
"count": 3,
"cost": 4500000
},
"large": {
"count": 1,
"cost": 2000000
}
}
}cURL Example:
curl -X POST "https://apis.bi.baridibaridi.co.tz/api/evaluation/v1/package-recommendation?ac_units_small=2&ac_units_medium=3&ac_units_large=1" \
-H "Content-Type: application/json"Get Evaluations List
Retrieve a paginated list of all customer evaluations.
Endpoint: GET /api/evaluation/v1/evaluations
Query Parameters
| Parameter | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
page | integer | No | 1 | min: 1 | Page number for pagination |
per_page | integer | No | 20 | min: 1, max: 100 | Number of results to return per page |
customer_name | string | No | - | - | Filter results by customer name |
Response:
{
"page": 1,
"per_page": 20,
"total": 150,
"data": [
{
"id": "eval_12345",
"customer_name": "Example Restaurant Ltd",
"created_at": "2025-11-20T10:30:00Z",
"status": "approved",
"total_cost": 15000000
}
]
}Get Leads
Retrieve a comprehensive paginated list of all customer evaluation leads with advanced filtering.
Endpoint: GET /api/evaluation/v1/
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
page | integer | No | 1 | Page number for pagination |
per_page | integer | No | 25 | Number of records to return per page |
from_date | date | No | 2025-10-01 | Start date for filtering results (format: YYYY-MM-DD) |
to_date | date | No | 2025-10-17 | End date for filtering results (format: YYYY-MM-DD) |
customer_name | array of strings | No | - | Filter by one or more customer names |
business_type | array of strings | No | - | Filter by business type(s) (e.g., Restaurant, Hotel) |
package_type | array of strings | No | - | Filter by package type(s) (Commercial, Corporate) |
status | array of strings | No | - | Filter by evaluation status(es) |
inference_class | array of strings | No | - | Filter by ML model inference classification |
distance_category | array of strings | No | - | Filter by distance category from warehouse |
property_type | array of strings | No | - | Filter by property type(s) (Commercial, Corporate) |
ordered_by | array of strings | No | - | Fields to sort results by |
cURL Example:
curl -X GET "https://apis.bi.baridibaridi.co.tz/api/evaluation/v1/?page=1&per_page=25&from_date=2025-10-01&to_date=2025-11-20&business_type=Restaurant&status=approved"Search Leads
Search for specific customer evaluations by name or Zoho CRM ID.
Endpoint: GET /api/evaluation/v1/search
Query Parameters
| Parameter | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
customer_name | string | No | - | - | Customer name to search for (partial match supported) |
zcrm_id | string | No | - | - | Zoho CRM ID to search for (exact match) |
page | integer | No | 1 | min: 1 | Page number for pagination |
per_page | integer | No | 25 | min: 1 | Number of results to return per page |
cURL Example:
curl -X GET "https://apis.bi.baridibaridi.co.tz/api/evaluation/v1/search?customer_name=Example%20Restaurant&page=1&per_page=25"Get Conversion Rates
Retrieve lead conversion statistics within a specified date range.
Endpoint: GET /api/evaluation/v1/conversionrates
Query Parameters
| Parameter | Type | Required | Default | Format | Description |
|---|---|---|---|---|---|
from_date | date | No | 2025-10-01 | YYYY-MM-DD | Start date for statistics period |
to_date | date | No | 2025-10-17 | YYYY-MM-DD | End date for statistics period |
Response:
{
"Single_AC": {
"Single_AC_Count": 45,
"Multiple_AC_Count": 23,
"Single_Checklist_Admits": 12,
"Single_Non_Checklist_Admits": 33,
"Multiple_Checklist_Admits": 8,
"Multiple_Non_Checklist_Admits": 15,
"SL1_Count": 10,
"SL2_Count": 20,
"SL3_Count": 15,
"ML1_Count": 5,
"ML2_Count": 10,
"ML3_Count": 8
}
}Pricing Management
Get Current Pricing
Retrieve the current pricing configuration for AC units.
Endpoint: GET /api/evaluation/v1/pricing/current
Response:
{
"commercial": {
"small": 1000000,
"medium": 1500000,
"large": 2000000
},
"corporate": {
"small": 1200000,
"medium": 1800000,
"large": 2500000
}
}Update Single Pricing
Update pricing for a specific AC unit size and package type.
Endpoint: PUT /api/evaluation/v1/pricing
Request Body:
{
"package_type": "Commercial",
"unit_size": "medium",
"unit_price": 1600000
}Response:
{
"success": true,
"message": "Pricing updated successfully",
"updated_pricing": {
"commercial": {
"small": 1000000,
"medium": 1600000,
"large": 2000000
},
"corporate": {
"small": 1200000,
"medium": 1800000,
"large": 2500000
}
}
}Bulk Pricing Update
Update multiple pricing configurations in a single request.
Endpoint: PUT /api/evaluation/v1/pricing/bulk
Request Body:
{
"pricing_updates": [
{
"package_type": "Commercial",
"unit_size": "small",
"unit_price": 1100000
},
{
"package_type": "Commercial",
"unit_size": "medium",
"unit_price": 1650000
},
{
"package_type": "Corporate",
"unit_size": "large",
"unit_price": 2700000
}
]
}Note: Maximum of 6 updates allowed per request (2 packages × 3 sizes).
Dashboard API
The Dashboard API provides real-time customer asset tracking and analytics.
Get Customer Asset Count
Retrieve the asset count for a specific customer by their Zoho CRM Serial ID.
Endpoint: GET /api/dashboard/customers/{zserial_id}/assets/count
Path Parameters:
zserial_id(string): The Zoho CRM serial ID of the customer
Response:
{
"customer_id": "ZCRM_12345",
"total_assets": 12
}cURL Example:
curl -X GET "https://apis.bi.baridibaridi.co.tz/api/dashboard/customers/ZCRM_12345/assets/count"Get All Customers Asset Counts
Retrieve asset counts for all active subscription customers.
Endpoint: GET /api/dashboard/customers/assets/counts
Query Parameters:
limit(integer): Maximum number of results to return (default: 100, min: 1, max: 1000)
Response:
{
"customers": [
{
"customer_id": "ZCRM_12345",
"customer_name": "Example Restaurant Ltd",
"total_assets": 12
},
{
"customer_id": "ZCRM_67890",
"customer_name": "Hotel Paradise",
"total_assets": 25
}
]
}cURL Example:
curl -X GET "https://apis.bi.baridibaridi.co.tz/api/dashboard/customers/assets/counts?limit=50"Check Customer Exists
Verify if a customer exists in the system by their Zoho CRM Serial ID.
Endpoint: GET /api/dashboard/customers/{zserial_id}/exists
Path Parameters:
zserial_id(string): The Zoho CRM serial ID of the customer
Response:
{
"exists": true
}cURL Example:
curl -X GET "https://apis.bi.baridibaridi.co.tz/api/dashboard/customers/ZCRM_12345/exists"System Health
Health Check
General health check endpoint for container monitoring.
Endpoint: GET /health
Response:
{
"status": "healthy",
"timestamp": "2025-11-20T10:30:00Z"
}Error Handling
The API uses standard HTTP status codes and returns validation errors in a consistent format:
Validation Error Response (422):
{
"detail": [
{
"loc": ["body", "customer_name"],
"msg": "field required",
"type": "value_error.missing"
}
]
}Common HTTP Status Codes:
200- Success422- Validation Error404- Resource Not Found500- Internal Server Error
Data Validation Rules
AC Units Configuration
- small: 0-200 units
- medium: 0-200 units
- large: 0-200 units
Business Properties
- Property Type:
CommercialorCorporate - Package Type:
CommercialorCorporate - Business Age: Integer or string category
Pagination
- page: Minimum 1
- per_page: Minimum 1, Maximum 100 (evaluation endpoints), Maximum 1000 (dashboard endpoints)
Pricing Updates
- unit_price: Must be greater than 0
- Bulk updates: Maximum 6 updates per request
Best Practices
- Use Enhanced Evaluation Endpoint - For new integrations, use
/api/evaluation/v1/evaluationsinstead of the legacy endpoint - Include Complete Route Data - Provide accurate coordinates for better evaluation accuracy
- Pagination - Always use pagination for list endpoints to improve performance
- Health Checks - Implement regular health checks using
/healthand/api/dashboard/healthendpoints - Error Handling - Implement proper error handling for validation errors (422 status)
- Date Filters - Use
from_dateandto_dateparameters for time-based queries - Bulk Operations - Use bulk pricing updates when updating multiple configurations
Support
For API support and questions, contact the BaridiBaridi BI team or refer to the interactive API documentation at:
OpenAPI Documentation: https://apis.bi.baridibaridi.co.tz/docs