JSON Store API
Store small JSON documents and read or update them over REST: merge patch, versions, optimistic locking, TTL and optional public read without a key.
POST /v1/json-store with {"data": …} (any JSON value), an optional name, public and ttl_seconds creates a document and returns its id and URL /v1/json-store/{id}. GET returns it with metadata (raw=true: just the document, with an ETag), PUT (or POST) replaces data, PATCH applies a JSON Merge Patch (RFC 7386: null deletes a key) and DELETE removes it. Name, public flag and TTL can be changed without touching the data.
Every write increases version; send if_version (or If-Match: "v3") to refuse the write when someone else changed the document in between (409 version_conflict). Previous versions are kept (/{id}/versions, /{id}/versions/{n}): 3 on Free, 10 on Starter, 25 on Pro. A document with public=true can be read by anyone with GET /v1/json-store/{id} and no API key (raw JSON, CORS *, served as application/json with nosniff so it can never act as a web page; such reads are free, cached 10 s and limited per document). Documents with ttl_seconds (60 s to 365 days) disappear when they expire.
Documents belong to an account (API key or signed in). Limits per plan: Free 10 documents of up to 100 KB (5 MB in total with versions), Starter 100 × 512 KB (100 MB), Pro 1,000 × 1 MB (500 MB). Every authenticated call counts one request. Data is stored in our D1 database (strongly consistent: a read right after a write sees it). Do not store secrets or personal data in public documents.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
data | body | object | yes | The JSON document (any JSON value). Required to create; with PATCH it is a merge patch. | |
name | body | string | no | Display name (max 100 characters). | |
public | body | boolean | no | false | Allow GET without an API key (raw JSON). |
ttl_seconds | body | number | no | Expire the document after 60 s – 365 days; 0 removes the expiry. | |
if_version | body|query | number | no | PUT / PATCH only if the document is still at this version (or If-Match: "v<n>"). | |
raw | query | boolean | no | false | GET: return only the document. |
id | path | string | no | /{id} (GET, PUT, POST, PATCH, DELETE), /{id}/versions, /{id}/versions/{n}. |
Example
curl -X POST "https://apibox.io.vn/v1/json-store" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Cấu hình","public":true,"data":{"theme":"dark","flags":{"beta":true,"old":1}}}'const res = await fetch('https://apibox.io.vn/v1/json-store', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Cấu hình",
"public": true,
"data": {
"theme": "dark",
"flags": {
"beta": true,
"old": 1
}
}
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/json-store",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"name": "Cấu hình", "public": True, "data": {"theme": "dark", "flags": {"beta": True, "old": 1}}},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/json-store');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"name":"Cấu hình","public":true,"data":{"theme":"dark","flags":{"beta":true,"old":1}}}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"id": "js_vb1uxwnz96v8s4nvmydv",
"name": "Cấu hình",
"url": "https://apibox.io.vn/v1/json-store/js_vb1uxwnz96v8s4nvmydv",
"public": true,
"size": 46,
"version": 1,
"expires_at": null,
"created_at": "2026-11-11T03:21:15.000Z",
"updated_at": "2026-11-11T03:21:15.000Z",
"data": {
"theme": "dark",
"flags": {
"beta": true,
"old": 1
}
}
}
Use cases
- Keep feature flags or remote config for an app without a backend
- Save state of a prototype, hackathon project or no-code tool
- Publish a small JSON dataset that front-end code reads without a key
- Share test fixtures between CI jobs with versioning
FAQ
Can a public document be read without an API key?
Yes, GET /v1/json-store/{id} without a key returns the raw JSON when the document is public. Writes always need the owner’s key.
How do I avoid overwriting someone else’s change?
Read the version, then send if_version (or If-Match: "v<n>") with PUT / PATCH. If the document changed meanwhile you get 409 version_conflict.
What happens when a document expires?
After ttl_seconds it returns 404 and is deleted with its versions by the daily clean-up.
Related APIs
JSON Validator
Check JSON syntax with exact line and column of errors, and validate data against a JSON Schema (draft 4, 7, 2019-09 or 2020-12).
{ }JSON Formatter
Pretty print JSON with 0-8 spaces or tabs, minify it, or sort object keys recursively. Syntax errors are reported with line and column.
CSVCSV to JSON
Convert CSV into an array of JSON objects using the header row, with delimiter auto-detection, number and boolean typing, and row-level errors.