LeveredDocs

Managed Warehouse

Levered hosts the warehouse, and the app sends exposure and reward events to the ingestion API.

With the Managed Warehouse, Levered hosts the warehouse. The app sends exposure and reward events to Levered's ingestion API. Training and results read the events from there. Choose a warehouse compares this option with connecting your own warehouse.

With the Managed Warehouse, skip step 2 (data pipeline), because the ingestion API replaces it. Metrics, optimizations and the SDK work as with your own warehouse.

1. Enable the managed warehouse

  1. Click Warehouse in the Levered dashboard sidebar.
  2. Under the connection options, click Managed Warehouse ("Hosted by Levered").

This sets the managed dataset as the warehouse of your organization. Do this once per organization.

2. Create an optimization

Each exposure belongs to an optimization. Create an optimization first, because the next steps need its optimization_id. Create it with the Levered CLI or the Claude Code plugin (Create your first optimization).

3. Create an API key

The ingestion API authenticates requests with an API key. It does not accept the Clerk session of the dashboard.

  1. Go to app.levered.dev/warehouse. Keys are managed under API keys on the Managed Warehouse card. API keys are used with the Managed Warehouse only. With data warehouse native, Levered reads your warehouse directly.
  2. Click Create key. The dashboard shows the full secret once. Copy it and store it in a safe place. The key can be revoked on the same card.

4. Send events

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

  • Base URL: https://api.levered.dev/api/v2/ingest
  • A request can contain up to 500 events. The maximum request body is 5 MB.
  • Each optimization_id must belong to your organization.

Exposures

An exposure records which variant a user saw. Send exposures to 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) that makes retries safe.

Rewards

A reward records a conversion or another metric event. Send rewards to 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_idyesThe identifier sent with the exposure. Levered uses it to attribute rewards to exposures.
nameyesMetric name (1-255 chars), for example signup_completed.
valuenoNumeric value. Defaults to 1 (a count or a conversion).
timestampnoISO 8601 event time. Defaults to server time if omitted.
optimization_idnoAssigns the reward to one optimization. If omitted, the reward is a global conversion that is attributed by name across optimizations.
propertiesnoArbitrary JSON metadata.
idempotency_keynoCaller-supplied key that makes retries safe.

Responses

StatusMeaning
200All events accepted.
207Some events were rejected. The rejected array in the response lists them.
400Invalid payload (the response lists the validation issues), or a timestamp more than 24 hours in the future (timestamp too far in the future). With such a timestamp, the whole batch is rejected.
403One or more optimization_id values are unknown or do not belong to your organization.
409The organization does not use the Managed Warehouse. Enable it first (step 1).
503Transient warehouse write failure. Retry the batch.

Levered attributes rewards to exposures by anonymous_id within the conversion window of each optimization, in the same way as with a connected warehouse.

Next step

Training reads from the managed dataset. Next, define the reward metric for your goal.

Managed Warehouse