billing
Record usage (public)
Record metered usage for a customer (e.g. api_calls, storage_mb). Used for usage-based billing. Public endpoint; optionally secured by webhook or API key in production.
POST
/api/billing/public/projects/{projectId}/usageAuthentication
Public — No Auth Required
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Project ID (MongoDB ObjectId) for the billing project. |
Request Body
Customer email, metric name (e.g. api_calls, storage_mb), and quantity to record.
json
{
"email": "amari_koss69@northwind.dev",
"metric": "program quantify",
"quantity": 195.84
}{
"email": "amari_koss69@northwind.dev",
"metric": "program quantify",
"quantity": 195.84
}SDK setup
Create a client instance. No authentication is required for this endpoint.
import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const result = await client.billing.recordUsage({
projectId: "proj_nCBo0AB7UWpj",
email: "melanie_mckenzie@northwind.dev",
metric: "program reboot",
quantity: 515.63
});const result = await client.billing.recordUsage({
projectId: "proj_nCBo0AB7UWpj",
email: "melanie_mckenzie@northwind.dev",
metric: "program reboot",
quantity: 515.63
});Try It Live
Test this endpoint with your own credentials. Your requests will be sent to the live API.
No Request Yet
Send a request to see the full inspector
Responses
200Usage recorded
json
{
"message": "Usage recorded successfully"
}{
"message": "Usage recorded successfully"
}400Bad request or validation error.
401Authentication required or invalid token.
403Access denied or insufficient permissions.
Errors
| Code | Meaning |
|---|---|
400 | Bad request or validation error. |
401 | Authentication required or invalid token. |
403 | Access denied or insufficient permissions. |