API module

This is the main class that provides authentication and methods for accessing the Amazon Creators API. Instance it with your credentials and configuration.

class amazon_creatorsapi.api.AmazonCreatorsApi(credential_id, credential_secret, version, tag, country=None, marketplace=None, throttling=1)

Bases: object

Provides methods to get information from Amazon using the Creators API.

Parameters:
  • credential_id – Your Creators API credential ID.

  • credential_secret – Your Creators API credential secret.

  • version – API version for your region.

  • tag – Your affiliate tracking id (partner tag).

  • country – Country code (e.g., “ES”, “US”). Used to determine marketplace.

  • marketplace – Marketplace URL (e.g., “www.amazon.es”). Overrides country.

  • throttling – Wait time in seconds between API calls. Defaults to 1 second.

Raises:

InvalidArgumentError – If neither country nor marketplace is provided.

Example

>>> api = AmazonCreatorsApi(
...     credential_id="your_id",
...     credential_secret="your_secret",
...     version="2.2",
...     tag="your-tag",
...     country="ES"
... )
>>> items = api.get_items(["B0DLFMFBJW"])
get_browse_nodes(browse_node_ids, languages_of_preference=None, resources=None)

Return browse node information including name, children, and ancestors.

Parameters:
  • browse_node_ids – List of browse node IDs.

  • languages_of_preference – Languages in order of preference.

  • resources – List of resources to retrieve. Defaults to all.

Returns:

List of BrowseNode objects.

Raises:

ItemsNotFoundError – If no browse nodes are found.

get_items(items, condition=None, currency_of_preference=None, languages_of_preference=None, resources=None)

Get items information from Amazon.

Parameters:
  • items – One or more items, using ASIN or Amazon product URL. Accepts a single string (comma-separated) or a list of strings.

  • condition – Filter offers by condition type.

  • currency_of_preference – ISO 4217 currency code for prices.

  • languages_of_preference – Languages in order of preference.

  • resources – List of resources to retrieve. Defaults to all.

Returns:

List of Item objects with Amazon information.

Raises:
get_variations(asin, variation_count=None, variation_page=None, condition=None, currency_of_preference=None, languages_of_preference=None, resources=None)

Return variations of a product (different sizes, colors, etc.).

Parameters:
  • asin – The ASIN or Amazon product URL of the product.

  • variation_count – Number of variations to return (1-10). Defaults to 10.

  • variation_page – Page of variations to return (1-10). Defaults to 1.

  • condition – Filter offers by condition type.

  • currency_of_preference – ISO 4217 currency code for prices.

  • languages_of_preference – Languages in order of preference.

  • resources – List of resources to retrieve. Defaults to all.

Returns:

VariationsResult containing the list of variations.

Raises:

ItemsNotFoundError – If no variations are found.

search_items(keywords=None, actor=None, artist=None, author=None, brand=None, title=None, browse_node_id=None, search_index=None, item_count=None, item_page=None, condition=None, currency_of_preference=None, languages_of_preference=None, max_price=None, min_price=None, min_saving_percent=None, min_reviews_rating=None, sort_by=None, resources=None)

Search for items on Amazon based on a search query.

At least one of the following parameters should be specified: keywords, actor, artist, author, brand, title, browse_node_id or search_index.

Parameters:
  • keywords – A word or phrase that describes an item.

  • actor – Actor name associated with the item.

  • artist – Artist name associated with the item.

  • author – Author name associated with the item.

  • brand – Brand name associated with the item.

  • title – Title associated with the item.

  • browse_node_id – A unique ID for a product category.

  • search_index – Product category to search. Defaults to All.

  • item_count – Number of items returned (1-10). Defaults to 10.

  • item_page – Page of items to return (1-10). Defaults to 1.

  • condition – Filter offers by condition type.

  • currency_of_preference – ISO 4217 currency code for prices.

  • languages_of_preference – Languages in order of preference.

  • max_price – Max price in lowest currency denomination.

  • min_price – Min price in lowest currency denomination.

  • min_saving_percent – Min savings percentage (1-99).

  • min_reviews_rating – Min review rating (1-5).

  • sort_by – Sort method for results.

  • resources – List of resources to retrieve. Defaults to all.

Returns:

SearchResult containing the list of items.

Raises:

ItemsNotFoundError – If no items are found.