cURL
curl --request POST 'https://api.integrateledger.com/v1/licenses' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"customerId":"user_123","planId":"seat","seats":5}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.setLicenseSeats({ idempotencyKey: "seats_123", body: { customerId: "user_123", planId: "seat", seats: 5 } });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.set_license_seats(customer_id="user_123", plan_id="seat", seats=5, idempotency_key="seats_123"){
"itemChangeId": 123,
"status": "applied",
"paymentUrl": "<string>",
"license": {
"planId": "<string>",
"parentPlanId": "<string>",
"seats": 123,
"includedSeats": 1,
"assigned": 1,
"available": 1,
"assignments": [
{
"slot": 123,
"entityId": "<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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"error": "payload_too_large",
"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": "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."
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}Licenses
Set the seat count
Raise or lower the seats of a license the customer bought.
POST
/
v1
/
licenses
cURL
curl --request POST 'https://api.integrateledger.com/v1/licenses' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"customerId":"user_123","planId":"seat","seats":5}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.setLicenseSeats({ idempotencyKey: "seats_123", body: { customerId: "user_123", planId: "seat", seats: 5 } });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.set_license_seats(customer_id="user_123", plan_id="seat", seats=5, idempotency_key="seats_123"){
"itemChangeId": 123,
"status": "applied",
"paymentUrl": "<string>",
"license": {
"planId": "<string>",
"parentPlanId": "<string>",
"seats": 123,
"includedSeats": 1,
"assigned": 1,
"available": 1,
"assignments": [
{
"slot": 123,
"entityId": "<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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"error": "payload_too_large",
"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": "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."
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}{
"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.",
"assigned": 1,
"itemChangeId": 123
}Sets the total seats of the customer’s license of the seat plan
planId, included seats counted, and needs an Idempotency-Key. Raising bills the paid seats added on the seat price, prorated to the period end, on its own invoice; the seats are added once it’s paid, and a new seat’s holder gets the seat plan’s allowance for what was left of the period. Lowering is scheduled for the period end, whose renewal bills fewer, and never goes below the assigned seats (409 seats_assigned). The same total, and seats that cost nothing, bill nothing.
The answer is { itemChangeId, status, paymentUrl, license }: applied, scheduled, pending_payment (pay at paymentUrl), processing (retry with the same key) or closed. See Seats and licenses.
Needs the Billing permission.Authorizations
Headers
Body
application/json
Response
The seat change: applied (the license holds the new total), waiting on payment, or still settling. A raise bills the paid seats added on the seat price, a credit at the old paid seats and a charge at the new, prorated to the period end.
applied: the license holds the new total. pending_payment: the invoice needs the customer at paymentUrl, and nothing changes until it's paid. processing: Stripe is still settling it; retry with the same key. closed: the invoice was voided and nothing changed.
Available options:
applied, pending_payment, processing, closed