Levered Docs
Getting StartedConnect Your Warehouse

Managed Warehouse

Let Levered host your warehouse — send exposure and reward events to the ingestion API instead of connecting your own data warehouse.

With the Managed Warehouse, Levered hosts the warehouse for you. Instead of connecting your own BigQuery, Snowflake, or Postgres, you send exposure and reward events to Levered's ingestion API and they land in a managed dataset that training and results read from automatically.

Use this when you don't want to stand up or grant access to your own warehouse. Everything else — metrics, optimizations, the SDK — works the same.

1. Enable the managed warehouse

  1. Navigate to Settings > Warehouse in the Levered dashboard.
  2. Under the connection options, click Managed Warehouse ("Hosted by Levered").

This points your organization at the managed dataset. You only need to do this once.

2. Create an optimization

Every exposure you send is attached to an optimization, so create one first — you'll need its optimization_id in the next steps. Create it from the dashboard (Optimizations > Create Optimization), or with the Levered CLI / Claude Code plugin. See Create your first optimization.

3. Create an API key

The ingestion API is authenticated with an API key (your Clerk dashboard session is not used for ingestion).

  1. Go to Settings > API Keys in the dashboard.
  2. Create a new key. The full secret is shown once — copy it and store it somewhere safe. You can revoke it any time.

4. Send events

Send events as JSON batches to the ingestion API. Authenticate with your key via Authorization: Bearer <api_key> (or the X-API-Key header).

  • Base URL: https://api.levered.dev/api/v2/ingest
  • Up to 500 events per request; max request body 5 MB.
  • Your optimization_ids must belong to your organization.

Exposures

Record which variant a user saw. POST /api/v2/ingest/exposures:

curl -X POST https://api.levered.dev/api/v2/ingest/exposures \
  -H "Authorization: Bearer $LEVERED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "anonymous_id": "user_123",
        "optimization_id": "eec6a814-3672-4fcc-b88f-1a900724a9aa",
        "variant": { "cta": "sign_up_now", "hero": "shield" },
        "context": { "country": "US", "device": "mobile" },
        "timestamp": "2026-06-16T10:30:00Z"
      }
    ]
  }'
FieldRequiredDescription
anonymous_idyesStable per-user identifier (1–512 chars).
optimization_idyesUUID of one of your optimizations.
variantyesThe variant the user was served, as a JSON object of factor → value.
contextnoContext-factor values for this exposure.
timestampnoISO 8601 event time (with offset). Defaults to server time if omitted.
idempotency_keynoCaller-supplied key (1–256 chars) to make retries safe.

Rewards

Record a conversion or metric event. POST /api/v2/ingest/rewards:

curl -X POST https://api.levered.dev/api/v2/ingest/rewards \
  -H "Authorization: Bearer $LEVERED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "anonymous_id": "user_123",
        "name": "signup_completed",
        "value": 1,
        "timestamp": "2026-06-16T10:32:00Z"
      }
    ]
  }'
FieldRequiredDescription
anonymous_idyesSame identifier you sent on the exposure — this is how rewards attribute back.
nameyesMetric name (1–255 chars), e.g. signup_completed.
valuenoNumeric value; defaults to 1 (a count/conversion).
timestampnoISO 8601 event time. Defaults to server time if omitted.
optimization_idnoPin the reward to one optimization. Omit for a global conversion attributed by name across optimizations.
propertiesnoArbitrary JSON metadata.
idempotency_keynoCaller-supplied key to make retries safe.

Responses

StatusMeaning
200All events accepted.
207Partial — some events were rejected; see the rejected array in the response.
400Invalid payload (the response lists the validation issues).
403One or more optimization_ids are unknown or not owned by your org.
409Your org isn't on the managed warehouse — enable it (step 1) first.
503Transient warehouse write failure — retry the batch.

Rewards attribute to exposures by anonymous_id within each optimization's conversion window, exactly as they do with a connected warehouse.

Next step

Once events are flowing, training reads from the managed dataset automatically — no data pipeline to build and no further configuration. Next, integrate the SDK to serve variants in your app, then watch results come in on the optimization's dashboard.