Send metered usage to SaaSify so the cloud marketplace bills the buyer for pay-as-you-go consumption.
Base URLs: https://api.saasify.ai (production). Test against
https://api-demo.saasify.ai (demo). See Environments.
Before you start
You need: an authenticated service user with a role that can post usage, an active subscription, and the meter (dimension) names configured for its plan.
How metering works
For usage-based pricing, the marketplace doesn't know how much a buyer consumed — your application does. You measure consumption against the plan's meters (dimensions) and report it to SaaSify, which forwards it to the right cloud so it appears on the buyer's bill. For the concept and how each cloud meters, see Metering and usage.
The usual loop is:
- Look up the meters for the subscription's plan.
- Measure usage in your app over a billing window.
- Post the usage for each meter.
- Confirm it posted (or handle a failure).
Find the meters for a subscription
Before posting, get the meter names you can report against:
GET /api/subscriptions/{subscriptionID}/meters— meters configured for a subscription.GET /api/subscriptions/metersbyplan— meters available on a plan.
Post usage
Post a usage quantity for a subscription and meter. The canonical single-record endpoint is:
POST /api/subscriptions/{subscriptionID}/usageA usage record identifies the meter (dimension), the quantity consumed, and the time it applies to.
curl -X POST https://api-demo.saasify.ai/api/subscriptions/SUBSCRIPTION_ID/usage \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"DimensionName": "api_calls",
"Quantity": 1500,
"UsageTime": "2026-12-04T00:00:00Z"
}'import requests
r = requests.post(
f"{BASE}/api/subscriptions/{sub_id}/usage",
headers={"Authorization": f"Bearer {token}"},
json={"DimensionName": "api_calls", "Quantity": 1500,
"UsageTime": "2026-12-04T00:00:00Z"},
)
payload = r.json()
if payload["Status"] != "SUCCESS":
raise RuntimeError(payload.get("ErrorMessage"))const r = await fetch(`${BASE}/api/subscriptions/${subId}/usage`, {
method: "POST",
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({
DimensionName: "api_calls",
Quantity: 1500,
UsageTime: "2026-12-04T00:00:00Z",
}),
});
const payload = await r.json();
if (payload.Status !== "SUCCESS") throw new Error(payload.ErrorMessage);var body = new StringContent(
"{\"DimensionName\":\"api_calls\",\"Quantity\":1500,\"UsageTime\":\"2026-12-04T00:00:00Z\"}",
System.Text.Encoding.UTF8, "application/json");
var resp = await client.PostAsync($"/api/subscriptions/{subId}/usage", body);Posting from a CRM or external billing source has a parallel V2 endpoint that takes an origin (such as the system you post from):
POST /api/v2/subscriptions/{origin}/usagepost
GET /api/v2/subscriptions/{origin}/usagepost/{subscriptionId} # read what was postedSee the API reference for the exact V1 vs V2 shapes and choose one for your integration.
Post usage in bulk
To upload many records at once rather than one call per record, use the batch endpoints:
POST /api/batchusage/bulkupload— submit a batch; this creates a job.GET /api/batchusage/joblog— list batch jobs and their status.GET /api/batchusage/{jobLogID}/usagehistory— see the per-record result of one job.
Batch upload is asynchronous: submit, then poll the job log (gently — see Rate limits) until the job completes, and read the usage history to find any rejected rows.
Confirm it posted
Read back what SaaSify recorded:
GET /api/subscriptions/subscriptionmeteredusage/{subscriptionId}— metered usage recorded for a subscription.
A usage post can succeed into SaaSify but still be rejected later by the cloud. SaaSify raises a UsagePostingFailed event you can subscribe to — see Webhooks.
Per-cloud notes
Usage is forwarded to AWS Marketplace metering. AWS has a dedicated meter-post path (api/aws/postmeterusage) in addition to the subscription usage endpoint. AWS meters by dimension; report against the dimension names configured on the plan.
Usage is forwarded to the Microsoft commercial marketplace metered-billing API. Report against the plan's dimensions. Microsoft rejects usage posted outside the allowed reporting window, so post promptly for each hour/period.
Usage is forwarded to Google Cloud Marketplace usage reporting. You can read posting transactions with GET /api/subscriptions/transactions/gcp/{subscriptionId}.