The four methods.
Which calls fire an Exposure, and which credential each needs.
An Exposure is the “this subject saw this Variant” event that experiment analysis counts. Which methods fire one is the core thing to get right: an Exposure recorded outside the real user path inflates the denominator and biases the result.
| Method | Returns | Fires an Exposure | Credential |
|---|---|---|---|
evaluate | the Variant value | yes | Client Key only |
evaluateDetails | full ResolutionDetails | yes | Client Key only |
peekVariant | the Variant value | no | API Key only |
verify | full ResolutionDetails | no | Client Key or API Key |
evaluateorevaluateDetailson the real user path. These are the calls that belong in production request handling; reach forevaluateDetailswhen the handler needsResolutionDetails.peekVariantto inspect a resolution without polluting experiment data: admin screens, support tooling, debugging.verifyto confirm setup end to end. Same shape asevaluateDetails, no Exposure, safe to run repeatedly in CI.
Reading ResolutionDetails
evaluateDetails and verify return the reason the value was chosen, not just the value. Branch on reason when you need to distinguish a real resolution from a fallback.
const details = await splitch.evaluateDetails("new-checkout", {
targetingKey: user.id,
idempotencyKey: crypto.randomUUID(),
defaultValue: false,
});
if (details.reason === "ERROR") {
// details.value is your defaultValue, and details.errorCode says why.
// Every code is documented at https://splitch.dev/docs/error/{code}
}