curl --request POST \
--url https://api.statsig.com/v1/log_event \
--header 'Content-Type: application/json' \
--header 'statsig-api-key: <api-key>' \
--data '
{
"events": [
{
"eventName": "<string>",
"value": "<string>",
"time": 123,
"user": {
"userID": "user-123",
"email": "[email protected]",
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"country": "US",
"locale": "en_US",
"appVersion": "1.2.3",
"custom": {
"subscription_plan": "premium",
"account_age_days": 45,
"is_beta_tester": true
},
"privateAttributes": {
"internal_user_id": "12345"
},
"customIDs": {
"companyID": "company-456",
"deviceID": "device-789"
},
"statsigEnvironment": {
"tier": "production"
}
},
"metadata": {},
"secondaryExposures": [
{
"gate": "<string>",
"gateValue": "<string>",
"ruleID": "<string>"
}
],
"statsigMetadata": {
"sdkType": "js-client",
"sdkVersion": "4.20.0",
"exposureLoggingDisabled": false
}
}
],
"user": {
"userID": "user-123",
"email": "[email protected]",
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"country": "US",
"locale": "en_US",
"appVersion": "1.2.3",
"custom": {
"subscription_plan": "premium",
"account_age_days": 45,
"is_beta_tester": true
},
"privateAttributes": {
"internal_user_id": "12345"
},
"customIDs": {
"companyID": "company-456",
"deviceID": "device-789"
},
"statsigEnvironment": {
"tier": "production"
}
},
"statsigMetadata": {
"sdkType": "js-client",
"sdkVersion": "4.20.0",
"exposureLoggingDisabled": false
}
}
'{
"success": true
}Logs one or more custom events for analytics and metric calculation. Events are used to measure experiment outcomes and user behavior.
curl --request POST \
--url https://api.statsig.com/v1/log_event \
--header 'Content-Type: application/json' \
--header 'statsig-api-key: <api-key>' \
--data '
{
"events": [
{
"eventName": "<string>",
"value": "<string>",
"time": 123,
"user": {
"userID": "user-123",
"email": "[email protected]",
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"country": "US",
"locale": "en_US",
"appVersion": "1.2.3",
"custom": {
"subscription_plan": "premium",
"account_age_days": 45,
"is_beta_tester": true
},
"privateAttributes": {
"internal_user_id": "12345"
},
"customIDs": {
"companyID": "company-456",
"deviceID": "device-789"
},
"statsigEnvironment": {
"tier": "production"
}
},
"metadata": {},
"secondaryExposures": [
{
"gate": "<string>",
"gateValue": "<string>",
"ruleID": "<string>"
}
],
"statsigMetadata": {
"sdkType": "js-client",
"sdkVersion": "4.20.0",
"exposureLoggingDisabled": false
}
}
],
"user": {
"userID": "user-123",
"email": "[email protected]",
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"country": "US",
"locale": "en_US",
"appVersion": "1.2.3",
"custom": {
"subscription_plan": "premium",
"account_age_days": 45,
"is_beta_tester": true
},
"privateAttributes": {
"internal_user_id": "12345"
},
"customIDs": {
"companyID": "company-456",
"deviceID": "device-789"
},
"statsigEnvironment": {
"tier": "production"
}
},
"statsigMetadata": {
"sdkType": "js-client",
"sdkVersion": "4.20.0",
"exposureLoggingDisabled": false
}
}
'{
"success": true
}SDK API key (Server Secret or Client SDK Key)
Client timestamp in milliseconds. Used to normalize event timestamps against server time and account for client clock drift.
Array of events to log
1Show child attributes
Name of the event
1Optional event value (string or number)
Event timestamp (unix timestamp in milliseconds or ISO date string)
User object for this specific event (overrides request-level user)
Show child attributes
Primary user identifier
"user-123"
User email address
User IP address for geo-targeting
"192.168.1.1"
User agent string for device/browser targeting
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
2-letter country code (ISO 3166-1 alpha-2)
"US"
Locale/language code
"en_US"
Application version
"1.2.3"
Custom user attributes for targeting (string, number, boolean, or array of strings)
{
"subscription_plan": "premium",
"account_age_days": 45,
"is_beta_tester": true
}
Private attributes used for evaluation but not logged to analytics
{ "internal_user_id": "12345" }
SDK metadata for tracking SDK type, version, and other diagnostic information
Show child attributes
SDK type sending the request (e.g., js-client)
SDK version
When true, prevents the HTTP API from automatically logging exposures. Use this only if you will handle exposure logging yourself.
{
"sdkType": "js-client",
"sdkVersion": "4.20.0",
"exposureLoggingDisabled": false
}
Shared user object for all events (can be overridden per event)
Show child attributes
Primary user identifier
"user-123"
User email address
User IP address for geo-targeting
"192.168.1.1"
User agent string for device/browser targeting
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
2-letter country code (ISO 3166-1 alpha-2)
"US"
Locale/language code
"en_US"
Application version
"1.2.3"
Custom user attributes for targeting (string, number, boolean, or array of strings)
{
"subscription_plan": "premium",
"account_age_days": 45,
"is_beta_tester": true
}
Private attributes used for evaluation but not logged to analytics
{ "internal_user_id": "12345" }
SDK metadata for tracking SDK type, version, and other diagnostic information
Show child attributes
{
"sdkType": "js-client",
"sdkVersion": "4.20.0",
"exposureLoggingDisabled": false
}
Events accepted for processing
Whether the request was successful
Was this page helpful?