Appearance
Storage Cost Calculation
Description
Calculate storage cost based on item dimensions, weight, quantity, rental period, and tariff mode. The result is returned in EUR and USD (using the dynamic currency rate).
HTTP Request
http
POST /api/calculate-storage-costRequest Body
The request body must be in JSON format and contain the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
units | string | Yes | Measurement units: cm or m |
width | number | Yes | Item width in selected units |
length | number | Yes | Item length in selected units |
height | number | Yes | Item height in selected units |
weight | number | Yes | Weight of the item (kg) |
quantity | integer | Yes | Number of identical items |
period | integer | Yes | Storage duration in months |
tariff_mode | string | No | Tariff mode: low, peak or auto (default: auto) |
💡 Info
If units = cm, all dimensions will be automatically converted to meters.
If tariff_mode = auto, the system chooses the best tariff automatically.
If tariff_mode = low, the system uses the default tariff.
If tariff_mode = peak, the system uses the highest tariff for 10-12 months.
Example Request Body
json
{
"units": "cm",
"width": 50,
"length": 40,
"height": 30,
"weight": 12,
"quantity": 3,
"period": 2,
"tariff_mode": "auto"
}Responses
✅ 200 OK — Successful calculation
json
{
"eur": 15.38,
"usd": 17.75,
"eur_to_usd_rate": 1.1544,
"total_volume": 0.18
}💡 Info
total_volume is calculated as width × length × height × quantity.
The currency rate is fetched dynamically at the moment of calculation.
❌ 400 Bad Request - Invalid JSON
json
{
"message": "Could not decode JSON, syntax error - malformed JSON.",
"code": 0,
"trace": [],
"class": "JMS\\Serializer\\Exception\\RuntimeException"
}❌ 400 Bad Request — Invalid fields
json
{
"errors": {
"units": "This value should not be blank.",
"width": "This value should not be blank.",
"length": "This value should not be blank.",
"height": "This value should not be blank.",
"weight": "This value should not be blank.",
"quantity": "This value should not be blank.",
"period": "This value should not be blank."
}
}Possible reasons:
- Missing required fields
width,length,height,weight, orquantityis negativeunitshas an invalid value- Invalid
tariff_mode: onlylow,peak, orautoallowed
❌ 503 — Service Unavailable
json
{
"message": "Couldn't resolve host name for \"https://api.frankfurter.app/latest?from=EUR&to=USD\".",
"code": 0,
"trace": [],
"class": "Symfony\\Component\\HttpClient\\Exception\\TransportException"
}Possible reasons:
- External currency rate provider failed
- Internal service error during calculation