> For the complete documentation index, see [llms.txt](https://developer.switchmarket.se/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.switchmarket.se/metering-api/overview.md).

# Overview

The Metering API is the interface for time-series metering data. It lets you ingest meter readings, query historical and aggregated readings, and read the meter and register catalog your organization is entitled to.

This section describes how to use the Metering API and its resources. If you have any questions or run into trouble, contact [Switch support](mailto:support@switchmarket.se).

## API endpoint

The Metering API is available on two environments, **Test** and **Production**. Use the hostname for the environment you are working against:

| Environment | Hostname                      |
| ----------- | ----------------------------- |
| Production  | `metering.switchmarket.se`    |
| Test        | `qa-metering.switchmarket.se` |

{% code title="Example request" %}

```bash
curl https://metering.switchmarket.se/api/v2/meter \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```

{% endcode %}

{% hint style="warning" %}
Test and Production may run the same version of the API or different ones. Most of the time Test runs a newer version, with new functionality, optimizations or fixes that have not reached Production yet.
{% endhint %}

## API versioning

Every endpoint is versioned, and the version is part of the URL path:

```
https://{HOSTNAME}/api/v2/...
```

**The version segment is required.** There is no unversioned form of any endpoint — a request without it does not reach the API at all.

The current and **recommended** version is **v2**.

## What you can do

* **Ingest readings** — send time-series readings for the registers your organization is entitled to write to.
* **Query readings** — read raw readings, periodic and hourly averages, and the most recent reading for a register over a time range.
* **Read the catalog** — list the meters and registers your organization is entitled to, including virtual register definitions.

You only ever see meters your organization has been granted access to. A request naming a meter you are not entitled to is refused rather than returned empty — see [Errors](/metering-api/errors.md).

If you send readings to the Switch API today, see [Migrating from the Switch API](/metering-api/migrating-from-the-switch-api.md).

{% hint style="info" %}
Reading values are **interval-based**: every reading describes a period (`periodFrom` → `periodTo`), never a single instant. See [Concepts](/metering-api/concepts.md) for the data model and the behavior worth knowing before you build against it.
{% endhint %}
