Read
Query the latest or historical version of any key.
Reading data in Litebase lets you access the value of any key — either as it exists now or at any point in the past. Every value is versioned, so you can retrieve current state, audit history, or reconstruct previous snapshots.
This guide walks through how to read key/value data, fetch historical versions, and use reads as part of version-aware workflows.
1. Read the latest value
To fetch the most recent value of a key, send an HTTP GET request:
Example response:
This returns the latest committed version of the key, along with the transaction metadata.
2. Read a historical version
To query the value as it existed at a specific point in time, use the as_of parameter:
By transaction ID:
By timestamp:
This gives you the exact state of the key as of that point — useful for debugging, audit, or replay-based workflows.
3. Read with context
Every read response includes:
key: the key namevalue: the value at the requested timetime: when the value was writtentx: the transaction IDversion: the version number of the write
These fields make it easy to correlate data with stream events, state transitions, or timeline snapshots.
4. Handle missing keys
If the key does not exist at the given point in time, you'll receive a 404 response:
This usually means:
- The key was created after the requested
as_oftime - The key has never been written to