Eligibility

Check advertising eligibility of products.

Previously, Amazon served the same specification from a different host: https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/Eligibility_prod_3p.json

Specification: https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Eligibility_prod_3p.json Documentation: https://advertising.amazon.com/API/docs/en-us/eligibility-prod-3p

class ad_api.api.Eligibility(account: str = 'default', marketplace: Marketplaces = Marketplaces.EU, credentials: Dict[str, str] | None = None, proxies: Dict[str, str] | None = None, verify: bool = True, timeout: int | None = None, debug: bool = False, access_token: str | None = None, verify_additional_credentials: bool = True)

Product and program eligibility for Amazon ads.

### Example getting the elegibility of asin and asin/sku

import logging
from ad_api.api import Eligibility
from ad_api.base import AdvertisingApiException

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s:%(levelname)s:%(message)s"
)

def get_eligibility_assistant(**kwargs):

    try:

        result = Eligibility(debug=True).get_eligibility_assistant(
            **kwargs
        )

        logging.info(result)

    except AdvertisingApiException as error:
        logging.info(error)

if __name__ == '__main__':

    d_asin_list = ['B08C1KN5J2', 'B08XM9C8P6']
    d_sku_list = ['SKU-OF-B08C1KN5J2', 'SKU-OF-B08XM9C8P6']
    type_ad = 'sb'
    lang = 'es_ES'

    get_eligibility_assistant(asin_list=d_asin_list, sku_list=d_sku_list, ad_type=type_ad, locale=lang)

    # only by ASIN will return all available sku and show the eligibility
    get_eligibility_assistant(asin_list=d_asin_list, locale=lang)
    # the minimal call must send at least a list with one ASIN. Default: (adType="sp", locale="en-GB")
    get_eligibility_assistant(asin_list=['B08C1KN5J2'])

### Example getting the elegibility in the regular way sending a dict

import logging
from ad_api.api import Eligibility
from ad_api.base import AdvertisingApiException

def get_eligibility(data: (str, dict)):

    try:

        result = Eligibility(debug=True).get_eligibility(
            body=data
        )

        logging.info(result)

    except AdvertisingApiException as error:
        logging.info(error)

if __name__ == '__main__':

    dict_asin = \
        {
            'adType': 'sp',
            'productDetailsList': [
                {
                    'asin': 'B08C1KN5J2'
                }
            ],
            'locale': 'es-ES'
        }

    get_eligibility(dict_asin)

    dict_asin_sku = \
        {
            'adType': 'sp',
            'productDetailsList': [
                {
                    'asin': 'B08C1KN5J2',
                    'sku': 'SKU-OF-B08C1KN5J2'
                }
            ],
            'locale': 'es-ES'
        }

    get_eligibility(dict_asin_sku)

    dict_multiple_asin_sku = \
        {
            'adType': 'sp',
            'productDetailsList': [
                {
                    'asin': 'B08C1KN5J2',
                    'sku': 'SKU-OF-B08C1KN5J2'
                },
                {
                    'asin': 'B08XM9C8P6',
                    'sku': 'SKU-OF-B08XM9C8P6'
                }

            ],
            'locale': 'es-ES'
        }

    get_eligibility(dict_multiple_asin_sku)
get_eligibility(body: dict, str) → ApiResponse

Product eligibility for a set of ASINs. Only products sold by the merchant behind the profile are accepted. The request carries ASINs, but several SKUs may come back for one ASIN, and an ineligible product comes back with the reasons rather than being left out.

body: | REQUIRED

‘adType’: string [dsp, sb, sd, sp] default sp ‘productDetailsList’: list of {asin, sku} ‘locale’: string

get_eligibility_assistant(asin_list, sku_list=None, ad_type='sp', locale='en-GB')

Builds the body for get_eligibility from plain lists.

sku_list is optional. When given it must be a list of the same length as asin_list, so each entry pairs by position; a mismatch raises here rather than sending a body the service will refuse.

get_program_eligibility(body: dict) → ApiResponse

Account level eligibility for the Amazon ad programs, not for a product: Sponsored Products, Sponsored Brands, Sponsored Display, Stores, DirectToConsumer, Amazon Attribution and the rest.

Two media types are declared:

application/json the default shape, with skipChecks application/vnd.programeligibility.v2+json

v2, with maxResults and nextToken

Pass media_type=’v2’ for the paginated one.