← FBA Fee Calculator
API
Tokens

Run FBA Fee Calculator from your own code

The one metered task, review, is available over HTTP. It takes one product's numbers as the page has already computed them - selling price, product cost, size tier, shipping weight, the referral, fulfillment and storage fees, profit, margin, ROI, break-even price, the packaging what-ifs and the page's checks - and returns a verdict, the changes worth making ranked by value, the risks to check and the data that is MISSING.

The division of labour first: the browser does all the arithmetic - size tier, dimensional weight, every fee, profit, margin, ROI, break-even price, the price for a target margin and the packaging what-ifs - and writes the copy, the CSV and the Markdown. That part is free and never calls the API. Only the review is metered: model alias llm-default, billed per run at the model's price plus a 10% markup. The page re-checks every number the review proposes before it shows anything - see How the page checks the reply.

Base URL and the response shape

Every endpoint lives under https://api.skillsafe.ai/v1/app-api, and every response has one shape:

{ "ok": true,  "data":  { ... } }
{ "ok": false, "error": { "code": "...", "message": "..." } }

The token is minted for this app (the guest call takes {"slug":"fba-fee-calculator"}), so no slug header is needed afterwards. Send it as Authorization: Bearer …. The run body is the input object, sent bare.

StatusCodeMeaning
400validation_errorThe body is not a JSON object, or a required key (task, product) is missing.
401unauthorizedNo token, or a stale one. Mint a guest token or sign in again.
402insufficient_creditsThe balance is under min_credits. Price with /estimate first.
403forbiddenA guest token tried to run: the review is metered and needs a personal sign-in.
404not_foundUnknown job id.
429rate_limitedBack off and retry.
5xxserver_errorTransient. Retry with the same Idempotency-Key so a retry never double-bills.

The task field and the input

There is one task. Always send it.

FieldTypeRequiredWhat it holds
taskstringyesAlways "review".
productstringyesThe computed product as a JSON-encoded string (the input schema takes scalars only) - see below.
notestringnoUp to 600 characters: what the product is, competing prices, your plans.

Inside product

