Skip to main content

Read the state

The payoff: one GET returns everything Tessera knows about a user's behavior, compressed into a vector and your label's score.

08-read-state.sh
#!/usr/bin/env bash
# Quickstart step 8 — read a user's embedding and score from the serving API.
set -euo pipefail

: "${TESSERA_API_BASE:?e.g. https://api.staging.tessera.zone/v1}"
: "${TESSERA_API_KEY:?your tsk_test_… key}"

STATE="$(curl -sS "$TESSERA_API_BASE/slots/quickstart/entities/user/u_00001/state" \
-H "Authorization: Bearer $TESSERA_API_KEY")"

echo "$STATE" | python3 -m json.tool

# Every scored response is auditable: the embedding, the per-label scores,
# and the freshness block naming the exact model fingerprint and the last
# event the state incorporates.
printf '%s' "$STATE" | python3 -c '
import json, sys
state = json.load(sys.stdin)
freshness = state["freshness"]
print("embedding_dimension:", len(state["embedding"]))
print("score repeat_purchase_30d present:", "repeat_purchase_30d" in state["scores"])
print("model_fingerprint:", freshness["model_fingerprint"])
print("event_cursor timestamp:", freshness["event_cursor"]["timestamp"])
'

Download quickstart/08-read-state.sh — this exact file runs in CI on every change (hosts shown are for this environment).

The response has three parts:

  • embedding — the user's behavioral embedding (32 floats under the CI profile; 256 for stock tier S). Use it for lookalikes, clustering, or as features downstream.
  • scores — {"repeat_purchase_30d": p}: the probability head you trained in step 6, keyed by the label you defined in step 4.
  • freshness — the audit trail, on every scored response: model_fingerprint and bundle_id (exactly which bytes scored this), event_cursor (the last event this state incorporates), computed_at. From one served score you can walk back to the exact dataset, contract and policy that produced it.

Need many users at once? POST /slots/quickstart/scores:batch reads up to 1,000 entities in one call, and exports snapshot the whole slot to Parquet or your warehouse.

Where to go next​