SwellPy is our API wrapper written in Python with type support aimed at backend development. It provides convenient methods for performing CRUD operations on your Swell store data using a server-side Python application.

In this guide, we’ll review the installation and initialization steps, some commonly used Swell-Py methods, and this library’s caching behavior.

To install SwellPy, check out this repo.

See our Backend API docs for code examples using Python.

Clone SwellPy and build locally. We’re in the process of adding the package to PyPI, which will simplify installation. In the meantime, you can install the package locally using the following steps:

Install SwellPy
git clone git@github.com:swellstores/swellpy.git
Import Locally
pip install [relative path to swellpy]
Instantiate Swell Instance
swell = Swell({ store_id: "SWELL_STORE_ID", api_key: "SWELL_API_KEY" )}
Interact with Swell Resource
response = swell.products.create({'name': 'my-product-slug'}) 

SwellPy can be used for querying and retrieving backend data like account, product, and cart details. Some of the most commonly used methods in the library include:

  • get(), list(), update(), create(), and delete()
  • orders.convert_cart_to_order()
  • webhooks.list_events()

In this section, we’ll go over what each method is used for, the parameters for each one, and see an example of how it’s used.

  • get(), list(), update(), create(), and delete()

The get/list/update/delete methods are CRUD operations used to manage and edit your Swell store data and content models. You can also use these CRUD operations to implement custom logic to your store’s data. The parameters for this method are url and data.

Retrieve products
response = swell.products.list({ limit:25, page:1 ]);


SwellPy provides LRU caching for better performance for the get() and list() methods.

Rate limiting is set by default at two calls per second, but can be updated as part of the initialization options. Keep in mind that the Swell backend API will throttle requests that exceed fair-use limits (commonly resulting from out-of-control scripts).

Next Up

Now that we've reviewed SwellPy, we’re ready to explore Swell’s backend API. Continue on to learn about errors and querying.