Storage Quickstart

Store, version, and retrieve any kind of data.

Quickstart

Litebase Storage is a simple, reliable way to store and track data over time.

Think of it like a memory log for your app. Every piece of data you write is saved. You can update it, track its history, or go back in time — all without losing anything. Any system — agent, dashboard, or backend — can store and retrieve data with a simple API. There’s no database to manage, no setup required, and no SDK needed. Just curl, fetch, or your favorite HTTP client.

1. Save your first prompt and response

Let’s log a model interaction from Luke’s mission assistant.

curl -X POST https://api.litebase.io/storage/rebellion/write \
  -H "Authorization: Bearer $LITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "key": "ai/luke/prompt_001",
      "value": {
        "prompt": "Summarize the Death Star mission.",
        "model": "gpt-4",
        "response": "Rescue Princess Leia. Escape with the crew.",
        "timestamp": "2025-04-05T12:00:00Z"
      }
    }
  ]'

Your data is now stored and versioned under ai/luke/prompt_001.

2. Retrieve the latest version

You can read the current value of any key:

curl -X POST https://api.litebase.io/storage/rebellion/read \
  -H "Authorization: Bearer $LITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '["ai/luke/prompt_001"]'

3. Save an updated response (new version)

Every write to the same key creates a new version automatically.

curl -X POST https://api.litebase.io/storage/rebellion/write \
  -H "Authorization: Bearer $LITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "key": "ai/luke/prompt_001",
      "value": {
        "prompt": "Summarize the Death Star mission.",
        "model": "gpt-4",
        "response": "Infiltrate the station. Rescue Leia. Evade detection.",
        "timestamp": "2025-04-05T12:03:00Z"
      }
    }
  ]'

No need to manage versions manually — Litebase handles it.

4. View version history

You can view previous responses and track how they’ve changed:

curl -X POST https://api.litebase.io/storage/rebellion/versions \
  -H "Authorization: Bearer $LITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "ai/luke/prompt_001",
    "limit": 3
  }'

Useful for debugging model behavior or auditing output history.

5. Watch for live updates

Want to react when the model generates a new response? Subscribe to live changes:

curl -X POST https://api.litebase.io/storage/rebellion/watch \
  -H "Authorization: Bearer $LITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '["ai/luke/prompt_001"]'

You’ll get a real-time stream of versioned updates.

6. Delete when needed

Remove a key and all of its versions:

curl -X DELETE https://api.litebase.io/storage/rebellion/delete \
  -H "Authorization: Bearer $LITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '["ai/luke/prompt_001"]'

Use this for cleanup or data lifecycle management.

Next steps

  • Explore the API reference
  • Track embeddings, ratings, or human feedback using structured keys
  • Use versioning for audit logs or model evaluation
  • Try the lite storage CLI to script batch writes or snapshots