cURL
curl --request POST 'https://api.integrateledger.com/v1/licenses/assign' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"customerId":"user_123","planId":"seat","entityId":"alice"}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.assignLicenseSeat({ customerId: "user_123", planId: "seat", entityId: "alice" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.assign_license_seat(customer_id="user_123", plan_id="seat", entity_id="alice"){
"planId": "<string>",
"entityId": "<string>",
"slot": 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
}Licenses
Assign a seat
Put an entity in a free seat of a license the customer bought.
POST
/
v1
/
licenses
/
assign
cURL
curl --request POST 'https://api.integrateledger.com/v1/licenses/assign' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"customerId":"user_123","planId":"seat","entityId":"alice"}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.assignLicenseSeat({ customerId: "user_123", planId: "seat", entityId: "alice" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.assign_license_seat(customer_id="user_123", plan_id="seat", entity_id="alice"){
"planId": "<string>",
"entityId": "<string>",
"slot": 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
}Puts the entity in the lowest free seat of the customer’s license of the seat plan
planId, and answers { planId, entityId, slot }. The entity then spends the seat plan’s credits as its own for the rest of the billing period, before the shared pool; the customer and other entities can’t spend them. A seat another entity held earlier this period carries what was left of it, so releasing and assigning again never resets the allowance.
An entity that already holds a seat of this license gets the same seat back, and nothing more is granted. Every seat held: 409 no_seats_available. No live license of the seat plan: 404 license_not_found. An unknown or deleted entity: 404 entity_not_found. Assigning changes nothing the customer pays.
Needs the Billing permission.Authorizations
Body
application/json
Response
The seat the entity holds: a free one now, or the one it already held. Its seat plan's credits and metered allowances are the entity's to spend this period, less what earlier holders spent of this seat.