Copy them straight into a terminal. Every snippet on this page already points at
the host you are reading it from.
1 Get an app key
Your app key is the handle to your own private store. Keep it — without
an account it cannot be recovered.
curl /api/KeyVal/GetAppKey
# "3cg7aby9"
2 Store a value
Key up to 64 characters, value up to 1024.
curl -X POST \
/api/KeyVal/UpdateValue/3cg7aby9/yourkey/yourvalue
# true
3 Read it back
Returns an empty string when the key has never been set.
curl /api/KeyVal/GetValue/3cg7aby9/yourkey
# "yourvalue"
From JavaScript, with an account
One header on every request. Swap in the name and value from your account
panel.
<script>
const KV_BASE = "";
const KV_APPKEY = "3cg7aby9";
const KV_HEADERS = { "x-yourapp-token": "kv_your_secret_value" };
async function getValue(key) {
const res = await fetch(`${KV_BASE}/api/v2/appkeys/${KV_APPKEY}/keys/${key}`, { headers: KV_HEADERS });
return res.ok ? (await res.json()).value : null;
}
async function setValue(key, value) {
const res = await fetch(`${KV_BASE}/api/v2/appkeys/${KV_APPKEY}/keys/${key}`, {
method: "PUT",
headers: { ...KV_HEADERS, "Content-Type": "application/json" },
body: JSON.stringify({ value })
});
return res.ok;
}
async function increment(key, by = 1) {
const res = await fetch(`${KV_BASE}/api/v2/appkeys/${KV_APPKEY}/keys/${key}/increment`, {
method: "POST",
headers: { ...KV_HEADERS, "Content-Type": "application/json" },
body: JSON.stringify({ by })
});
return res.ok ? (await res.json()).value : null;
}
</script>
Leave KV_HEADERS out entirely and the same code works against an
anonymous app key.