---
title: "Calculate a charge distribution"
method: POST
path: "/charges/distributions/{key_id}/calculate-distribution"
tags: ["Charges"]
---

# Calculate a charge distribution

`POST /charges/distributions/{key_id}/calculate-distribution`

## Request

- Base URL: `https://api.faireplace.com/api`
- URL: `https://api.faireplace.com/api/charges/distributions/{key_id}/calculate-distribution`
- Auth: HTTP bearer

Calculates how a total charge amount is distributed across the leases of an estate,
using the distribution key identified by `key_id`.

Returns the per-lease shares together with a human-readable explanation of each
computation.

## Usage Example

```bash
curl -X POST https://api.faireplace.com/api/charges/distributions/dd0e8400-e29b-41d4-a716-446655440008/calculate-distribution \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "estate_id": "aa0e8400-e29b-41d4-a716-446655440005",
    "total_amount": 1200.00
  }'
```

**Response**:
```json
{
  "key_id": "dd0e8400-e29b-41d4-a716-446655440008",
  "total_amount": 1200.00,
  "distributions": [
    {
      "lease_id": "660e8400-e29b-41d4-a716-446655440001",
      "amount": 600.00,
      "calculation_details": "50.00% (tantièmes: 500 / 1000)"
    }
  ]
}
```

## Path parameters

- `key_id` string, uuid, required

## Request body

- DistributeChargeRequest: Request to calculate the distribution of a charge amount across the leases of an estate, using a given distribution key.
  - `estate_id` string, uuid, required: Estate whose leases the charge is distributed across.
  - `total_amount` number, double, required: Total charge amount to distribute (in euros).

## Response `200`

Distribution calculated successfully

- LeaseMiscDistributionCalculationResponse: Result of a charge distribution calculation.
  - `key_id` string, uuid, required: Distribution key used for the calculation.
  - `total_amount` number, double, required: Total amount that was distributed (in euros).
  - `distributions` DistributionItem[], required: Per-lease distribution shares.
    - `lease_id` string, uuid, required: Lease receiving this share.
    - `amount` number, double, required: Amount allocated to the lease (in euros).
    - `calculation_details` string, required: Human-readable explanation of how the amount was computed.

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `422`: Unprocessable Entity
- `500`: Internal Server Error

---

[API](https://skmtc.dev/faireplace/apis/faireplace-property-management-api.md) · [All operations](https://skmtc.dev/faireplace/apis/faireplace-property-management-api/llms.txt) · [OpenAPI document](https://skmtc.dev/faireplace/apis/faireplace-property-management-api/revisions/69de39762919?raw)
