Skip to content

A batch of evaluation summaries, aliases and exposures

POST
/events
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.

Flagnetic-Schema-Version
string

The highest document schema the SDK reads; absent is 1.

Content-Encoding
string

gzip for a compressed body.

sdk_key
string

A client key, for navigator.sendBeacon, which cannot set Authorization. Never together with Authorization.

object
schema_version
required

The envelope’s schema, 1.

integer
sdk
required
object
name
required

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.

string
version
required
string
platform
string
sent_at
required

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.

string format: date-time
events
required

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.

Array<object>
object
key
additional properties
any

Example generated

{
"schema_version": 1,
"sdk": {
"name": "example",
"version": "example",
"platform": "example"
},
"sent_at": "2026-04-15T12:00:00Z",
"events": [
{}
]
}

The batch was judged; every accepted event is durable.

Media typeapplication/json
object
accepted
required

The events stored.

integer
duplicates
required

The events already received, by event_id.

integer
dropped_rows
required

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.

integer
rejected
required
Array<object>
object
index
required

The event’s position in the batch.

integer
event_id
string
code
required

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.

string
detail
required
string

Example generated

{
"accepted": 1,
"duplicates": 1,
"dropped_rows": 1,
"rejected": [
{
"index": 1,
"event_id": "example",
"code": "example",
"detail": "example"
}
]
}
RateLimit-Limit
integer

The requests the window allows.

RateLimit-Remaining
integer

The requests left in the window.

invalid_request: a body that is not JSON, or an events envelope that breaks its shape, with errors.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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".

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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": {}
}
]
}
WWW-Authenticate
string

key_kind_not_allowed (a client key at the ruleset), server_key_in_query, server_key_from_browser or origin_not_allowed.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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": {}
}
]
}
Retry-After
integer

Seconds to wait before trying again, at least 1.

RateLimit-Limit
integer

The requests the window allows.

RateLimit-Remaining
integer

The requests left in the window.

RateLimit-Reset
integer

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.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which an SDK branches on.

string
detail

An English explanation for humans; never what an SDK branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for rate_limited, ruleset_unavailable and unavailable.

integer
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required

The rule broken, such as too_long, too_many or duplicate.

string
detail
required
string
params

The values of the rule broken, such as max, for a client to explain the violation in its own language.

object
key
additional properties
any

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": {}
}
]
}
Retry-After
integer

Seconds to wait before trying again, at least 1.