Skip to main content
GET
/
usage
/
end-users
/
{end_user_id}
/
history
Get end user usage history
curl --request GET \
  --url https://app.usechar.ai/api/usage/end-users/{end_user_id}/history \
  --header 'Authorization: Bearer <token>'
[
  {
    "id": "<string>",
    "organization_id": "<string>",
    "end_user_id": "<string>",
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "model": "<string>",
    "finish_reason": "<string>",
    "created_at": "2023-11-07T05:31:56Z"
  }
]

Authorizations

Authorization
string
header
required

WorkOS JWT token. Obtain via WorkOS AuthKit authentication flow. The token must include organization_id claim for organization-scoped endpoints.

Path Parameters

end_user_id
string<uuid>
required

End user ID to get history for

Query Parameters

limit
integer
default:50

Maximum number of records to return

Required range: 1 <= x <= 100

Response

OK

id
string
required

Internal usage record ID (UUID).

organization_id
string
required

WorkOS organization ID that owns the usage record.

end_user_id
string
required

Internal end user ID associated with the usage record.

prompt_tokens
integer
required

Number of prompt (input) tokens for the request.

Required range: -9007199254740991 <= x <= 9007199254740991
completion_tokens
integer
required

Number of completion (output) tokens for the request.

Required range: -9007199254740991 <= x <= 9007199254740991
total_tokens
integer
required

Total tokens used (prompt plus completion).

Required range: -9007199254740991 <= x <= 9007199254740991
model
string
required

Model identifier used to generate the response.

finish_reason
string | null
required

Reason the generation finished (stop, length, tool-calls, etc.).

created_at
string<date-time>
required

Timestamp when the usage record was created.