Skip to content

FBM Articles Endpoints

Base path: /api/v1/multi + router prefix /fbm/articles → full base: /api/v1/multi/fbm/articles

Summary: Endpoints to recalculate FBM (Fulfillment-By-Merchant) pricing and profit information. The primary operation recalculates min/max price bounds and profit estimates per marketplace using Sellerlogic and Amazon SP-API helpers.

Auth: Bearer JWT required for all endpoints.

Rate limiting: Subject to global rate limiter (250 requests / 60s).

Primary models referenced: RepricerArticle, FBMDetails, FBMCountryPricing, FBMBoundDetails (models in backend/service_multi-repricer/app/models/repricer_articles.py, Pydantic schemas in schemas/repricer_articles.py).

External services used: calculate_optimal_price_with_api (SP-API helper), get_live_exchange_rates, batch_reprice_items (sellerlogic helper).


Endpoints

  • POST /recalculate/{sku}
  • Path: POST /api/v1/multi/fbm/articles/recalculate/{sku}
  • Path param: sku (string). Use all to recalculate the entire FBM catalog.
  • Description: Starts a background job that recalculates pricing for FBM-backed articles. For each article the background task:
    • Loads RepricerArticle and FBMDetails rows
    • If use_min_max_rules == False, updates profit fields from manual bound prices
    • Otherwise, finds the applicable margin rule and calls calculate_optimal_price_with_api to compute min/max prices and fee breakdowns
    • Updates FBMDetails.international_pricing, status, expected_profit and margin_rule_id
  • Response: 200{ "message": "Recalculation started in background." }
  • Notes: Emits websocket notifications (type=task_status, source=fbm) at start and finish; commits per-article to reduce locking; reports success and failed SKUs in return payload of the internal task.

Implementation details & behavior

  • The recalculation flow validates presence of brutto_buy_price and package_cost; missing values mark the FBM detail as ERROR.
  • The function supports a use_min_max_rules flag on FBMDetails. If False, the endpoint only recalculates profit/margin from existing bound prices without changing prices.
  • For price calculations the code:
  • Computes buy_netto (simple DE net assumption: gross/1.19)
  • Looks up a margin rule via get_margin_rule_for_price
  • Calls calculate_optimal_price_with_api with is_fba=False and fbm_shipping_cost set to the article's package cost converted by local exchange rate
  • Applies 0.90 rounding logic and populates FBMCountryPricing entries for each marketplace
  • On calculation or API errors the country entry is populated with an error field and the FBM detail receives status=ERROR.

Examples

  • Trigger a recalculation for a single SKU:
curl -X POST "http://localhost:8000/api/v1/multi/fbm/articles/recalculate/B07SKU123" \
    -H "Authorization: Bearer <TOKEN>"
  • Recalculate all FBM-backed SKUs (may be long-running):
curl -X POST "http://localhost:8000/api/v1/multi/fbm/articles/recalculate/all" \
    -H "Authorization: Bearer <TOKEN>"

Notes & operational guidance

  • Ensure active Amazon credentials are available (service multi-repricer or fallback sellerlogic) — fee-based calculations rely on SP-API estimates.
  • Recalculation is CPU/IO intensive and may call external APIs for many SKUs; schedule during low-traffic windows for large catalogs.
  • WebSocket notifications provide progress updates for the frontend.

  • Endpoint implementation: backend/service_multi-repricer/app/api/v1/endpoints/fbm_articles.py
  • SP-API helper: backend/service_multi-repricer/app/services/amazon/spapi_client.py

Generated: detailed reference for fbm_articles endpoints.