> For the complete documentation index, see [llms.txt](https://api-portal.novapost.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-portal.novapost.com/changelog-1/documentation/post-shipments-calculations.md).

# POST /shipments/calculations

### General Information <a href="#general-information" id="general-information"></a>

| **Method Name**   | Shipment calculation                                                                                                                                                                                                                                                                   |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **HTTP Method**   | POST                                                                                                                                                                                                                                                                                   |
| **Route**         | <p><code>/v.1.0/shipments/calculations</code><br><code>/mobileapp/v.1.1/shipments/calculations</code><br><code>/ui/v.1.0/shipments/calculations</code> <br><br><code>ui/v.1.0/shipments/delivery-calculations</code><br><code>ui/site/v.1.0/shipments/delivery-calculations</code></p> |
| **Change Type**   | Changes to existing endpoint                                                                                                                                                                                                                                                           |
| **Authorization** | `Authorization: Bearer jwt-token…`                                                                                                                                                                                                                                                     |
| **Related Task**  | [APIGW-1769: \[APIGW\] Розрахунок об'ємної ваги \[дільник на 5000\], зміна формули для POST /shipments/calculationsDone](https://novaposhta.atlassian.net/browse/APIGW-1769)                                                                                                           |
| **Product**       | API Gateway                                                                                                                                                                                                                                                                            |
| **Data Source**   |                                                                                                                                                                                                                                                                                        |
| **System/module** | client-api, Мobile App, UI *(*`/ui/` `/mobileapp/` `/v.1.0/`)                                                                                                                                                                                                                          |

### Description <a href="#description" id="description"></a>

For endpoint shipments/calculations (`POST`, `/shipments/calculations`), the logic of volumetric weight (`volumetricWeight`) calculation is changed for shipments related to **Moldova**.

#### Essence of the change <a href="#essence-of-the-change" id="essence-of-the-change"></a>

* **BEFORE:**\
  For all countries volumetric weight was calculated as:\
  `volumetricWeight = length * width * height / 4000`
* **AFTER:**
  * For **shipments related to Moldova**, volumetric weight must be calculated as:\
    `volumetricWeight = length * width * height / 5000`. See rules below.
  * For **all other shipments** the formula with divisor **4000** remains unchanged.

`volumetricWeight` is calculated on API Gateway side even if `parcels[].volumetricWeight` is not sent in the request or is sent as `null`.

&#x20;

#### Rules when divisor 5000 must be applied (Moldova) <a href="#rules-when-divisor-5000-must-be-applied-moldova" id="rules-when-divisor-5000-must-be-applied-moldova"></a>

The formula with divisor **5000** is used if at least one of the following cases is true:

1. Domestic shipments within Moldova
   * Sender and recipient are in Moldova
   * `sender.countryCode = "MD"`
   * `recipient.countryCode = "MD"`
2. Shipments from Moldova and payer = sender or third person with a Moldovan contract
   * `sender.countryCode = "MD"`
   * Payer of the shipment:
     * `payerType = "Sender"` **OR**
     * `payerType = "ThirdPerson"` and the payer’s contract is **Moldovan**
3. Shipments to Moldova and payer = recipient or third person with a Moldovan contract
   * `recipient.countryCode = "MD"`
   * Payer of the shipment:
     * `payerType = "Recipient"` **OR**
     * `payerType = "ThirdPerson"` and the payer’s contract is **Moldovan**

&#x20;

#### Determining a “Moldovan” contract for ThirdPerson <a href="#determining-a-moldovan-contract-for-thirdperson" id="determining-a-moldovan-contract-for-thirdperson"></a>

If `payerType = "ThirdPerson"`, to determine that the payer is a third party under a **Moldovan** contract:

1. Take contract number from `payerContractNumber` in `/shipments` request.
2. Call `/api/contracts/` with:
   * `numbers[] = {payerContractNumber}`
   * `countryCodes[] = MD`
3. If the response for filter `countryCodes[] = MD` contains a contract with this number – the contract is considered Moldovan.\
   If not – the contract is **not** Moldovan and the formula with divisor 5000 **must not** be applied.

Example:

`GET /api/contracts/?numbers[]=GNPMD-00020861&countryCodes[]=MD`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-portal.novapost.com/changelog-1/documentation/post-shipments-calculations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
