{"uid":"cap_72vXtxN5xcHKA1iwIrYTq","slug":"agenttools-margin-calculator-e4f00693","name":"AgentTools Margin Calculator","description":"Calculate gross profit, profit margin (profit as % of price) and markup (profit as % of cost) from a unit cost and selling price — the two numbers people constantly mix up. Use this when an agent needs to profit margin vs markup, both computed.","url":"https://agentstoolshub.com/api/v1/finance/margin-calculator?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["cost","price"],"properties":{"cost":{"type":"number","description":"Cost"},"price":{"type":"number","description":"Selling price"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_6-k12O5cCevOQ2V2DFiLs","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates gross profit, profit margin (profit as % of selling price), and markup (profit as % of cost) from a unit cost and selling price.","exampleAgentPrompt":"What's the profit margin and markup on a product that costs me $40 to make and I sell for $65 — I always mix those two up and want both numbers.","exampleUseCases":[{"title":"Retail product pricing check","prompt":"I'm pricing a new hoodie — it costs me $28 to produce and I want to sell it for $70. What's the profit margin and markup percentage, and what's my gross profit per unit?"},{"title":"Freelancer rate sanity check","prompt":"If my cost basis (time + tools) for a project is $500 and I'm quoting the client $750, what's my profit margin and markup so I can see if I'm pricing competitively?"},{"title":"E-commerce profit reporting","prompt":"I sell a gadget for $99 that costs me $42 wholesale — can you calculate the gross profit, margin, and markup so I can include them in my weekly profit report?"}],"resultDescription":"Returns gross profit (price minus cost), profit margin as a percentage of the selling price, and markup as a percentage of the cost — clearly distinguishing the two figures that are commonly confused.","failureModes":["Missing required 'cost' or 'price' query parameter returns a 400 error","Non-numeric values for cost or price result in a validation error","Price of zero may cause division-by-zero in margin calculation","Negative cost or price values may produce unexpected or undefined results","API returns a 402 Payment Required if the x402 micropayment is not provided"],"whenToPreferThis":"Use this endpoint when an agent needs both profit margin and markup computed together from a cost and price — especially when the user needs to understand the difference between the two. It is ideal for pricing decisions, financial reporting, and retail/e-commerce contexts where confusing margin and markup is a common error.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T12:49:09.872Z","isFirstParty":false,"canonicalSlug":"agenttools-margin-calculator-e4f00693"}