cURL
curl --request POST 'https://api.integrateledger.com/v1/accounts' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"accountId":"acme","name":"Acme","addCustomerIds":["acme-us","acme-eu"]}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.saveAccount({ accountId: "acme", name: "Acme", addCustomerIds: ["acme-us", "acme-eu"] });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.save_account(account_id="acme", name="Acme", add_customer_ids=["acme-us", "acme-eu"]){
"accountId": "<string>",
"name": "<string>",
"customerIds": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "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>"
}
],
"customerId": "<string>",
"accountId": "<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>"
}
],
"customerId": "<string>",
"accountId": "<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>"
}
],
"customerId": "<string>",
"accountId": "<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>"
}
],
"customerId": "<string>",
"accountId": "<string>"
}{
"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.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"customerId": "<string>",
"accountId": "<string>"
}Accounts
Create or update an account
Group customers that are one business, rename the group, or move customers in and out.
POST
/
v1
/
accounts
cURL
curl --request POST 'https://api.integrateledger.com/v1/accounts' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"accountId":"acme","name":"Acme","addCustomerIds":["acme-us","acme-eu"]}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.saveAccount({ accountId: "acme", name: "Acme", addCustomerIds: ["acme-us", "acme-eu"] });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.save_account(account_id="acme", name="Acme", add_customer_ids=["acme-us", "acme-eu"]){
"accountId": "<string>",
"name": "<string>",
"customerIds": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "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>"
}
],
"customerId": "<string>",
"accountId": "<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>"
}
],
"customerId": "<string>",
"accountId": "<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>"
}
],
"customerId": "<string>",
"accountId": "<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>"
}
],
"customerId": "<string>",
"accountId": "<string>"
}{
"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.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"customerId": "<string>",
"accountId": "<string>"
}Creates the account with your
accountId if it doesn’t exist, else updates it:
namesets its label.nullclears it; omit it to keep it.addCustomerIdsadds customers,removeCustomerIdstakes them out, at most 100 IDs each. A customer in both lists is400 invalid_request. Adding a customer already in the account, or removing one that isn’t in it, changes nothing.- A customer in another account is refused with
409 customer_in_other_account, with that account inaccountId, unlessmoveistrue, which moves it. - An unknown customer in
addCustomerIdsreturns404 customer_not_found, with its ID incustomerId.
customerIds sorted.
Accounts are display only: no customer’s plans, balance or invoices change. Needs the Customers permission at Write.Authorizations
Body
application/json