Query User History Limit Metric By Invoice (History Query Mode, limit_metered and limit_recurring only)
curl --request GET \
--url https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice', 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.unibee.dev/merchant/metric/user/history/metric_by_invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice")
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{
"code": 123,
"data": {
"isLatestPaidInvoice": true,
"userHistoryMetric": {
"invoiceId": "<string>",
"limitStats": [
{
"maxEventId": 123,
"metricLimit": {
"MerchantId": 123,
"MetricId": 123,
"PlanLimits": [
{
"createTime": 123,
"gmtModify": 123,
"id": 123,
"merchantId": 123,
"merchantMetric": {
"aggregationProperty": "<string>",
"aggregationType": 123,
"archived": true,
"carryoverProrationEnabled": true,
"code": "<string>",
"createTime": 123,
"gmtModify": 123,
"id": 123,
"merchantId": 123,
"metaData": {},
"metricDescription": "<string>",
"metricName": "<string>",
"prorationRefundEnabled": true,
"type": 123,
"unit": "<string>"
},
"metricId": 123,
"metricLimit": 123,
"planId": 123,
"quantity": 123
}
],
"TotalLimit": 123,
"UserId": 123,
"aggregationProperty": "<string>",
"aggregationType": 123,
"code": "<string>",
"metricName": "<string>",
"quotaAdjustments": [
{
"adjustmentTime": 123,
"id": 123,
"merchantMemberEmail": "<string>",
"merchantMemberId": 123,
"previousPeriodLimit": 123,
"previousPeriodUsed": 123,
"quotaAmount": 123,
"quotaType": "<string>",
"reason": "<string>"
}
],
"type": 123
},
"minEventId": 123,
"totalLimit": 123,
"usedValue": 123
}
]
}
},
"merchantId": 123,
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}User Metric
Query User History Limit Metric By Invoice (History Query Mode, limit_metered and limit_recurring only)
GET
/
merchant
/
metric
/
user
/
history
/
metric_by_invoice
Query User History Limit Metric By Invoice (History Query Mode, limit_metered and limit_recurring only)
curl --request GET \
--url https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice', 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.unibee.dev/merchant/metric/user/history/metric_by_invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice")
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{
"code": 123,
"data": {
"isLatestPaidInvoice": true,
"userHistoryMetric": {
"invoiceId": "<string>",
"limitStats": [
{
"maxEventId": 123,
"metricLimit": {
"MerchantId": 123,
"MetricId": 123,
"PlanLimits": [
{
"createTime": 123,
"gmtModify": 123,
"id": 123,
"merchantId": 123,
"merchantMetric": {
"aggregationProperty": "<string>",
"aggregationType": 123,
"archived": true,
"carryoverProrationEnabled": true,
"code": "<string>",
"createTime": 123,
"gmtModify": 123,
"id": 123,
"merchantId": 123,
"metaData": {},
"metricDescription": "<string>",
"metricName": "<string>",
"prorationRefundEnabled": true,
"type": 123,
"unit": "<string>"
},
"metricId": 123,
"metricLimit": 123,
"planId": 123,
"quantity": 123
}
],
"TotalLimit": 123,
"UserId": 123,
"aggregationProperty": "<string>",
"aggregationType": 123,
"code": "<string>",
"metricName": "<string>",
"quotaAdjustments": [
{
"adjustmentTime": 123,
"id": 123,
"merchantMemberEmail": "<string>",
"merchantMemberId": 123,
"previousPeriodLimit": 123,
"previousPeriodUsed": 123,
"quotaAmount": 123,
"quotaType": "<string>",
"reason": "<string>"
}
],
"type": 123
},
"minEventId": 123,
"totalLimit": 123,
"usedValue": 123
}
]
}
},
"merchantId": 123,
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Endpoint Overview
GEThttps://api.unibee.dev/merchant/metric/user/history/metric_by_invoice
Query User History Limit Metric By Invoice (History Query Mode, limit_metered and limit_recurring only)
Authorization
All UniBee Merchant API requests require authentication via API key.| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <your_api_key> |
Content-Type | Yes | application/json (for request body) |
Parameters
Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
invoiceId | string | Yes | The unique id of invoice |
Request examples
cURL
curl -X GET "https://api.unibee.dev/merchant/metric/user/history/metric_by_invoice" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Sandbox
curl -X GET "https://api-sandbox.unibee.top/merchant/metric/user/history/metric_by_invoice" \
-H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
-H "Content-Type: application/json"
Response
Success responses return a JSON envelope withcode, data, message, redirect, and requestId. code 0 indicates success.
| Field | Type | Description |
|---|---|---|
code | integer | Response code. 0 = success |
data | object | Response payload |
data.isLatestPaidInvoice | boolean | True when current-metric path was used (queried invoice is the subscription’s latest paid invoice), false when snapshot or history path was used |
data.userHistoryMetric | object | |
message | string | Human-readable message |
requestId | string | Request ID for support |
Error handling
| HTTP status | Meaning |
|---|---|
| 400 | Bad request — invalid or missing parameters. Check message in the body. |
| 401 | Unauthorized — missing or invalid API key. |
| 404 | Not found — invalid path or resource. |
| 500 | Server error — retry with backoff. |
code in the response body is non-zero, check message for details. Use requestId when contacting support.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
The unique id of invoice
⌘I

