POST /v1/token-usage
Service: analytics · operationId: (none)
Internal-only token usage ingest endpoint for M2M callers.
Required scopes
(no scope declared — review service config)
Request body
{
"type": "object",
"properties": {
"request_id": {
"type": "string",
"format": "uuid"
},
"user_id": {
"type": [
"string",
"null"
],
"format": "uuid"
},
"brand_id": {
"type": "string",
"minLength": 1
},
"service_name": {
"type": "string",
"minLength": 1
},
"model": {
"type": "string",
"minLength": 1
},
"prompt_tokens": {
"type": "integer",
"minimum": 0
},
"completion_tokens": {
"type": "integer",
"minimum": 0
},
"cost_usd": {
"type": "string"
},
"duration_ms": {
"type": "integer",
"minimum": 0
},
"route": {
"type": "string",
"minLength": 1
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"request_id",
"brand_id",
"service_name",
"model",
"prompt_tokens",
"completion_tokens",
"cost_usd",
"duration_ms",
"route"
]
}Responses
201 Token usage row persisted
{
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"id"
]
}400 Invalid input
{
"type": "object",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"error",
"message"
]
}Example
curl -X POST https://analytics.platform.loop.health/v1/token-usage \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'Related
services/analytics— service overview- All endpoints — directory across services
- Auth model — how scopes are enforced