Read-only JSON API for NEAR FastData key-value storage
All POST endpoints accept a JSON body and return JSON. Base URL: https://kv.test.fastnear.com
Get the latest value of a specific key.
curl https://kv.test.fastnear.com/v0/latest/app.near/alice.near/score
Get the full history of a specific key.
curl https://kv.test.fastnear.com/v0/history/app.near/alice.near/score
| Field | Type | Default | Description |
|---|---|---|---|
| limit | integer | 50 | Max results per page (max 200) |
| page_token | string | Pagination token from previous response | |
| include_metadata | boolean | false | Include receipt_id, tx_hash, signer_id, action_index in response |
| asc | boolean | false | Sort history oldest-first (default is newest-first) |
Get latest values of all keys across all contracts for a predecessor. Must be paginated.
curl -X POST https://kv.test.fastnear.com/v0/all/alice.near \
-H "Content-Type: application/json" \
-d '{"limit":50}'
Full history of KV writes by a predecessor to a contract.
| Field | Type | Description |
|---|---|---|
| key | string | Exact key (optional) |
| key_prefix | string | Key prefix filter (optional, mutually exclusive with key) |
curl -X POST https://kv.test.fastnear.com/v0/history/app.near/alice.near \
-H "Content-Type: application/json" \
-d '{"key_prefix":"settings/"}'
Latest values by predecessor + contract. Same body fields.
curl -X POST https://kv.test.fastnear.com/v0/latest/app.near/alice.near \
-H "Content-Type: application/json" \
-d '{"key_prefix":"settings/"}'
Full history of all KV writes to a contract (all predecessors). Same body fields.
curl -X POST https://kv.test.fastnear.com/v0/history/app.near \
-H "Content-Type: application/json" \
-d '{"key":"score","limit":10}'
Latest values for a contract (all predecessors). Same body fields.
Global lookup: all writes to a key across all accounts.
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | The key to look up |
curl -X POST https://kv.test.fastnear.com/v0/history \
-H "Content-Type: application/json" \
-d '{"key":"score","limit":10}'
Batch lookup: latest value for multiple keys (max 100).
| Field | Type | Required | Description |
|---|---|---|---|
| keys | string[] | Yes | Array of current_account_id/predecessor_id/key strings |
curl -X POST https://kv.test.fastnear.com/v0/multi \
-H "Content-Type: application/json" \
-d '{"keys":["app.near/alice.near/score","app.near/bob.near/score"]}'
{
"entries": [
{
"predecessor_id": "alice.near",
"current_account_id": "app.near",
"block_height": 123456789,
"block_timestamp": 1700000000000,
"key": "score",
"value": 1500
}
],
"page_token": "eyJr..."
}
{
"entries": [
{
"receipt_id": "Aw1MHvj3GHBon1GBiGMWqafBJCBMqXTPw4PoSaSEjnkQ",
"action_index": 0,
"tx_hash": "6i9brQEJzLqmLLoqCcPPQih7YeYmLZcLxjW8zGnx3LFh",
"signer_id": "alice.near",
"predecessor_id": "alice.near",
"current_account_id": "app.near",
"block_height": 123456789,
"block_timestamp": 1700000000000,
"key": "score",
"value": 1500
}
]
}
value is raw JSON (number, string, object, array) as stored. page_token is absent when there are no more results.
{
"entries": [
{"predecessor_id": "alice.near", "current_account_id": "app.near", "key": "score", "value": 1500, ...},
null
]
}
Entries match input keys order. null = key not found.
limit).page_token, resend same request with that token.page_token is absent.| Status | Meaning |
|---|---|
| 400 | Invalid request (both key and key_prefix set, bad page_token, invalid multi key format) |
| 500 | Internal server error |
Error body: {"error": "description"}
Data is written by sending a NEAR transaction. Call the method __fastdata_kv on any account, passing a JSON object as the argument. The root-level keys of the JSON become your KV keys, and the values are stored as-is.
current_account_id) does not need to have a smart contract deployed, or even exist on chain. The data is indexed from the transaction itself, not from contract state.
predecessor_id) calls __fastdata_kv on a target account (current_account_id)near call my-app.near __fastdata_kv '{"score": 1500}' --accountId alice.near
This stores key score with value 1500, readable at:
GET https://kv.test.fastnear.com/v0/latest/my-app.near/alice.near/score
near call my-app.near __fastdata_kv '{
"settings/lang": "en",
"settings/volume": 80,
"profile": {"name": "Alice", "level": 42}
}' --accountId alice.near
This stores three keys in one transaction. Query all settings with a prefix filter:
curl -X POST https://kv.test.fastnear.com/v0/latest/my-app.near/alice.near \
-H "Content-Type: application/json" \
-d '{"key_prefix":"settings/"}'
near call data-store.alice.near __fastdata_kv '{"hello": "world"}' --accountId alice.near
The account data-store.alice.near doesn't need to exist. It acts purely as a namespace for organizing your data.