rates, price, product_cost (or null), inbound_per_unit, other_per_unit, category, dimensions_in (long, med, short), unit_weight_lb, size_tier, shipping_weight_lb, shipping_weight_basis (unit or dimensional), fees (referral, referral_pct, fulfillment, storage, storage_months, storage_season, amazon_total), landed_cost, profit, net_margin_pct, roi_pct, break_even_price, target_margin_pct, price_for_target, max_cost_for_target, monthly (units, profit, or null), page_verdict, whatifs (each id, kind, change, saving_per_unit), checks (the page's findings as sentences) and missing.

The reply

output.output on the finished job is a string holding one JSON object:

{
  "verdict": "Worth selling" | "Thin margin" | "Losing money" | "Missing data",
  "summary": "2-3 sentences",
  "levers": [ { "kind": "price" | "product_cost" | "packaging" | "weight" | "inbound" | "storage" | "referral",
               "whatif": "w1" | "", "value": 14.53 | null, "action": "one sentence", "reason": "one sentence" } ],
  "risks": ["..."], "missing": ["... MISSING ..."]
}

Levers come most valuable first, 1 to 5 of them. value is the new price, product cost, inbound cost or months in storage the lever proposes. The model is told never to invent competitor prices, sales, ad costs, return rates or fee rules, and to quote a packaging saving only from the page's what-ifs.

How the page checks the reply

Worked example - a phone stand at $12.99

Computed by the pageValue
Size tierLarge standard, billed at 0.35 lb (dimensional weight)
Referral fee$1.04 (8%)
FBA fulfillment fee$3.90
Profit per unit$1.49 (11.47% margin)
Break-even price$11.37

Request body (input.json):

{"task": "review", "product": "{\"rates\":\"Amazon US rate card 2025, items priced $10-$50\",\"price\":12.99,\"product_cost\":6.2,\"inbound_per_unit\":0.35,\"other_per_unit\":0,\"category\":\"Consumer electronics\",\"dimensions_in\":{\"long\":6.3,\"med\":3.9,\"short\":0.9},\"unit_weight_lb\":0.25,\"size_tier\":\"Large standard\",\"shipping_weight_lb\":0.35,\"shipping_weight_basis\":\"dimensional\",\"fees\":{\"referral\":1.04,\"referral_pct\":8,\"fulfillment\":3.9,\"storage\":0.01,\"storage_months\":1,\"storage_season\":\"January-September\",\"amazon_total\":4.95},\"landed_cost\":6.55,\"profit\":1.49,\"net_margin_pct\":11.47,\"roi_pct\":22.75,\"break_even_price\":11.37,\"target_margin_pct\":20,\"price_for_target\":14.53,\"max_cost_for_target\":5.09,\"monthly\":null,\"page_verdict\":\"Thin margin\",\"whatifs\":[{\"id\":\"w1\",\"kind\":\"packaging\",\"change\":\"Packed shortest side 0.15 in shorter (small standard)\",\"saving_per_unit\":0.75}],\"checks\":[\"Below your 20% target. Net margin is 11.47%. A price of $14.53 reaches 20%, or a product cost of $5.09 at this price.\",\"Billed on size, not weight. The box weighs in at 0.35 lb dimensional against 0.25 lb actual, so the fee follows the box.\",\"Save $0.75 a unit: Packed shortest side 0.15 in shorter (small standard).\"],\"missing\":[]}", "note": "Folding aluminium phone stand in a padded mailer. I want to stay at 12.99 to win the Buy Box."}

A reply (output.output, pretty-printed):

{
  "verdict": "Thin margin",
  "summary": "At $12.99 the stand earns $1.49 profit per unit, an 11.47% net margin and 22.75% ROI, below your 20% target. Amazon fees take $4.95 of the price, and the $3.90 fulfillment fee is set by the box size because the dimensional weight is 0.35 lb against 0.25 lb actual. Break-even is $11.37, so there is only a small cushion at your chosen price, and monthly demand is MISSING.",
  "levers": [
    {
      "kind": "product_cost",
      "whatif": "",
      "value": 5.09,
      "action": "Ask your supplier for a unit cost of $5.09 so you can keep the price at $12.99 and still reach your 20% target margin.",
      "reason": "The page says a product cost of $5.09 at this price reaches the 20% target, against your current $6.20."
    },
    {
      "kind": "packaging",
      "whatif": "w1",
      "value": null,
      "action": "Repack so the shortest side is 0.15 in shorter, which moves the item into the small standard tier.",
      "reason": "The page's what-if w1 saves $0.75 a unit against the current $3.90 fulfillment fee."
    },
    {
      "kind": "price",
      "whatif": "",
      "value": 14.53,
      "action": "If you can accept a weaker Buy Box position, test a price near $14.53, which is the page's price for a 20% margin.",
      "reason": "You want to stay at $12.99, which is above the $11.37 break-even but gives only an 11.47% margin, so $14.53 is the price that reaches 20%."
    }
  ],
  "risks": [
    "Advertising spend is not in the page's numbers; check it in your Amazon ad reports before relying on the $1.49 profit per unit.",
    "Returns and refunds are not included; check your return report once you have sales, since a thin margin leaves little room.",
    "Packing the box 0.15 in thinner may affect protection of the aluminium stand in its padded mailer; test a sample before changing the pack."
  ],
  "missing": [
    "Monthly sales volume is MISSING, so total monthly profit and demand cannot be judged.",
    "Advertising cost per unit is MISSING and would reduce the $1.49 profit.",
    "Return rate is MISSING and would reduce the real profit."
  ]
}

Step 1 — a tiny client helper

One function that sends JSON and unwraps the response. Paste a personal token from /tokens.html, or leave it empty and mint a guest token in step 2.

BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="YOUR_TOKEN"   # from https://fba-fee-calculator.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
  curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
    ${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}

Step 2 — a token

A guest token is enough for /me and /estimate. A run is metered, so it needs a personal token: sign in on /tokens.html and copy it from there.

# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"fba-fee-calculator"}' | jq -r '.data.token')

Step 3 — GET /me

Who the token is (subject_type: user or guest) and the credit balance.

api GET /me | jq '.data | {subject_type, credits}'

Step 4 — POST /estimate

Free. The body is the run input itself, the bare object (never wrapped in {"input": ...}). hold_credits is a reservation, not the price; min_credits is what the balance must cover; model_alias reads llm-default and markup_bps reads 1000 (10%). Save the worked example's request body as input.json.

# input.json: the run input object - {"task": "review", "product": "<JSON string>", "note": "..."} - see the worked example
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}'

Step 5 — POST /run, then poll the job

Send an Idempotency-Key built from the task and the input: a retry with the same key never bills twice. The page uses fba-fee-calculator:<task>:<inputHash>:a<attempt> (the one task is review). The job's output.output is the reply text - one JSON object; truncated: true means the balance cut it short, and the complete entries that did arrive are still usable.

KEY="fba-fee-calculator:review:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
  J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
  case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.json   # one JSON object, the reply contract
echo "$J" | jq '.data | {charged_credits, truncated}'
jq -r '"\(.verdict): \(.summary)"' reply.json
jq -r '.levers[]? | "\(.kind): \(.action) - \(.reason)"' reply.json   # most valuable first
jq -r '.missing[]? | "MISSING: \(.)"' reply.json
jq -r '.risks[]? | "- \(.)"' reply.json

Step 6 — POST /run-stream

The same run as Server-Sent Events, with the same input.json. Browsers receive progress ticks rather than text deltas; the final done event carries the job, whose output.output is the reply.

# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: fba-fee-calculator:review:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json