Skip to main content

Python SDK for Selling Partner API

PyPI version

Video Thumbnail

Click on the image to watch the video.

The Selling Partner API SDK for Python enables you to easily connect your Python application to Amazon's REST-based Selling Partner API.

Getting started

Credentials

Before you can use the SDK, you need to be registered as a Selling Partner API developer. If you haven't done that yet, please follow the instructions in the SP-API Registration Overview. You also need to register your application to get valid credentials to call SP-API. If you haven't done that yet, please follow the instructions in Registering your Application. If you are already registered successfully, you can find instructions on how to view your credentials in Viewing your Application Information and Credentials.

Minimum requirements

To run the SDK you need Python version 3.9 or higher.

Install the SDK

  1. Find the latest version number here.
  2. Add the dependency to your project
Using pip:
pip install amzn-sp-api
Add to your project requirements.txt

Add the following line to the requirements.txt file if needed:

amzn-sp-api >= "1.0.0"

Use the SDK

In order to call one of the APIs included in the Selling Partner API, you need to:

  1. Configure credentials (Note: Use your individual credentials for clientId, clientSecret and refreshToken). You can also configure the region and the authorization scope at this level.
  2. Initialize the SPAPI Client using the configuration created in the previous step
  3. Create an instance for a specific API using the API client created
  4. Call an API operation

For example, refer to the following sample code for connecting to Sellers API.

from spapi import SellersApi, SPAPIConfig, SPAPIClient, ApiException
from spapi.models.sellers_v1 import GetMarketplaceParticipationsResponse

if __name__ == "__main__":

    # Credentials configuration
    config = SPAPIConfig(
        client_id="",
        client_secret="",
        refresh_token="",
        region="NA",
        scope = None
    )

    # Create the API Client with configuration
    client = SPAPIClient(config)
    sellers_api = SellersApi(client.api_client)

    response = None
    try:
        response = sellers_api.get_marketplace_participations()
    except ApiException as e:
        print(f"API Exception occurred: {str(e)}")

    if response is not None:
        print("Sellers API Response:")
        get_marketplace_participations_response = GetMarketplaceParticipationsResponse(response.payload)
        for marketplaceParticipation in get_marketplace_participations_response.payload:
            print(marketplaceParticipation.marketplace.id)

Note: Code can be found under python/sample-app folder

Giving Feedback

We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels:

Submit issues - this is the preferred channel to interact with our team Articulate your feature request or upvote existing ones on our Issues page

Release files for amzn-sp-api 1.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amzn-sp-api 1.11.1
File Size Uploaded
amzn_sp_api-1.11.1.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for amzn-sp-api 1.11.1
File Interpreter ABI Platform
amzn_sp_api-1.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 4.6 MB

Release files / amzn_sp_api-1.11.1.tar.gz

Download URL amzn_sp_api-1.11.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
f76a8f76a357e69e0a9ba2d2ba81143ef59e1aa7bb12a9f04743c6aeaac1a3e6
BLAKE2b-256 checksum
How to use checksums
37a0d1ed18caf1fa0f707d8a42fe3d27e57f62987ce4c9e3c569b90f10a60ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / amzn_sp_api-1.11.1-py3-none-any.whl

Download URL amzn_sp_api-1.11.1-py3-none-any.whl
Size 3.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a88e4059c9fbfd454bfef67b82288a926f73cbdc608a8831f8383565736c70b0
BLAKE2b-256 checksum
How to use checksums
363e8744071121b96a7738fa485e584670cd4e6735b545cecc18516d10bd8881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

1.12.0

2 release files

This release

1.11.1 This release

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.0.3

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page