Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SellingPartnerApi
✓ from spapi import SellingPartnerApi
✗ from sp_api.api import SellingPartnerApi
Initialize the client and call the Orders API. Note that the constructor expects certain credentials; refer to official docs for full setup.
import os
from sp_api.api import Orders
from sp_api.base import SellingPartnerApi
# Set up credentials (use environment variables for security)
sp_api = SellingPartnerApi(
refresh_token=os.environ.get('SP_API_REFRESH_TOKEN', ''),
lwa_app_id=os.environ.get('SP_API_LWA_CLIENT_ID', ''),
lwa_client_secret=os.environ.get('SP_API_LWA_CLIENT_SECRET', ''),
aws_access_key=os.environ.get('SP_API_AWS_ACCESS_KEY', ''),
aws_secret_key=os.environ.get('SP_API_AWS_SECRET_KEY', ''),
role_arn=os.environ.get('SP_API_ROLE_ARN', ''),
)
# Example: get orders from the last 7 days
orders = Orders(sp_api)
response = orders.get_orders(CreatedAfter='-P7D')
print(response.payload)
Debug
Known issues
breakingThe v1.9.0 release changed internal module names from camelCase to snake_case. Existing imports like 'from sp_api.api.orders import Orders' must be updated to 'from sp_api.api import Orders'.fixImport from sp_api.api directly: `from sp_api.api import Orders`.
affects: <1.9.0 -> >=1.9.0
gotchaThe package name on PyPI is `amzn-sp-api`, but the importable module is `sp_api`. Users often try `import amzn_sp_api` which fails.fixUse `import sp_api` or `from sp_api.api import ...`.
affects: all
deprecatedThe `SellingPartnerApi` class is deprecated in favor of using individual API clients directly? Check official docs as pattern may vary.fixInstantiate API classes directly with credentials via `Orders(credentials)`.
affects: >=1.9.0
Upgrade
Version history
1.9.0latest on PyPI · released May 29, 2026
Audit
Dependencies
boto3requiredRequired for AWS Signature V4 signing