API reference
Analytics
Usage, activity and token consumption metrics.
Activity summary
api.niucore.com/api/v1/analytics /summaryScope: analytics:read
Interactions, users and average per day within the range. Without a range, the last seven days.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
Credentials limited to libraries
If the credential is restricted to specific libraries, library_id is required and must be in its list. Without it the answer would be the company total, which includes what the credential cannot see: the API asks for it instead of silently narrowing.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
library_idintegerNarrows the metric to one library. Required if the credential is limited to specific libraries.
Returns
daystringDate, YYYY-MM-DD.
total_interactionsintegerTurns that day.
total_usersintegerUsers who conversed.
averagenumberInteractions per user.
Errors
- 403
api_v1_resource_not_allowedlibrary_idis missing on a narrowed credential, or the one sent is outside its list.data.required_query_paramsays so.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/summary?start_date=2026-08-01&end_date=2026-08-31' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"day": "2026-08-01",
"total_interactions": 184,
"total_users": 21,
"average": 8.76
},
{
"day": "2026-08-02",
"total_interactions": 96,
"total_users": 12,
"average": 8
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}User activity
api.niucore.com/api/v1/analytics /users-activityScope: analytics:read
For each day in the range: how many users existed, how many conversed and how many did not.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
Credentials limited to libraries
If the credential is restricted to specific libraries, library_id is required and must be in its list. Without it the answer would be the company total, which includes what the credential cannot see: the API asks for it instead of silently narrowing.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
library_idintegerNarrows the metric to one library. Required if the credential is limited to specific libraries.
Returns
daystringDate, YYYY-MM-DD.
total_usersintegerUsers accumulated up to that day.
active_usersintegerConversed.
inactive_usersintegerDid not converse.
total_interactionsintegerTurns that day.
averagenumberTurns per active user.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/users-activity?start_date=2026-08-01&end_date=2026-08-31' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"day": "2026-08-01",
"total_users": 37,
"active_users": 21,
"inactive_users": 16,
"total_interactions": 184,
"average": 8.76
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Interactions per weekday
api.niucore.com/api/v1/analytics /interactions-by-weekdayScope: analytics:read
Turns per day of the range, with the weekday name.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
Credentials limited to libraries
If the credential is restricted to specific libraries, library_id is required and must be in its list. Without it the answer would be the company total, which includes what the credential cannot see: the API asks for it instead of silently narrowing.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
library_idintegerNarrows the metric to one library. Required if the credential is limited to specific libraries.
Returns
daystringWeekday name.
datestringDate, YYYY-MM-DD.
totalintegerTurns that day.
total_usersintegerDistinct users who interacted that day.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/interactions-by-weekday' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"day": "Lunes",
"date": "2026-08-03",
"total": 92,
"total_users": 14
},
{
"day": "Martes",
"date": "2026-08-04",
"total": 87,
"total_users": 12
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Top questions
api.niucore.com/api/v1/analytics /top-questionsScope: analytics:read
The most queried topics of the period, grouped by topic.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
Credentials limited to libraries
If the credential is restricted to specific libraries, library_id is required and must be in its list. Without it the answer would be the company total, which includes what the credential cannot see: the API asks for it instead of silently narrowing.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
library_idintegerNarrows the metric to one library. Required if the credential is limited to specific libraries.
Returns
topicstringThe topic.
labelsstring[]The range's dates, YYYY-MM-DD, one per day.
datanumber[]Queries on that topic per day, aligned with labels.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/top-questions?start_date=2026-09-01&end_date=2026-09-03' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"topic": "Devoluciones",
"labels": [
"2026-09-01",
"2026-09-02",
"2026-09-03"
],
"data": [
12,
9,
17
]
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Interactions per library
api.niucore.com/api/v1/analytics /interactions-by-libraryScope: analytics:read
How much each library was queried.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
Credentials limited to libraries
If the credential is restricted to specific libraries, library_id is required and must be in its list. Without it the answer would be the company total, which includes what the credential cannot see: the API asks for it instead of silently narrowing.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
library_idintegerNarrows the metric to one library. Required if the credential is limited to specific libraries.
Returns
workspacestringLibrary name.
totalintegerInteractions.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/interactions-by-library' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"workspace": "Procedimientos de soporte",
"total": 1204
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Files per library
api.niucore.com/api/v1/analytics /files-by-libraryScope: analytics:read
File count per library. It is the only metrics endpoint that does not require library_id on narrowed credentials: only the allowed ones are listed.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
Returns
library_idintegerIdentifier.
namestringName.
filesintegerLive files.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/files-by-library' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"library_id": 31,
"name": "Procedimientos de soporte",
"files": 84
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Usage per model
api.niucore.com/api/v1/analytics /token-usage /by-modelScope: analytics:read
Tokens consumed, broken down by model and provider.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
What the total covers
It returns company-wide usage only if the credential is not limited to specific libraries and the user holds metrics.read.all. In every other case the total is that of the user the credential acts for — never more than that person can already see.
Heads up
These two endpoints only look at start_date and end_date. library_id is accepted for uniformity with the other metrics, but it is ignored.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
Returns
model_namestringModel.
provider_namestringProvider.
is_autobooleanTurns resolved by the balancer. With true, auto_breakdown carries which model answered each.
message_countintegerTurns.
input_tokensintegerInput tokens.
output_tokensintegerOutput tokens.
total_tokensintegerTotal.
cache_read_tokensintegerTokens read from cache. They are not included in input_tokens.
cache_creation_tokensintegerTokens written to cache.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/token-usage/by-model?start_date=2026-08-01&end_date=2026-08-31' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"model_name": "gpt-4o",
"provider_name": "OpenAI",
"is_auto": false,
"message_count": 1840,
"input_tokens": 4210882,
"output_tokens": 388104,
"total_tokens": 4598986,
"cache_read_tokens": 902144,
"cache_creation_tokens": 41220
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Aggregate usage
api.niucore.com/api/v1/analytics /token-usage /by-dayScope: analytics:read
The range totals, as a single object — not a per-day series.
Not paginated
It returns the complete series for the requested range. meta carries only request_id — no page, size or total — and pagination parameters are ignored. What bounds the result is start_date/end_date, which default to the last 7 days.
What the total covers
It returns company-wide usage only if the credential is not limited to specific libraries and the user holds metrics.read.all. In every other case the total is that of the user the credential acts for — never more than that person can already see.
Heads up
These two endpoints only look at start_date and end_date. library_id is accepted for uniformity with the other metrics, but it is ignored.
Query
start_datestringRange start, YYYY-MM-DD. Goes together with end_date: sending only one returns 422. With neither, the metric covers the last 7 days.
end_datestringRange end, YYYY-MM-DD, inclusive. Goes together with start_date.
Returns
total_messagesintegerTurns in the range.
total_input_tokensintegerInput.
total_output_tokensintegerOutput.
total_tokensintegerTotal.
cache_read_tokensintegerRead from cache.
cache_creation_tokensintegerWritten to cache.
curl -sS -X GET 'https://api.niucore.com/api/v1/analytics/token-usage/by-day?start_date=2026-08-01&end_date=2026-08-31' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"total_messages": 4812,
"total_input_tokens": 9120440,
"total_output_tokens": 812006,
"total_tokens": 9932446,
"cache_read_tokens": 1904882,
"cache_creation_tokens": 88410
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}