Meters
Get Meter Quantities
Get quantities of a meter over a time period.
Scopes: meters:read meters:write
GET
/
v1
/
meters
/
{id}
/
quantities
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"github.com/web3group/macropay-go-main/types"
"github.com/web3group/macropay-go-main/models/components"
"github.com/web3group/macropay-go-main/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Meters.Quantities(ctx, operations.MetersQuantitiesRequest{
ID: "<value>",
StartTimestamp: types.MustTimeFromString("2025-11-25T04:37:16.823Z"),
EndTimestamp: types.MustTimeFromString("2025-11-26T17:06:00.727Z"),
Interval: components.TimeIntervalDay,
})
if err != nil {
log.Fatal(err)
}
if res.MeterQuantities != nil {
// handle response
}
}import macropay_sdk
from macropay_sdk import Macropay
from macropay_sdk.utils import parse_datetime
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
res = macropay.meters.quantities(id="<value>", start_timestamp=parse_datetime("2026-11-25T04:37:16.823Z"), end_timestamp=parse_datetime("2026-11-26T17:06:00.727Z"), interval=macropay_sdk.TimeInterval.DAY)
# Handle response
print(res)import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await macropay.meters.quantities({
id: "<value>",
startTimestamp: new Date("2026-11-25T04:37:16.823Z"),
endTimestamp: new Date("2026-11-26T17:06:00.727Z"),
interval: "day",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
use Macropay\Models\Components;
use Macropay\Models\Operations;
use Macropay\Utils;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\MetersQuantitiesRequest(
id: '<value>',
startTimestamp: Utils\Utils::parseDateTime('2026-11-25T04:37:16.823Z'),
endTimestamp: Utils\Utils::parseDateTime('2026-11-26T17:06:00.727Z'),
interval: Components\TimeInterval::Day,
);
$response = $sdk->meters->quantities(
request: $request
);
if ($response->meterQuantities !== null) {
// handle response
}curl --request GET \
--url https://api.macropay.ai/v1/meters/{id}/quantities \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/meters/{id}/quantities', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.macropay.ai/v1/meters/{id}/quantities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/meters/{id}/quantities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"quantities": [
{
"timestamp": "2023-11-07T05:31:56Z",
"quantity": 10
}
],
"total": 100
}{
"error": "ResourceNotFound",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
You can generate an Organization Access Token from your organization's settings.
Path Parameters
The meter ID.
Query Parameters
Start timestamp.
End timestamp.
Interval between two timestamps.
Available options:
year, month, week, day, hour Filter by customer ID. The customer ID.
Filter by external customer ID.
If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.
Available options:
count, sum, max, min, avg, unique Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.
Show child attributes
Show child attributes
⌘I
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"github.com/web3group/macropay-go-main/types"
"github.com/web3group/macropay-go-main/models/components"
"github.com/web3group/macropay-go-main/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Meters.Quantities(ctx, operations.MetersQuantitiesRequest{
ID: "<value>",
StartTimestamp: types.MustTimeFromString("2025-11-25T04:37:16.823Z"),
EndTimestamp: types.MustTimeFromString("2025-11-26T17:06:00.727Z"),
Interval: components.TimeIntervalDay,
})
if err != nil {
log.Fatal(err)
}
if res.MeterQuantities != nil {
// handle response
}
}import macropay_sdk
from macropay_sdk import Macropay
from macropay_sdk.utils import parse_datetime
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
res = macropay.meters.quantities(id="<value>", start_timestamp=parse_datetime("2026-11-25T04:37:16.823Z"), end_timestamp=parse_datetime("2026-11-26T17:06:00.727Z"), interval=macropay_sdk.TimeInterval.DAY)
# Handle response
print(res)import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await macropay.meters.quantities({
id: "<value>",
startTimestamp: new Date("2026-11-25T04:37:16.823Z"),
endTimestamp: new Date("2026-11-26T17:06:00.727Z"),
interval: "day",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
use Macropay\Models\Components;
use Macropay\Models\Operations;
use Macropay\Utils;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\MetersQuantitiesRequest(
id: '<value>',
startTimestamp: Utils\Utils::parseDateTime('2026-11-25T04:37:16.823Z'),
endTimestamp: Utils\Utils::parseDateTime('2026-11-26T17:06:00.727Z'),
interval: Components\TimeInterval::Day,
);
$response = $sdk->meters->quantities(
request: $request
);
if ($response->meterQuantities !== null) {
// handle response
}curl --request GET \
--url https://api.macropay.ai/v1/meters/{id}/quantities \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/meters/{id}/quantities', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.macropay.ai/v1/meters/{id}/quantities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/meters/{id}/quantities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"quantities": [
{
"timestamp": "2023-11-07T05:31:56Z",
"quantity": 10
}
],
"total": 100
}{
"error": "ResourceNotFound",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}