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). Useallto recalculate the entire FBM catalog. - Description: Starts a background job that recalculates pricing for FBM-backed articles. For each article the background task:
- Loads
RepricerArticleandFBMDetailsrows - 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_apito compute min/max prices and fee breakdowns - Updates
FBMDetails.international_pricing,status,expected_profitandmargin_rule_id
- Loads
- 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; reportssuccessandfailedSKUs in return payload of the internal task.
Implementation details & behavior¶
- The recalculation flow validates presence of
brutto_buy_priceandpackage_cost; missing values mark the FBM detail asERROR. - The function supports a
use_min_max_rulesflag onFBMDetails. IfFalse, 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_apiwithis_fba=Falseandfbm_shipping_costset to the article's package cost converted by local exchange rate - Applies 0.90 rounding logic and populates
FBMCountryPricingentries for each marketplace - On calculation or API errors the country entry is populated with an
errorfield and the FBM detail receivesstatus=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-repriceror fallbacksellerlogic) — 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.
Links¶
- 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.