curl --request POST \
--url https://api.creem.io/v1/meters/preview \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"event_name": "image.generated",
"aggregation": "count",
"aggregation_property": "tokens",
"unit_label": "images"
}
'import requests
url = "https://api.creem.io/v1/meters/preview"
payload = {
"event_name": "image.generated",
"aggregation": "count",
"aggregation_property": "tokens",
"unit_label": "images"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_name: 'image.generated',
aggregation: 'count',
aggregation_property: 'tokens',
unit_label: 'images'
})
};
fetch('https://api.creem.io/v1/meters/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.creem.io/v1/meters/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event_name' => 'image.generated',
'aggregation' => 'count',
'aggregation_property' => 'tokens',
'unit_label' => 'images'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.creem.io/v1/meters/preview"
payload := strings.NewReader("{\n \"event_name\": \"image.generated\",\n \"aggregation\": \"count\",\n \"aggregation_property\": \"tokens\",\n \"unit_label\": \"images\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.creem.io/v1/meters/preview")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event_name\": \"image.generated\",\n \"aggregation\": \"count\",\n \"aggregation_property\": \"tokens\",\n \"unit_label\": \"images\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/meters/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event_name\": \"image.generated\",\n \"aggregation\": \"count\",\n \"aggregation_property\": \"tokens\",\n \"unit_label\": \"images\"\n}"
response = http.request(request)
puts response.read_body{
"matched_events": 137,
"units": "4820",
"distinct_customers": 12,
"daily": [
{
"date": "2026-08-16",
"event_count": 42,
"value": "1280"
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}Preview an unsaved meter definition
Dry-run a candidate meter definition against your real usage over the last 7 whole UTC days (today included, future-dated events excluded) WITHOUT creating anything: matched events, aggregated units, distinct customers, and a zero-filled per-day series, oldest first. Useful for checking a definition before committing to it. The scan is capped defensively and runs newest-first, so a very high-volume store gets the most recent slice of the window rather than an unbounded scan — the recent days stay complete and the oldest day of the series degrades.
curl --request POST \
--url https://api.creem.io/v1/meters/preview \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"event_name": "image.generated",
"aggregation": "count",
"aggregation_property": "tokens",
"unit_label": "images"
}
'import requests
url = "https://api.creem.io/v1/meters/preview"
payload = {
"event_name": "image.generated",
"aggregation": "count",
"aggregation_property": "tokens",
"unit_label": "images"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_name: 'image.generated',
aggregation: 'count',
aggregation_property: 'tokens',
unit_label: 'images'
})
};
fetch('https://api.creem.io/v1/meters/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.creem.io/v1/meters/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event_name' => 'image.generated',
'aggregation' => 'count',
'aggregation_property' => 'tokens',
'unit_label' => 'images'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.creem.io/v1/meters/preview"
payload := strings.NewReader("{\n \"event_name\": \"image.generated\",\n \"aggregation\": \"count\",\n \"aggregation_property\": \"tokens\",\n \"unit_label\": \"images\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.creem.io/v1/meters/preview")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event_name\": \"image.generated\",\n \"aggregation\": \"count\",\n \"aggregation_property\": \"tokens\",\n \"unit_label\": \"images\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/meters/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event_name\": \"image.generated\",\n \"aggregation\": \"count\",\n \"aggregation_property\": \"tokens\",\n \"unit_label\": \"images\"\n}"
response = http.request(request)
puts response.read_body{
"matched_events": 137,
"units": "4820",
"distinct_customers": 12,
"daily": [
{
"date": "2026-08-16",
"event_count": 42,
"value": "1280"
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}Authorizations
API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.
Body
The usage event name the candidate meter would consume
"image.generated"
Aggregation to dry-run
count, sum, average, min, max, unique "count"
Event property the aggregation reduces. Required for every aggregation except "count".
"tokens"
Optional filter to dry-run alongside the aggregation
Show child attributes
Show child attributes
Display unit for the preview. Cosmetic (nothing is persisted); defaults to "units".
"images"
Response
Preview of the candidate definition
Events the meter would count over the preview window
137
Aggregated units over the whole window, as a string for BigInt safety
"4820"
Distinct customers among the matching events
12
The last 7 UTC days (today included), oldest first and zero-filled
Show child attributes
Show child attributes