Profit Margin Calculator API
Profit, margin (profit ÷ price) and markup (profit ÷ cost) from cost and price, or the selling price for a target margin or markup.
POST /api/v1/tools/profit-margin-calculatorMCP profit_margin_calculatorCalculatorsWork out profit, margin and markup from cost and selling price, or find the price you need to charge to hit a target margin or markup.
Input
Send these as a JSON object. Unknown fields are rejected.
- mode
- costPrice: value is the selling price. targetMargin: value is the desired margin %. targetMarkup: value is the desired markup %. (string, one of costPrice, targetMargin, targetMarkup, default "costPrice")
- cost
- Cost per unit, in currency units. (number, 0 to …, required)
- value
- Selling price (costPrice), target margin in % below 100 (targetMargin), or markup in % (targetMarkup). (number, required)
curl https://pithlab.com/api/v1/tools/profit-margin-calculator \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"mode":"costPrice","cost":60,"value":100}'Example response
{
"ok": true,
"result": {
"cost": 60,
"price": 100,
"profit": 40,
"margin": 40,
"markup": 66.66666666666666,
"text": "Cost 60.00, price 100.00: profit 40.00, margin 40%, markup 66.67%"
}
}