Skip to content

The served value of every flag for a context

POST
/evaluate
curl --request POST \
--url https://example.com/sdk/v1/evaluate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "context": { "units": { "additionalProperty": "example" }, "attributes": {} }, "flags": [ "example" ] }'

Evaluates the environment’s ruleset for the context posted, against the whole server-side document, private segments included, and answers the served value of every flag, or of the flags named. A flag named that the ruleset does not hold is left out of the answer.

Attributes are typed against the project’s declarations: an undeclared attribute, or one named like a unit type, is left out and listed in ignored_attributes with undeclared; a value of the wrong type is left out and listed with type_mismatch; null is kept. A client key’s ignored_attributes is always empty, since it would otherwise tell which attributes the project declares. A context over the limits (64 attributes, 256 characters per string, 64 items per list, 256 bytes per unit ID) is 422 invalid_context, every violation pointing into the body with too_long or too_many and params.max. A unit type given twice is 422 invalid_context too, with duplicate at that unit type, since which of its IDs to evaluate for would be a guess. The body is at most 32 KiB after decompression.

A client key’s answer never says how a value was reached: the reasons rule, rollout, fallthrough and prerequisite_failed are answered targeting_match, and no rule_id is ever present; off, override, experiment and error and the experiment block stay. A server key’s answer carries the true reason and rule_id. Evaluating records no exposure.

Flagnetic-Schema-Version
string

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

Content-Encoding
string

gzip for a compressed body.

Media typeapplication/json
object
context
required
object
units

The unit ID of each unit type, such as {"user":"u-1001"}; an empty ID is an absent unit.

object
key
additional properties
string
attributes

The context’s attributes, by key.

object
key
additional properties
any
flags

The flags to evaluate; every flag when absent.

Array<string>

Example generated

{
"context": {
"units": {
"additionalProperty": "example"
},
"attributes": {}
},
"flags": [
"example"
]
}

The served value of every flag evaluated, by flag key.

Media typeapplication/json
object
schema_version
required
integer
ruleset_version
required

The version of the ruleset evaluated.

integer format: int64
environment
required
object
key
required
string
protected
required

An SDK ignores local overrides in a protected environment.

boolean
flags
required

The result of each flag evaluated, by flag key.

object
key
additional properties
object
type
required
string
value

The served value; absent for error.

variation

The served variation; absent for error.

string
reason
required

Why the value was served. A client key receives targeting_match, off, override, experiment or error; a server key the true reason: rule, rollout, fallthrough, prerequisite_failed, off, override, experiment or error. An SDK passes a reason it does not know through with the served value.

string
rule_id

The rule that served, for a server key only.

string
automatic_exposure
required

Whether the SDK records an exposure after every evaluation carrying experiment.

boolean
override_influenced
required

Whether an override influenced the value, directly or through a prerequisite.

boolean
experiment

The running experiment the value comes from, which an exposure carries.

object
key
required
string
variation
required

The served variation; an override’s when an override decided the value.

string
unit_type
required
string
unit_id
required
string
inclusion_salt
required
string
variation_salt
required
string
inclusion_bucket
required
integer
variation_bucket
required
integer
override
required

Whether an override influenced the value; analysis excludes such exposures.

boolean
error_code

For error: prerequisite_cycle or inconsistent_ruleset. flag_not_found is the code of an SDK’s local evaluator for a flag the ruleset does not hold; /evaluate never answers it, as it leaves unknown flags out.

string
ignored_attributes
required

The attributes left out of the evaluation, and why; always empty for a client key.

Array<object>
object
name
required
string
code
required

undeclared or type_mismatch.

string

Example generated

{
"schema_version": 1,
"ruleset_version": 1,
"environment": {
"key": "example",
"protected": true
},
"flags": {
"additionalProperty": {
"type": "example",
"value": "example",
"variation": "example",
"reason": "example",
"rule_id": "example",
"automatic_exposure": true,
"override_influenced": true,
"experiment": {
"key": "example",
"variation": "example",
"unit_type": "example",
"unit_id": "example",
"inclusion_salt": "example",
"variation_salt": "example",
"inclusion_bucket": 1,
"variation_bucket": 1,
"override": true
},
"error_code": "example"
}
},
"ignored_attributes": [
{
"name": "example",
"code": "example"
}
]
}
Cache-Control
string

no-store: one context’s values are never cached for another.

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

invalid_context: the context breaks a limit; errors names every violation.

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.