rebase.energy

How to create a custom object

Register a new object type beyond the built-in site and asset, then create records of it.

site and asset are built-in object types. Everything else you define yourself — register a type with a name, a plural, and a field schema, and the platform gives it the full set of object routes. The plural becomes the path segment (met-mast/objects/met-masts/...).

  • GET /platform/v3/objects — list registered object types.
  • POST /platform/v3/objects — register a new object type.
  • POST /platform/v3/objects/{object_name} — create a record of that type.
  • GET /platform/v3/objects/{object_name}/{record_id} — fetch a record.

List existing types

import requests

url = "https://api.rebaseenergy.dev/platform/v3/objects"
headers = {"Authorization": "Bearer <your_api_key>"}

response = requests.get(url, headers=headers)
print(response.json())

Out of the box this returns the built-ins:

{
  "items": [
    {"name": "site", "plural": "sites", "description": "A physical location grouping assets."},
    {"name": "asset", "plural": "assets", "description": "A piece of hardware, optionally attached to a site."}
  ]
}

Register a new type

Say you operate meteorological masts and want them as first-class objects. Register the type with its field schema:

import requests

url = "https://api.rebaseenergy.dev/platform/v3/objects"
headers = {"Authorization": "Bearer <your_api_key>"}

body = {
    "name": "met-mast",
    "plural": "met-masts",
    "description": "Meteorological mast carrying wind and temperature sensors.",
    "fields": {
        "height_m": {"type": "number", "required": True},
        "parent_site_id": {"type": "uuid", "required": False},
        "sensor_count": {"type": "integer", "required": False},
    },
}

response = requests.post(url, headers=headers, json=body)
print(response.json())

The new type immediately appears in GET /platform/v3/objects, and the full route set exists under /platform/v3/objects/met-masts/... — create, list, fetch, update, history, and timeseries.

Create a record of the new type

import requests

url = "https://api.rebaseenergy.dev/platform/v3/objects/met-masts"
headers = {"Authorization": "Bearer <your_api_key>"}

body = {
    "name": "Storrun Mast A",
    "height_m": 100,
    "parent_site_id": "4dbb3433-402f-4276-8a55-7f27753f70dc",
    "sensor_count": 4,
}

response = requests.post(url, headers=headers, json=body)
print(response.json())
{
  "id": "7a9e1c20-3b44-4f51-9c2a-1f0d8e6b4455",
  "name": "Storrun Mast A",
  "height_m": 100,
  "parent_site_id": "4dbb3433-402f-4276-8a55-7f27753f70dc",
  "sensor_count": 4,
  "valid_from": "2026-06-03T08:00:00Z"
}

Fetch the record

import requests

mast_id = "7a9e1c20-3b44-4f51-9c2a-1f0d8e6b4455"
url = f"https://api.rebaseenergy.dev/platform/v3/objects/met-masts/{mast_id}"
headers = {"Authorization": "Bearer <your_api_key>"}

response = requests.get(url, headers=headers)
print(response.json())

Any object — built-in or custom — can carry timeseries. See create a timeseries.

Open questions

Type registration via POST /platform/v3/objects is a proposal — today this route is read-only and only site and asset exist. Do we validate records strictly against fields, or store extra keys loosely? Should name and plural be derivable from each other instead of both required?

On this page