> ## Documentation Index
> Fetch the complete documentation index at: https://getlago.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Billing entities

> Create and update billing entities with the API, set their invoicing and tax settings, and assign customers to the entity that bills them.

A billing entity is the legal issuer behind your invoices: it holds the legal details, currency, timezone, numbering and tax settings Lago applies to the documents it issues. Use several billing entities when you bill customers from distinct companies or under distinct invoicing configurations.

> [!WARNING]
>
> Creating additional billing entities requires the relevant entitlement. Grace periods, timezones, email settings and periodic invoice settings may require a premium license.

## Create a billing entity

> [tab] Dashboard
>
> 1. Click **Settings** in the side navigation bar.
> 2. In the **Your billing entities** section, click **Add an entity**.
> 3. Enter a **name** and a **unique code** for your billing entity.
> 4. Configure the entity settings as needed.
> 5. Click **Create entity** to confirm.

> [tab] API
>
> ```bash Create a billing entity theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
>
> curl --location --request POST "$LAGO_URL/api/v2/billing_entities" \
>   --header "Authorization: Bearer $API_KEY" \
>   --header 'Content-Type: application/json' \
>   --data-raw '{
>     "billing_entity": {
>       "code": "acme_corp",
>       "name": "Acme Corporation",
>       "default_currency": "USD",
>       "legal_name": "Acme Corporation Inc.",
>       "email": "billing@example.com",
>       "country": "US",
>       "document_numbering": "per_billing_entity",
>       "document_number_prefix": "ACM",
>       "invoice_footer": "Thank you for your business",
>       "tax_codes": []
>     }
>   }'
> ```
>
> Billing configuration fields such as `invoice_footer`, `invoice_grace_period` and `document_locale` are top-level fields. There is no `billing_configuration` object in v2. Unlike v1, `tax_codes` and `invoice_custom_section_codes` can be set at creation.

`code` must be unique among active billing entities.

## Edit a billing entity

You can update every field **except the code**. `PUT` and `PATCH` both accept partial updates. Omitted fields are unchanged. An empty `tax_codes` or `invoice_custom_section_codes` array removes the corresponding assignments.

> [tab] Dashboard
>
> 1. Click **Settings** in the side navigation bar.
> 2. In the **Your billing entities** section, select the relevant billing entity.
> 3. Click any section to edit its settings.

> [tab] API
>
> ```bash Update a billing entity theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
>
> curl --location --request PUT "$LAGO_URL/api/v2/billing_entities/acme_corp" \
>   --header "Authorization: Bearer $API_KEY" \
>   --header 'Content-Type: application/json' \
>   --data-raw '{
>     "billing_entity": {
>       "invoice_footer": "Thank you for your business",
>       "invoice_grace_period": 3
>     }
>   }'
> ```

## Billing entity settings

| Group | Fields |
| - | - |
| Entity details | `name`, `legal_name`, `legal_number`, `tax_identification_number`, `email`, `phone`, `address_line1`, `address_line2`, `city`, `state`, `zipcode`, `country`, `logo` (PNG or JPEG as a base64 data URL) |
| Defaults | `default_currency`, `timezone`, `document_locale` |
| Numbering | `document_numbering` (`per_customer` or `per_billing_entity`), `document_number_prefix` |
| Invoicing | `invoice_footer`, `invoice_grace_period`, `finalize_zero_amount_invoice`, `periodic_invoice_issuing_date_anchor` (`current_period_end` or `next_period_start`), `periodic_invoice_issuing_date_adjustment` (`keep_anchor` or `align_with_finalization_date`) |
| Taxes | `tax_codes`, `eu_tax_management` |
| Documents | `invoice_custom_section_codes`, `einvoicing`, `email_settings` (enabled email notification types) |

The response adds `lago_id`, `is_default` (whether this is the organization default), `logo_url` and `archived_at`. Request `taxes` or `selected_invoice_custom_sections` with `expands[]`.

## Retrieve and list billing entities

* `GET /billing_entities` lists active billing entities only. It is cursor-paginated.
* `GET /billing_entities/{code}` returns the active entity with that code, or an archived one if no active entity has it.

## Archive a billing entity

The API has no archive or delete operation for billing entities. Contact the Lago team to archive one.

## Assign a billing entity to a customer

Pass `billing_entity_code` when you [create or update a customer](https://getlago.com/docs/v2/guide/customers/customer-management.md). The customer list filters on `billing_entity_codes[]`, and the contract list filters on `billing_entity_ids[]`.

```bash Assign a customer to acme_corp theme={"dark"}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request PUT "$LAGO_URL/api/v2/customers/customer_example" \
  --header "Authorization: Bearer $API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "customer": {
      "billing_entity_code": "acme_corp"
    }
  }'
```

> [card] [Customer management](https://getlago.com/docs/v2/guide/customers/customer-management.md)
>
> Create and update customers.

> [card] [Invoices](https://getlago.com/docs/v2/guide/invoicing/overview.md)
>
> Documents issued by the billing entity.

> [card] [Create a billing entity (API)](https://getlago.com/docs/v2/api-reference/billing-entities/create.md)
>
> `POST /billing_entities`

> [card] [Update a billing entity (API)](https://getlago.com/docs/v2/api-reference/billing-entities/update.md)
>
> `PUT /billing_entities/{code}`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.