rebase.energy

Authentication

Send an API key with the ApiKey scheme, bound to one workspace.

Every request carries an API key in the Authorization header using the ApiKey scheme. Note that this is not Bearer.

Authorization: ApiKey rbk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Keys

  • Keys are created in the app under Settings → API keys. The full token is shown once at creation; only its prefix and last 4 characters are visible afterwards, so store it somewhere safe immediately.
  • A key is bound to one workspace and can never see another workspace's data. There is no workspace parameter anywhere in the API: the key decides.
  • A key acts with its owner's permissions, optionally restricted to a smaller scope set at creation. See Permissions for which permission each kind of call needs.
StatusMeaning
401The key is missing or invalid.
403The key is valid but lacks a permission the endpoint requires.

Verify your key

A good first call is the object type catalog. It needs no parameters and confirms both that the key is accepted and which workspace it belongs to.

import os

import requests

BASE = "https://api-v3.rebase.energy/platform/v3"
HEADERS = {"Authorization": f"ApiKey {os.environ['REBASE_API_KEY']}"}

r = requests.get(f"{BASE}/objects", headers=HEADERS)
r.raise_for_status()
print("object types:", [t["name"] for t in r.json()["items"]])
object types: ['sites', 'assets']

A workspace with custom object types lists those too. Each entry carries the type's attributes, which is where you see how its records relate to others.

Shared setup

Every other code example in these guides assumes the BASE and HEADERS variables defined above are already in scope. Put your key in the REBASE_API_KEY environment variable rather than in source.

On this page