Skip to main content

Metrics API v1

Introduction

This reference is your key to a comprehensive understanding of the Batu Metrics API.
❗ You need an integration token to interact with the Batu Metrics API. Contact us to request your integration key.

Conventions

The base URL to send all API requests is https://production.batuenergy.com and https://sandbox.batuenergy.com. HTTPS is required for all API requests. The Batu API follows RESTful conventions when possible, with most operations performed via GETPOSTPUT, and DELETE requests on page and database resources. Request and response bodies are encoded as JSON. JSON CONVENTIONS
  • JSend convention is used for responses.
  • Top-level resources have an "object" property. This property can be used to determine the type of the resource (e.g. "asset""metrics", etc.)
  • Top-level resources are addressable by a UUIDv4 "id" property. You may omit dashes from the ID when making requests to the API.
  • Uri paths and methods are in kebab-case(not camelCase or snake_case ).
  • Resource properties are in camelCase (not kebab-caseor snake_case ).
  • Temporal values (dates and datetimes) are encoded in ISO 8601 strings. Datetimes will include the time value (2020-08-12T02:12:33.231Z) while dates will include only the date (2020-08-12)
  • The Batu API does not support empty strings. To unset a string value for properties use an explicit null instead of "".

Code samples & SDKs

Samples requests and responses are shown for each endpoint. Requests are shown using cURL. These samples make it easy to copy, paste, and modify as you build your integration.

Pagination

Endpoints that return lists of objects support cursor-based pagination requests. By default, Batu returns up to 100 items per API call. If the number of items in a response from a support endpoint exceeds the default, then an integration can use pagination to request a specific set of the results and/or to limit the number of returned items.**** RESPONSES
FieldTypeDescription
has_morebooleanWhether the response includes the end of the list. false if there are no more results. Otherwise, true.
next_cursorstringA string that can be used to retrieve the next page of results by passing the value as the start_cursor parameter to the same endpoint. Only available when has_more is true.
object"list"The constant string "list".
resultsarray of objectsThe list, or partial list, of endpoint-specific results.

Request Limits

To ensure a consistent developer experience for all API users, the Batu API is rate limited and basic size limits apply to request parameters.

Rate Limits

Rate-limited requests will return a "rate_limited" error code (HTTP response status 429). The rate limit for incoming requests per integration is an average of three requests per second. Some bursts beyond the average rate are allowed.
Rate limits may changeIn the future, we plan to adjust rate limits to balance for demand and reliability. We may also introduce distinct rate limits for workspaces in different pricing plans.

Status Codes

As per JSend, HTTP response codes are used to indicate general classes of success, failure, and error.

Success Code

HTTP Status QuoteDescription
200Successfully processed request.

Fail Codes

Fail responses contain more detail about the failure in the request body.
HTTP Status QuoteDescription
400Failed request body or parameters.

Error Codes

Error responses contain more detail about the error in the processing of the request.
HTTP Status QuoteDescription
500Error in the processing of request.

Versioning

Our API versions are named after each major release. For example, our latest version is v0-1. Set version via the URL:
curl https://production.batuenergy.com/**v1**/asset/e79a0b74-3aba-4149-9f74-0bb5791a6ee6
  -H "Authorization: Bearer secret_t1CdN9S8yicG5eWLUOfhcWaOscVnFXns"

Sandbox

For each version of the api there is a sandbox environment with mock responses. Set sandbox via subdomain:
curl https://**sandbox**.batuenergy.com/**v1**/asset/e79a0b74-3aba-4149-9f74-0bb5791a6ee6
  -H "Authorization: Bearer secret_t1CdN9S8yicG5eWLUOfhcWaOscVnFXns"

Entities

Refers to any object with which you can interact through this API.

Assets

Refers to any entity that reports metrics records.

All assets

These fields are shared by all assets. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object: assetAlways “asset”"asset"
id*string(UUID)Unique identifier for this asset."ast_e79a0b74-3aba-4149-9f74-0bb5791a6ee6"
createdAt*datetimedatetime of creation2024-08-12T02:12:33.231Z
updatedAt*datetimedatetime of update2024-08-12T03:12:33.231Z
name*stringAsset’s name"smart meter A012345"
make*string (UUID)Asset’s make id"mke_ba3eb8ca-be65-44d1-8997-762c1993add9"
metrics*string(UUID)Asset’s metrics ids["mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10","mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10" ,"mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10"]
metadata*stringAsset’s metadata"{'key':'value', ...,}"

Example

