Track Checkpoint Usage API
Run in Apidog
Track Checkpoint Usage API# Description# This API endpoint allows you to record usage data at a specific checkpoint for a given customer. Useful for tracking token usage and session metadata in AI interactions. Request Parameters# Path Parameters:# companyId (string, required): The unique identifier of the company. Example: COM-0MBBRJ0HDSDJG
Authorization (string, required): The authorization token in the format Bearer <your_token>
.
Content-Type (string, required): The content type of the request, should be application/json
.
Body Parameters:# checkpoint_name (string, required): The name of the checkpoint to track (e.g., session-ended
).
customer_identifier (string, required): The unique identifier of the customer (such as email or UUID).
provider (string, required): The AI service provider used (e.g., OPENAI
, ANTHROPIC
).
model (string, required): The AI model used (e.g., GPT_4
, CLAUDE_3_OPUS
).
input_token (integer, required): The number of tokens sent to the model.
output_token (integer, required): The number of tokens received from the model.
session_id (string, optional): The unique session identifier.
extra_params (object, optional): Any additional custom metadata as key-value pairs.
Request Example# Response# Success (200)# {
"success" : true ,
"message" : "Checkpoint usage recorded successfully."
}
Error Responses# Unauthorized (401)# {
"success" : false ,
"message" : "Unauthorized access. Invalid token."
}
Bad Request (400)# {
"success" : false ,
"message" : "Invalid request parameters."
}
Not Found (404)# {
"success" : false ,
"message" : "Company not found."
}
Notes# Use meaningful checkpoint_name
values to categorize different stages (e.g., session-started
, session-ended
, etc.).
Ensure that input_token
and output_token
are integers.
You can use extra_params
to include trace IDs, prompt categories, or other internal metadata.
Authentication is required using a valid Bearer token.
Request Provide your bearer token in the Authorization
header when making requests to protected resources. Example: Authorization: Bearer ********************
Example: {
"checkpoint_name": "session-ended",
"customer_identifier": "onkar@stykite.com",
"provider": "OPENAI",
"model": "GPT_4",
"input_token": 100,
"output_token": 200,
"session_id": "1234",
"extra_params": {
"key1": "value1"
}
}
Request samples curl --location --request POST 'https://sandbox.api.stykite.com/v1/company//checkpoint/usage' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"checkpoint_name": "session-ended",
"customer_identifier": "onkar@stykite.com",
"provider": "OPENAI",
"model": "GPT_4",
"input_token": 100,
"output_token": 200,
"session_id": "1234",
"extra_params": {
"key1": "value1"
}
}'
Responses application/json Generate Code
Modified at 2025-08-02 16:48:05