API for iblai
- analytics_financial_invoice_retrieve
ibl-data-manager (4.84.1-ai-plus)
Request
Financial Details Analytics API – paginated cost tables with flexible grouping.
This endpoint returns tabular cost metrics aggregated by the dimension specified via the group_by query parameter. One or more KPI columns can be requested through the comma-separated metrics list while typical filters (date range, provider, platform_key, user, etc.) narrow the dataset. Results are paginated with page / limit.
Required query parameters
- group_by – provider | llm_model | username | mentor | platform
- metrics – csv list of KPI names, e.g. total_cost, sessions
Shared optional filters
- start_date, end_date – ISO yyyy-mm-dd (ignored when all_time=true)
- platform_key – tenant isolation
- mentor_unique_id – filter to one mentor
- username – filter to a learner
- provider / llm_model – filter to LLM provider / model
- all_time – true → lifetime totals
- page (default 1), limit (default 50)
Examples
- Cost by provider for the last week
GET /api/v2/analytics/financial/details?
group_by=provider&
metrics=total_cost&
start_date=2025-01-01&
end_date=2025-01-07&
page=1&limit=10- Lifetime cost per user with extra KPIs
GET /api/v2/analytics/financial/details? group_by=username& metrics=total_cost,sessions& all_time=true&page=1&limit=50 - Cost by LLM model with tenant filter
GET /api/v2/analytics/financial/details?
group_by=llm_model&
metrics=total_cost&
platform_key=web-app&
start_date=2025-01-01&end_date=2025-01-31Response structure
{
"page": 1,
"limit": 10,
"total_pages": 1,
"total_records": 3,
"rows": [
{"provider": "openai", "total_cost": "2.50000"},
{"provider": "anthropic", "total_cost": "1.00000"},
{"provider": "azure", "total_cost": "0.50000"}
],
"metrics": [
{
"name": "total_cost",
"unit": "$",
"description": "Cost for this entity in period"
}
],
"total_cost": "4.00000" // optional grand-total when available
}
``today- Today only7d- Last 7 days30d- Last 30 days90d- Last 90 daysall_time- All timecustom- Custom date range
Dimension to group by
provider- Group by providerllm_model- Group by LLM modelusername- Group by usernamementor- Group by mentorplatform- Group by platformaction- Group by actions
Comma-separated list of metrics (e.g. total_cost,sessions, last_active)
- Mock serverhttps://docs.ibl.ai/_mock/apis/ibl/api/analytics/financial/details/
- https://base.manager.iblai.app/api/analytics/financial/details/
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://docs.ibl.ai/_mock/apis/ibl/api/analytics/financial/details/?date_filter=today&end_date=2019-08-24&group_by=provider&limit=20&llm_model=string&mentor_unique_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&metrics=total_cost&page=1&platform_key=string&provider=string&search=string&start_date=2019-08-24&username=string' \
-H 'Authorization: YOUR_API_KEY_HERE'{ "page": 0, "limit": 0, "total_pages": 0, "total_records": 0, "rows": null, "total_cost": "string", "metrics": [ { … } ] }
Request
Flexible Invoice Report API – Billing summary with username and platform filtering.
This endpoint generates invoice reports with flexible filtering options:
- Platform admins can view their platform's data and filter by username within their platform
- Super admins can view any combination of username/platform or global summaries
Key Features:
- Flexible filtering by username and/or platform_key
- Essential metrics: total cost, sessions, usage period
- Provider breakdown (OpenAI, Anthropic, etc.)
- Top mentors/actions by cost
- Clean, invoice-ready format
Query Parameters:
- username: Filter by specific username (optional)
- platform_key: Filter by platform (optional, but required for platform admins)
- start_date, end_date: billing period (defaults to last 30 days)
- include_breakdown: show provider/mentor details (default: true)
Permission Logic:
- Platform admins: Must include platform_key matching their permission scope
- Super admins: Can use any combination of filters or none (global summary)
Examples:
# Platform admin viewing their platform
GET /api/analytics/financial/invoice?platform_key=web-app
# Platform admin viewing specific user in their platform
GET /api/analytics/financial/invoice?platform_key=web-app&username=john.doe
# Super admin viewing specific user across all platforms
GET /api/analytics/financial/invoice?username=john.doe
# Super admin viewing global summary
GET /api/analytics/financial/invoiceResponse Structure:
{
"entity": {
"type": "user|platform|global",
"username": "john.doe",
"platform_key": "web-app",
"platform_name": "Web Application",
"display_name": "John Doe on Web Application"
},
"billing_period": {
"start_date": "2025-01-01",
"end_date": "2025-01-31",
"days": 31
},
"summary": {
"total_cost": 245.750,
"total_sessions": 1250,
"active_users": 85,
"cost_per_session": 0.196
},
"breakdown": {
"by_provider": [...],
"by_mentor": [...],
"by_action": [...]
}
}- Mock serverhttps://docs.ibl.ai/_mock/apis/ibl/api/analytics/financial/invoice/
- https://base.manager.iblai.app/api/analytics/financial/invoice/
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://docs.ibl.ai/_mock/apis/ibl/api/analytics/financial/invoice/?end_date=2019-08-24&include_breakdown=true&platform_key=string&start_date=2019-08-24&username=string' \
-H 'Authorization: YOUR_API_KEY_HERE'{ "entity": { "type": "platform", "platform_key": "web-app", "platform_name": "Web Application", "display_name": "Web Application" }, "billing_period": { "start_date": "2025-01-01", "end_date": "2025-01-31", "days": 31 }, "summary": { "total_cost": "245.750", "total_sessions": 1250, "active_users": 85, "cost_per_session": "0.196" }, "breakdown": { "by_provider": [ … ], "by_mentor": [ … ] } }
Request
Unified API endpoint for learner analytics.
This endpoint provides either:
- Cross-platform summary (when only username is provided)
- Platform-specific detailed data (when username + platform_key are provided)
Query params:
- username (required): Username of the learner
- platform_key (optional): Platform key for platform-specific data
- page (optional): Page number (default: 1)
- limit (optional): Records per page (default: 20, max: 100)
Returns:
- If platform_key provided: Detailed platform metrics
- If no platform_key: Cross-platform summary with pagination
today- Today only7d- Last 7 days30d- Last 30 days90d- Last 90 daysall_time- All timecustom- Custom date range
day- dayhour- hourweek- weekmonth- month
Optional platform key - if provided, returns platform-specific detailed data
- Mock serverhttps://docs.ibl.ai/_mock/apis/ibl/api/analytics/learners/
- https://base.manager.iblai.app/api/analytics/learners/
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://docs.ibl.ai/_mock/apis/ibl/api/analytics/learners/?date_filter=today&end_date=2019-08-24&granularity=day&limit=20&mentor_unique_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&overtime=false&page=1&platform_key=string&start_date=2019-08-24&username=string' \
-H 'Authorization: YOUR_API_KEY_HERE'{ "user": { "user_id": 0, "username": "string", "email": "user@example.com", "name": "string", "is_active": true, "last_active": "2019-08-24T14:15:22Z", "date_joined": "2019-08-24T14:15:22Z" }, "summary": { "total_time_spent_seconds": 0 }, "results": [ { … } ], "pagination": { "totalItems": 0, "currentPage": 0, "perPage": 0, "totalPages": 0 }, "overtime": [ { … } ], "generated_at": "2019-08-24T14:15:22Z" }