cURL
curl --request GET 'https://api.integrateledger.com/v1/customers/controls?customerId=user_123' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.getCustomerControls({ customerId: "user_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.get_customer_controls(customer_id="user_123"){
"customerId": "<string>",
"entityId": "<string>",
"usageLimits": [
{
"interval": "<string>",
"filter": {},
"limit": 123,
"scope": "customer",
"source": "entity",
"used": 123,
"remaining": 123,
"windowStart": "2023-11-07T05:31:56Z",
"resetsAt": "2023-11-07T05:31:56Z",
"featureId": "<string>",
"creditPool": true,
"anchor": "<string>"
}
],
"usageAlerts": [
{
"name": "<string>",
"type": "<string>",
"threshold": 123,
"scope": "customer",
"source": "entity",
"firedAt": "2023-11-07T05:31:56Z",
"featureId": "<string>",
"creditPool": true,
"usageLimit": {
"interval": "<string>",
"filter": {}
}
}
],
"overage": [
{
"allowed": true,
"freeUnits": 123,
"billOverage": true,
"source": "entity",
"billed": 123,
"unbilled": 123,
"freeLeft": 123,
"featureId": "<string>",
"creditPool": true
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Customers
Get a customer's controls
The usage limits, usage alerts and overage controls in force, with their state.
GET
/
v1
/
customers
/
controls
cURL
curl --request GET 'https://api.integrateledger.com/v1/customers/controls?customerId=user_123' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.getCustomerControls({ customerId: "user_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.get_customer_controls(customer_id="user_123"){
"customerId": "<string>",
"entityId": "<string>",
"usageLimits": [
{
"interval": "<string>",
"filter": {},
"limit": 123,
"scope": "customer",
"source": "entity",
"used": 123,
"remaining": 123,
"windowStart": "2023-11-07T05:31:56Z",
"resetsAt": "2023-11-07T05:31:56Z",
"featureId": "<string>",
"creditPool": true,
"anchor": "<string>"
}
],
"usageAlerts": [
{
"name": "<string>",
"type": "<string>",
"threshold": 123,
"scope": "customer",
"source": "entity",
"firedAt": "2023-11-07T05:31:56Z",
"featureId": "<string>",
"creditPool": true,
"usageLimit": {
"interval": "<string>",
"filter": {}
}
}
],
"overage": [
{
"allowed": true,
"freeUnits": 123,
"billOverage": true,
"source": "entity",
"billed": 123,
"unbilled": 123,
"freeLeft": 123,
"featureId": "<string>",
"creditPool": true
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Every entry in force for the customer, or with
entityId for one entity (its own entries first, then the customer’s), each with its source (entity, customer or plan):
usageLimits:usedin the current window (held reservations included),remaining,windowStartandresetsAt.usageAlerts:firedAt, when the alert last fired in its current window, or null.overage: for the credit pool and each metered feature with an overage price or an entry, whether overage isallowed, thefreeUnitsbuffer andfreeLeftthis period,billOverage, and this period’sbilledandunbilledoverage in units (credits for the pool).