Farbeam
Docs / API: Keys

Create an API key

Creates a key and returns it once. Needs a session. An account can hold 5 active keys.

POST/api/v1/keys
PropertyValue
AuthenticationNeeds a wallet session. Sign in at the console.
Rate-limit cost0 units
StatusLive

#Request body

JSON
{
  "label": "my-app"
}

#Request

curl -s -X POST "https://farbeamlabs.com/api/v1/keys" \
  -H "content-type: application/json" \
  -d '{"label": "my-app"}'
const res = await fetch("https://farbeamlabs.com/api/v1/keys", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"label": "my-app"})
});
const { data, meta, error } = await res.json();
if (error) throw new Error(`${error.code}: ${error.message}`);
console.log(data);
import os, requests

res = requests.post(
    "https://farbeamlabs.com/api/v1/keys",
    json={'label': 'my-app'},
    timeout=30,
)
body = res.json()
if "error" in body:
    raise RuntimeError(body["error"]["code"])
print(body["data"])

#Notes

  • Farbeam stores only a SHA-256 hash of the key. A lost key cannot be recovered, so save it when it is shown.

#Errors

HTTPCodeMeaning
401sign_in_requiredSign in with a wallet first.
409key_limitThe account holds 5 active keys.

All errors share one format. See errors.