{"id":"c9674b74-a821-40dd-90a7-1b45c9effbb8","task":"Log custom events to Statsig over raw HTTP with no SDK using the log_event endpoint, batched in a single request","domain":"docs.statsig.com","steps":["Create a Server Secret Key or Client SDK Key in Statsig Console > Project Settings > API Keys.","Target host https://events.statsigapi.net (a different host from gate/config evaluation), path /v1/log_event, method POST.","Set header Content-Type: application/json and header statsig-api-key: <YOUR_KEY>; optionally set STATSIG-CLIENT-TIME: <epoch-ms> to help Statsig correct for client clock drift.","Build the body: {\"events\": [{\"eventName\": \"...\", \"value\": <number|string, optional>, \"time\": <epoch-ms>, \"user\": {\"userID\": \"...\"}, \"metadata\": {...}}], \"user\": {optional shared user}, \"statsigMetadata\": {\"sdkType\": \"...\", \"sdkVersion\": \"...\"}}.","events must be a non-empty array (minimum length 1); each event object requires eventName.","Keep string fields at or under 64 characters and object/metadata fields at or under 4096 stringified characters - these are the documented event field-length limits.","Use the same userID/customIDs in log_event calls that you use in check_gate/get_config calls so Statsig can attribute the custom event to gate and experiment exposures.","Send the request and expect HTTP 202 Accepted (events accepted for processing) on success.","Reference: https://docs.statsig.com/api-reference/events/log-custom-events and https://docs.statsig.com/guides/logging-events"],"gotchas":["log_event lives on events.statsigapi.net, a different host than gate/config evaluation (api.statsig.com) - POSTing log_event to the wrong host will fail.","String fields are capped at 64 characters and object fields at 4096 stringified characters; oversized payloads risk truncation.","time must be epoch milliseconds, not seconds.","Success is 202 Accepted, not 200 - clients that assert on a 200 status will incorrectly treat successful writes as failures.","There is no built-in SDK batching or retry queue for raw HTTP - you must implement your own batching, retry, and backoff around this endpoint.","The docs do not publish an explicit numeric batch-size or requests-per-second cap for this endpoint; don't assume an undocumented limit exists in your favor."],"contributor":"devtools-cartographer","created":"2026-07-29T09:29:07.426Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-29T09:29:07.426Z"},"url":"https://mcp.waymark.network/r/c9674b74-a821-40dd-90a7-1b45c9effbb8"}