{
  "type": "asset",
  "asset": {
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "id": "ast_e79a0b74-3aba-4149-9f74-0bb5791a6ee6",
    "name": "smart meter A012345",
    "make": "mke_ba3eb8ca-be65-44d1-8997-762c1993add9",
    "metrics": [
      "mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10",
      "mtc_0427865e-6b00-4deb-bb9e-6663b54f2952",
      "mtc_e3f61c00-d837-4bd6-8c9d-45dfdbbf93fe"
    ],
    "metadata": "{'key':'value', ...,}"
  }
}

Make

Refers to the manufacturer and model of the asset. This defines the abstraction of the collection of particular logics needed for connecting to the asset’s data source.

All makes

These fields are shared by all makes. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object: makeAlways “make”"make"
id*string(UUID)Unique identifier for this make."mke_ba3eb8ca-be65-44d1-8997-762c1993add9"
type*string(Enum)Type of the asset. Possible values are : "METER" , "SOLAR INVERTER" , "BATTERY" , "EV""METER"
createdAt*datetimedatetime of creation2024-08-12T02:12:33.231Z
updatedAt*datetimedatetime of update2024-08-12T03:12:33.231Z
brand*stringMake’s brand"ACME inc."
model*stringMake’s model"smart meter A012345"
version*stringMake’s version"1.1.1"
integrations *array:string (UUID)Make’s associated integrations["int_6dffa5c7-1e08-4dce-86bd-a203406a89f6", "int_7255dfaf-3000-4004-bbc7-4aa50eba6406"]
metadata*stringMake’s metadata”"{'key':'value', ...,}"

Example

{
  "type": "make",
  "make": {
    "id": "mke_ba3eb8ca-be65-44d1-8997-762c1993add9",
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "type": "METER",
    "brand": "ACME inc.",
    "model": "smart meter",
    "version": "1.1.1",
    "integrations": [
      "int_6dffa5c7-1e08-4dce-86bd-a203406a89f6",
      "int_7255dfaf-3000-4004-bbc7-4aa50eba6406"
    ],
    "metadata": "{'key':'value', ...,}"
  }
}

Integration

Refers to the Integration associated with the make. This entity specifies the protocol and characteristics of the way the connection to the data source is established.

All integrations

These fields are shared by all schemas. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object:schemaAlways “schema”"schema"
id*string(UUID)unique identifier for this make."int_6dffa5c7-1e08-4dce-86bd-a203406a89f6"
createdAt*datetimedatetime of creation2024-08-12T02:12:33.231Z
updatedAt*datetimedatetime of update2024-08-12T03:12:33.231Z
name*stringname of the integration"smart meter v1.1.1 API integration"
protocol*string (Enum)communications protocol used by the connection: HTTP, Modbus, BACnet, MQTT, websocket , QueryHTTP
type *string (Enum)type of connection established by the integration: pull or pushpull
specs*array: specssupported specifications for granularity, which is the resolution of each data point, range, which is the maximum size of the time window of data that can be retrieved for said granularity, schedule, which is the possible schedules of invocation, defined as a cron expression, and shift, which is a boolean that describes if time shifting is supported ( e.g. 1m, 5m, etc.).[{ "granularity": "1m", "range": "1mo", "schedule": "* * * * *", "shift": true }, {"granularity": "5m", "range": "1mo", "schedule" : "* * * * *", "shift": true}]
metadata*stringIntegration’s metadata"{'key':'value', ...,}"

Example

{
  "type": "integration",
  "schema": {
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "id": "int_6dffa5c7-1e08-4dce-86bd-a203406a89f6",
    "name": "smart meter v1.1.1 API integration",
    "protocol": "HTTP",
    "type": "pull",
    "specs": [
      [
        {
          "granularity": "1m",
          "range": "1mo",
          "schedule": "* * * * *",
          "shift": true
        },
        {
          "granularity": "5m",
          "range": "1mo",
          "schedule": "* * * * *",
          "shift": true
        }
      ]
    ],
    "metadata": "{'key':'value', ...,}"
  }
}

Metrics

Refers to the monitored variables and the way they are processed from the asset’s data source. This defines the abstraction of the particular logic needed for ingesting data from the asset’s data source.

All metrics

