Integration of Online Store with Amazon (SP-API)
Amazon Selling Partner API (SP-API) is a modern replacement for the outdated MWS. Used for managing listings, prices, inventory, and orders on global Amazon marketplaces (US, EU, UK, DE, JP, and others).
SP-API Authentication
SP-API uses AWS Signature Version 4 + LWA (Login with Amazon) OAuth2:
import boto3
from sp_api.api import Products, Orders, Inventories
from sp_api.base import Marketplaces, Credentials
credentials = Credentials(
refresh_token = os.environ['SP_REFRESH_TOKEN'],
lwa_app_id = os.environ['LWA_APP_ID'],
lwa_client_secret = os.environ['LWA_CLIENT_SECRET'],
aws_access_key = os.environ['AWS_ACCESS_KEY'],
aws_secret_key = os.environ['AWS_SECRET_KEY'],
role_arn = os.environ['SP_API_ROLE_ARN'],
)
Creating/Updating Listings
from sp_api.api import Listings
listings = Listings(credentials=credentials, marketplace=Marketplaces.DE)
def upsert_listing(product: dict) -> None:
listing_body = {
'productType': product['amazon_product_type'],
'attributes': {
'item_name': [{'value': product['name'], 'language_tag': 'de_DE'}],
'brand': [{'value': product['brand']}],
'description': [{'value': product['description'], 'language_tag': 'de_DE'}],
'list_price': [{
'currency': 'EUR',
'value': product['price'],
}],
'main_product_image_locator': [{'media_location': product['main_image']}],
},
}
listings.put_listings_item(
sellerId=SELLER_ID,
sku=product['sku'],
marketplaceIds=[Marketplaces.DE.marketplace_id],
body=listing_body,
)
Updating Prices and Inventory
from sp_api.api import Pricing, FbaInventory
# Price
pricing = Pricing(credentials=credentials, marketplace=Marketplaces.US)
pricing.get_competitive_pricing(Asins=[asin])
# FBA inventory
fba = FbaInventory(credentials=credentials, marketplace=Marketplaces.US)
summary = fba.get_inventory_summaries(granularityType='Marketplace', granularityId=Marketplaces.US.marketplace_id)
Getting Orders
from sp_api.api import Orders as SpOrders
from datetime import datetime, timedelta
orders_api = SpOrders(credentials=credentials, marketplace=Marketplaces.DE)
orders = orders_api.get_orders(
MarketplaceIds=[Marketplaces.DE.marketplace_id],
CreatedAfter=(datetime.utcnow() - timedelta(hours=24)).isoformat(),
OrderStatuses=['Pending', 'Unshipped'],
)
Notifications (Push Notifications via SQS)
SP-API supports real push notifications through Amazon SQS:
from sp_api.api import Notifications
notif = Notifications(credentials=credentials)
# Subscribe to new order notifications
notif.create_subscription(
notificationType='ORDER_CHANGE',
body={
'payloadVersion': '1.0',
'destinationId': SQS_QUEUE_ARN,
}
)
Regional Specifics
Amazon has regional endpoints: sellingpartnerapi-na.amazon.com (US/CA/MX), sellingpartnerapi-eu.amazon.com (EU/UK/IN), sellingpartnerapi-fe.amazon.com (JP/AU). Each has its own marketplace_id.
Timeline
SP-API application registration takes 1–2 weeks. Development of integration (products + prices + orders for one region): 16–24 business days.







