---
title: "Invoice totals calculator"
method: POST
path: "/api/agent-commerce/v1/services/invoice_totals_calculate/execute"
tags: ["data_tools"]
---

# Invoice totals calculator

`POST /api/agent-commerce/v1/services/invoice_totals_calculate/execute`

## Request

- Base URL: `https://www.tradepilotusa.com` (the document declares no server; this is the origin it was published from)
- URL: `https://www.tradepilotusa.com/api/agent-commerce/v1/services/invoice_totals_calculate/execute`
- Auth: none declared

Calculate subtotal, per-line tax, discount and deposit from supplied invoice line items. Per-line tax percent (not a single flat rate), discount applied to the pre-tax subtotal, deposit as a percent-of-total or fixed amount clamped to the total. Pure arithmetic; does not create, store or send an invoice.

## Request body

- object
  - `line_items` object[], required
    - `rate` number, required
    - `quantity` number, required
    - `tax_percent` number
  - `deposit_type` 'percent' | 'fixed'
  - `deposit_value` number
  - `deposit_enabled` boolean
  - `discount_percent` number

## Response `200`

Successful response

- object
  - `result` object, required
    - `total` number, required
    - `subtotal` number, required
    - `tax_amount` number, required
    - `balance_due` number, required
    - `deposit_amount` number, required
    - `discount_amount` number, required
  - `utility` 'invoice_totals_calculate', required
  - `provenance` object, required
    - `execution` 'deterministic_local', required
    - `model_used` unknown, required
    - `network_request_performed` unknown, required
  - `request_id` string, required

## Other responses

- `402`: Payment Required

---

[API](https://skmtc.dev/tradepilotusa/apis/tradepilotusa-agent-commerce.md) · [All operations](https://skmtc.dev/tradepilotusa/apis/tradepilotusa-agent-commerce/llms.txt) · [OpenAPI document](https://skmtc.dev/tradepilotusa/apis/tradepilotusa-agent-commerce/revisions/1060778e0a57?raw)
