---
title: "Margin, markup, and profit from cost — give cost plus any one of price, target margin %, or markup %, and it solves the rest."
method: POST
path: "/v1/commerce/margin"
tags: ["Commerce"]
---

# Margin, markup, and profit from cost — give cost plus any one of price, target margin %, or markup %, and it solves the rest.

`POST /v1/commerce/margin`

## Request

- Base URL: `` (relative, and it does not resolve against the document’s source URL)
- URL: `/v1/commerce/margin`
- Auth: none declared

Margin, markup, and profit from cost — give cost plus any one of price, target margin %, or markup %, and it solves the rest.

Payment: x402 ($0.02 USDC on eip155:8453). Call unpaid to receive an HTTP 402 with requirements, then retry with the PAYMENT-SIGNATURE header. Method: from price: profit=price-cost, margin=profit/price, markup=profit/cost; from margin: price=cost/(1-m); from markup: price=cost*(1+mk)

## Request body

- object
  - `cost` number, required
  - `price` number
  - `marginPct` number
  - `markupPct` number

## Response `200`

Verified result + provenance (formula, sources, reproducible SHA-256 hash).

## Other responses

- `400`: Invalid input (no charge) — body echoes the JSON Schema.
- `402`: Payment required — PAYMENT-REQUIRED header carries the x402 accepts[] quote.

---

[API](https://skmtc.dev/x402toll/apis/tollbooth-verified-calculators-for-ai-agents.md) · [All operations](https://skmtc.dev/x402toll/apis/tollbooth-verified-calculators-for-ai-agents/llms.txt) · [OpenAPI document](https://skmtc.dev/x402toll/apis/tollbooth-verified-calculators-for-ai-agents/revisions/60cb70a3e1a5?raw)
