cURL
curl --request GET 'https://api.integrateledger.com/v1/customers/auto-top-up?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.getCustomerAutoTopUp({ customerId: "user_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.get_customer_auto_top_up(customer_id="user_123"){
"customerId": "<string>",
"autoTopUp": {
"source": "customer",
"enabled": true,
"thresholdCredits": 123,
"addOnId": "<string>",
"amountCents": 123,
"credits": 123,
"maxPerPeriod": 123,
"maxAmountCentsPerPeriod": 123
},
"suspended": true,
"coolingDownUntil": "2023-11-07T05:31:56Z",
"recent": [
{
"id": 123,
"trigger": "auto",
"status": "pending",
"failureReason": "<string>",
"credits": 123,
"amountCents": 123,
"stripeInvoiceId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z"
}
]
}{
"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 auto top-up
The auto top-up that applies to a customer, and their recent top-ups.
GET
/
v1
/
customers
/
auto-top-up
cURL
curl --request GET 'https://api.integrateledger.com/v1/customers/auto-top-up?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.getCustomerAutoTopUp({ customerId: "user_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.get_customer_auto_top_up(customer_id="user_123"){
"customerId": "<string>",
"autoTopUp": {
"source": "customer",
"enabled": true,
"thresholdCredits": 123,
"addOnId": "<string>",
"amountCents": 123,
"credits": 123,
"maxPerPeriod": 123,
"maxAmountCentsPerPeriod": 123
},
"suspended": true,
"coolingDownUntil": "2023-11-07T05:31:56Z",
"recent": [
{
"id": 123,
"trigger": "auto",
"status": "pending",
"failureReason": "<string>",
"credits": 123,
"amountCents": 123,
"stripeInvoiceId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z"
}
]
}{
"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."
}The setting that applies, with its
source (customer or plan), what one top-up buys (credits, amountCents), whether failures hold it back (suspended, coolingDownUntil), and the customer’s last 10 top-ups, by hand or automatic. autoTopUp is null when neither the customer nor their plan has one.Authorizations
Query Parameters
Response
The auto top-up that applies, and recent top-ups