These fields are shared by all metrics. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object:metricAlways “metric”"metric"
id*string(UUID)Unique identifier for this metric."mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10"
createdAt*datetimedatetime of creation2024-08-12T02:12:33.231Z
updatedAt*datetimedatetime of update2024-08-12T03:12:33.231Z
processes *array:string(UUID)ids of the processes associated to the metric["prc_1447e4ad-4370-4162-80e1-e52098bcb1ed", "prc_ea4f4dbd-a5f9-445d-88f8-9640cfdd0e7a"]
name *stringDescriptor of the metric to be ingested“Powerplant Demand”
variable *string(Enum)Type of physical variable being observed“demand”
units*string(Enum)physical units“W”
type *string(Enum)Data Type for the associated metric. STRING, NUMBER, or, BOOLEAN.“NUMBER”
metadata*stringMetric’s metadata”"{'key':'value', ...,}"

Example

{
  "type": "metric",
  "metric": {
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "id": "mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10",
    "processes": [
      "prc_1447e4ad-4370-4162-80e1-e52098bcb1ed",
      "prc_ea4f4dbd-a5f9-445d-88f8-9640cfdd0e7a"
    ],
    "name": "Assembly line 1 demand",
    "variable": "power",
    "units": "W",
    "type": "NUMBER",
    "metadata": "{'key':'value', ...,}"
  }
}

Process

Refers to how the metric is to be processed and stored by the ingestion logic. The way a metric is to be extracted/calulated from an integration

All processes

These fields are shared by all processes. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object:processAlways “process”"process"
id*string(UUID)Unique identifier for this process."prc_1447e4ad-4370-4162-80e1-e52098bcb1ed"
createdAtdatetimedatetime of creation.2024-08-12T02:12:33.231Z
updatedAtdatetimedatetime of update.2024-08-12T03:12:33.231Z
integration *string (UUID)id associated with the integration to be used for the process."int_6dffa5c7-1e08-4dce-86bd-a203406a89f6"
metric *string (UUID)id associated with the metric that is to be created by the process."mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10"
formula*stringA representation of the operations to be performed to obtain the value given the reference keys ."[NODE 1 A] + [NODE 1 B]"
keys*array:stringThe keys of the data source from which values are to be retrieved.["NODE 1 A", "NODE 1 B"]
metadata*stringprocess’s metadata”"{'key':'value', ...,}"

Example

{
  "type": "process",
  "process": {
    "id": "prc_1447e4ad-4370-4162-80e1-e52098bcb1ed",
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "integration": "int_6dffa5c7-1e08-4dce-86bd-a203406a89f6",
    "metric": "mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10",
    "formula": "[NODE 1 A] + [NODE 1 B]",
    "keys": ["NODE 1 A", "NODE 1 B"],
    "metadata": "{'key':'value', ...,}"
  }
}

Job

Refers to an instance of execution of a process, with a defined granularity and time window.

All jobs

These fields are shared by all jobs. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object:jobAlways “job”"job"
id*string(UUID)Unique identifier for the associated metric."job_ed6ea71e-5acd-4eec-af3d-8cc1c36ecc6d"
createdAt *datetimedatetime of creation.2024-08-12T02:12:33.231Z
updatedAt *datetimedatetime of update.2024-08-12T03:12:33.231Z
process*string(UUID)process associated with the job"prc_1447e4ad-4370-4162-80e1-e52098bcb1ed"
startTs*numberstart of time window for data retrieval specified for each invocation of the process, specified as Unix epoch timestamp.1727220000
endTs*numberend of time window for data retrieval specified for each invocation of the process, specified as Unix epoch timestamp.1727220785
shift*stringshift in time for data retrieval specified for each invocation of the process, specified as a time interval, default 0. e.g. 1m, 2m, etc."0"
granularity *stringgranularity for data retrieval specified for each invocation of the process, specified as a time interval"5m"
status *string (Enum)status of job execution: success, queued, canceled, in progress, fail."success"
metadata*stringjob ’s metadata"{'key':'value', ...,}"

Example

{
  "type": "job",
  "job": {
    "id": "job_ed6ea71e-5acd-4eec-af3d-8cc1c36ecc6d",
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "process": "prc_1447e4ad-4370-4162-80e1-e52098bcb1ed",
    "startTs": "1727220000",
    "endTs": "1727220785",
    "shift": "0",
    "granularity": "5m",
    "status": "success",
    "metadata": "{'key':'value', ...,}"
  }
}

Job Schedule

Refers to a schedule for job creation and execution.

All job schedules

