Skip to main content
POST
/
v1
/
log_event
Log Custom Events
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
}

Authorizations

statsig-api-key
string
header
required

SDK API key (Server Secret or Client SDK Key)

Headers

STATSIG-CLIENT-TIME
integer<int64>

Client timestamp in milliseconds. Used to normalize event timestamps against server time and account for client clock drift.

Body

application/json
events
object[]
required

Array of events to log

Minimum array length: 1
user
object

Shared user object for all events (can be overridden per event)

statsigMetadata
object

SDK metadata for tracking SDK type, version, and other diagnostic information

Example:
{
  "sdkType": "js-client",
  "sdkVersion": "4.20.0",
  "exposureLoggingDisabled": false
}

Response

Events accepted for processing

success
boolean
required

Whether the request was successful