A batch of evaluation summaries, aliases and exposures
const url = 'https://example.com/sdk/v1/events';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"schema_version":1,"sdk":{"name":"example","version":"example","platform":"example"},"sent_at":"2026-04-15T12:00:00Z","events":[{}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/sdk/v1/events \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "schema_version": 1, "sdk": { "name": "example", "version": "example", "platform": "example" }, "sent_at": "2026-04-15T12:00:00Z", "events": [ {} ] }'Accepts a batch of events from either key. The batch is refused as a
whole only for its envelope (400 invalid_request with violations),
its key, its size (413 request_too_large: over 500 events or
1 MiB after decompression), a rate limit or a server error; an SDK
retries those with the same event IDs, except a 4xx other than
401, 403 and 429, which it drops.
Otherwise each event is judged on its own and the batch is answered
202 once every accepted event is durable, so the SDK can drop what
it sent. Each event is idempotent by its event_id, a lowercase
UUIDv7, for a year, or the retention window and a day when that is
longer: one already received is counted in duplicates, never
twice. A summary row naming a flag
the project does not have, or a variation its flag does not have, is
dropped and counted in dropped_rows, which is always 0 for a client key,
since a count would tell whether a flag key it guessed is a flag of the
project. A refused event is listed in rejected with its
index, its event_id when it has one, a code and a detail; the
SDK never sends it again.
The rejection codes are an open set, which a later server may add
to: an SDK treats a code it does not know like any other rejection
and never resends the event. A client key is told no more of an
exposure’s refusal than unknown_experiment, whatever it got wrong
and whether the experiment exists, is a draft or is none, so that it
learns nothing of the project’s experiments from a refusal. The
codes today: event_invalid (a
member missing, of the wrong type, a string over 256 bytes or
holding U+0000, a summary over 1,000 rows), event_type_unknown,
event_id_invalid, out_of_window (occurred_at or the event ID’s
time older than the retention window, after the clock skew shift), undeclared_unit_type (an alias of a server key naming a unit type the
project does not declare; a client key is answered event_invalid),
unknown_experiment (an exposure naming no experiment of the
project, or a draft, which is served to no unit; a started
experiment of any status exists, since a mobile app flushes its
queue days late), unit_type_mismatch (an exposure
whose unit type is not its experiment’s), unknown_variation (an
exposure naming a variation its experiment does not weigh; an
exposure with override true may name any variation of the
experiment’s flag instead, since an override decides the variation
whatever the weights are), quota_exceeded (an alias linking a
new pair, or an exposure of a unit with no first exposure yet, past
what the operator allows an environment or experiment to keep)
and, for an exposure naming another flag than its experiment’s or an
evaluation_reason other than experiment or override,
event_invalid. An exposure is judged in that order and refused
with the first check it fails. The codes are the same for both kinds
of key; a refusal’s detail is specific for a server key and, for a
client key, names no unit type, flag, variation or status of the
experiment. An occurred_at more than 24 hours ahead is taken as the
time the event was received.
Device clock skew. When sent_at differs from the time the
server received the batch by more than one minute, every time in it
(occurred_at of an alias or an exposure, interval_start and
interval_end of an evaluation summary) is shifted by the server’s
time minus sent_at before it is checked against the retention
window and stored, so a device with a wrong clock keeps its events
in the right place. The event ID’s time is checked against the
window shifted the same way; the event_id stored is never
shifted. Stamp sent_at from the same clock as the
events.
From a closing page. A browser page that is closing hands its
last batch, exposures included, to navigator.sendBeacon, which
cannot set headers and is sent without a CORS preflight; a
keepalive fetch carrying Authorization and JSON would need one,
which browsers do not send for such a request, and the last
exposures of a visit would be lost. So a batch is also accepted with
a client key as the query parameter sdk_key and the envelope sent
as text/plain (any charset), read as JSON with the same limits
and answers. Such a request is a CORS simple request: answered with
the same CORS headers, the key’s allowed origins enforced and the
client events rate limit applied. A server key in the query is
403 server_key_in_query; a key both in Authorization and in the
query is 400 invalid_request.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The highest document schema the SDK reads; absent is 1.
gzip for a compressed body.
Query Parameters
Section titled “Query Parameters”A client key, for navigator.sendBeacon, which cannot set
Authorization. Never together with Authorization.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The envelope’s schema, 1.
object
The SDK’s name, such as flagnetic-go, as its User-Agent
would name it. The SDK inventory takes the SDK from here when
the request’s User-Agent names none.
When the SDK sent the batch, by its own clock. A difference of more than one minute from the server’s time shifts every time in the batch.
At most 500 events, each judged on its own. An event is an
object with a type and an event_id; the types today are
evaluation_summary (EvaluationSummaryEvent), alias
(AliasEvent) and exposure (ExposureEvent). An event of a type
the server does not know is rejected event_type_unknown.
object
Example generated
{ "schema_version": 1, "sdk": { "name": "example", "version": "example", "platform": "example" }, "sent_at": "2026-04-15T12:00:00Z", "events": [ {} ]}The same envelope as application/json, read as JSON.
Responses
Section titled “Responses”The batch was judged; every accepted event is durable.
object
The events stored.
The events already received, by event_id.
The summary rows naming a flag the project does not have, or a variation its flag does not have; always 0 for a client key.
object
The event’s position in the batch.
Why the event was refused. An open set: an SDK treats a code it does not know like any other rejection and never resends the event.
Example generated
{ "accepted": 1, "duplicates": 1, "dropped_rows": 1, "rejected": [ { "index": 1, "event_id": "example", "code": "example", "detail": "example" } ]}Headers
Section titled “Headers”The requests the window allows.
The requests left in the window.
invalid_request: a body that is not JSON, or an events envelope that breaks its shape, with errors.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}sdk_key_missing without a key, with WWW-Authenticate: Bearer;
sdk_key_invalid, sdk_key_revoked or sdk_key_expired, with
WWW-Authenticate: Bearer error="invalid_token".
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}Headers
Section titled “Headers”key_kind_not_allowed (a client key at the ruleset),
server_key_in_query, server_key_from_browser or
origin_not_allowed.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}schema_version_unsupported: Flagnetic-Schema-Version below 1, not an integer, or sent more than once.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}request_too_large: the body is over its limit after decompression.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}unsupported_media_type: the body is not application/json (the
events endpoint also takes text/plain, which a browser sends without
a preflight), or it arrives in a Content-Encoding other than gzip
or identity.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}rate_limited: the window is spent.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}Headers
Section titled “Headers”Seconds to wait before trying again, at least 1.
The requests the window allows.
The requests left in the window.
Seconds until the window ends, at least 1.
ruleset_unavailable (this replica cannot load the environment’s
ruleset yet) or unavailable (the key could not be checked, or this
replica is shutting down and takes no new stream), with
Retry-After.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which an SDK branches on.
An English explanation for humans; never what an SDK branches on.
Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.
object
JSON Pointer into the request body.
The rule broken, such as too_long, too_many or duplicate.
The values of the rule broken, such as max, for a client to explain the violation in its own language.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "code": "example", "detail": "example", "request_id": "example", "retry_after": 1, "errors": [ { "pointer": "example", "code": "example", "detail": "example", "params": {} } ]}Headers
Section titled “Headers”Seconds to wait before trying again, at least 1.