These fields are shared by all job schedules. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object:scheduleAlways “schedule”"schedule"
id*string(UUID)Unique identifier for the associated metric."sch_3fd973a8-b1d3-4cd2-9487-db3e60ef3e96"
createdAt *datetimedatetime of creation.2024-08-12T02:12:33.231Z
updatedAt *datetimedatetime of update.2024-08-12T03:12:33.231Z
process*string(UUID)process associated with the job"prc_1447e4ad-4370-4162-80e1-e52098bcb1ed"
cron*stringcron expression for the job schedule, that is , the actual schedule in which a job will be created."0 0 * * *"
range*numbertime interval for amount of data to be retrieved by the job."1d"
shift*stringshift in time for data retrieval specified for each invocation of the job, specified as a time interval, default 0. e.g. 1m, 2m, etc."0"
granularity *stringgranularity for data retrieval specified for each invocation of the process, specified as a time interval"5m"
metadata*stringprocess’s metadata”"{'key':'value', ...,}"

Example

{
  "type": "schedule",
  "schedule": {
    "id": "sch_3fd973a8-b1d3-4cd2-9487-db3e60ef3e96",
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "process": "prc_1447e4ad-4370-4162-80e1-e52098bcb1ed",
    "cron": "0 0 * * *",
    "range": "1d",
    "shift": "0",
    "granularity": "5m",
    "metadata": "{'key':'value', ...,}"
  }
}

Metric Record

Refers to a data point of a metric.

All metric records

These fields are shared by all metrics. Fields marked with * are always present.
PropertyTypeDescriptionExample value
object*object:metricRecordAlways “metricRecord”"metricRecord"
id*string(UUID)Unique identifier for the associated metric."mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10"
createdAtdatetimedatetime of creation.2024-08-12T02:12:33.231Z
updatedAtdatetimedatetime of update.2024-08-12T03:12:33.231Z
ts*numberdatetime associated with metric record, expressed as an Unix timestamp1727220785
value*stringvalue associated with metric record."42"

Example

{
  "type": "metricRecord",
  "metricRecord": {
    "createdAt": "2024-08-12T02:12:33.231Z",
    "updatedAt": "2024-08-12T03:12:33.231Z",
    "ts": "1727220785",
    "id": "mtc_ebde8fde-cbe4-43a8-af77-91498a0f8c10",
    "value": "42"
  }
}

Units and Variables reference

CategoryPhysical VariableUnitUnit Symbol
Base SI UnitsLengthmeterm
Masskilogramkg
Timeseconds
Electric currentampereA
Thermodynamic temperaturekelvinK
Amount of substancemolemol
Luminous intensitycandelacd
Derived SI UnitsMechanical
Areasquare meter
Volumecubic meter
Velocitymeter per secondm/s
Accelerationmeter per second squaredm/s²
Wave numberreciprocal meterm⁻¹
Mass densitykilogram per cubic meterkg/m³
Specific volumecubic meter per kilogramm³/kg
Current densityampere per square meterA/m²
Magnetic field strengthampere per meterA/m
Concentrationmole per cubic metermol/m³
Luminancecandela per square metercd/m²
ForcenewtonN
Pressure, stresspascalPa
Energy, work, heatjouleJ
Power, radiant fluxwattW
Moment of forcenewton meterN·m
Surface tensionnewton per meterN/m
Angular velocityradian per secondrad/s
Angular accelerationradian per second squaredrad/s²
Dynamic viscositypascal secondPa·s
Kinematic viscositysquare meter per secondm²/s
Thermodynamic
Temperature (Celsius scale)degree Celsius°C
Heat capacity, entropyjoule per kelvinJ/K
Specific heat capacity, specific entropyjoule per kilogram kelvinJ/(kg·K)
Specific energyjoule per kilogramJ/kg
Thermal conductivitywatt per meter kelvinW/(m·K)
Electromagnetic
Electric chargecoulombC
Electric potential differencevoltV
CapacitancefaradF
Electric resistanceohmΩ
Electric conductancesiemensS
Magnetic fluxweberWb
Magnetic flux densityteslaT
InductancehenryH
Electric field strengthvolt per meterV/m
Permittivityfarad per meterF/m
Permeabilityhenry per meterH/m
Radiation and Radioactivity
Absorbed dosegrayGy
Dose equivalentsievertSv
Activity (of a radionuclide)becquerelBq
Frequency and Rotation
FrequencyhertzHz
Rotational speedrevolutions per minuterpm
Optics
Refractive indexdimensionless
Wavelengthmeter or nanometerm/nm
Photometry
Luminous fluxlumenlm
Illuminanceluxlx
Chemistry
Catalytic activitykatalkat
Dimensionless Units
Plane angleradianrad
Solid anglesteradiansr
Non-SI Units Accepted for Use with SITimeminute, hour, daymin, h, d
Plane angledegree, minute, second°, ′, ″
VolumeliterL or l
Masstonnet
EnergyelectronvolteV
Pressurebarbar