API reference
To get started collecting events in your application using Trubrics, consult first our Javascript SDK or Python SDK. If your language is not supported, you can send events directly to our API:
curl -X 'POST' \
'https://app.trubrics.com/api/ingestion/publish_event' \
-H 'Content-Type: application/json' \
-H 'x-api-key: TRUBRICS_API_KEY' \
-d '{
"user_id": "user_id",
"event": "LLM generation",
"timestamp": "2024-10-09T13:21:46.182Z",
"properties": {
"$text": "Tell me a joke",
"$thread_id": "thread_id",
"$assistant_id": "assistant_id",
"a_custom_property": "any custom value"
}
}'
The request body should contain the following parameters:
Parameter | Type | Description | Required |
---|---|---|---|
user_id |
str |
The distinct ID of the signed in user. | yes |
event |
str |
The name of the event you are tracking. This can range from "User prompt", "Sign in", "Generation", etc. | yes |
timestamp |
str |
The timestamp of the event. | yes |
properties |
dict[str,any] |
A list of properties of the event. For example, a "Generation" event could have properties "Cost of generation" or "Prompt template". Trubrics properties are prefixed with a $ . |
no |
Authentication
This API contains public endpoints only, that will allow your to write to your Trubrics project. The x_api_key
is a required header for your request.
Project API key
Your trubrics API key is unique to your project. Login to Trubrics, and copy your project API key from the settings
page. This is a write only API key that allows you to push events.