python-amazon-ad-api 2.2.3__py3-none-any.whl → 2.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ad_api/api/__init__.py CHANGED
@@ -31,6 +31,7 @@ from .recommendations import Recommendations
31
31
  from .stream import Stream
32
32
  from .exports import Exports
33
33
  from .stores import Stores
34
+ from .brand_home import BrandHome
34
35
 
35
36
  __all__ = [
36
37
  "v1",
@@ -68,5 +69,6 @@ __all__ = [
68
69
  "Stream",
69
70
  "Exports",
70
71
  "Stores",
72
+ "BrandHome",
71
73
  "Account"
72
74
  ]
@@ -0,0 +1,135 @@
1
+ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
+
3
+
4
+ class BrandHome(Client):
5
+ r"""
6
+ BrandHome(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, debug=False)
7
+
8
+ Amazon Ads API v0 - Brand Home
9
+
10
+ Two routes, both POST: the stores of an advertiser, and the pages inside
11
+ one store.
12
+
13
+ POST /brand/stores/v1/stores/list
14
+ POST /brand/stores/v1/storePages/list
15
+
16
+ Not the same family as :class:`~ad_api.api.v1.BrandStores`
17
+ (``/adsApi/v1/query/brandStores``): that one is the v1 query and demands a
18
+ ``storeNameFilter``; this one lists stores by advertiser and pages by
19
+ store.
20
+
21
+ Contract: ``specs/BrandHome_prod_3p.json`` (Brand Home 3.0, 9 050 B,
22
+ sha256 8cbb22a5...789eaf).
23
+
24
+ Media types, copied from the contract
25
+ -------------------------------------
26
+ Each route declares its own ``Content-Type``, and bare
27
+ ``application/json`` is NOT among them:
28
+
29
+ stores/list application/vnd.bhstoreslist.v1+json
30
+ storePages/list application/vnd.bhstorepageslist.v1+json
31
+
32
+ Measured against the service (2026-11-30, leadtech_fr)
33
+ ---------------------------------------------------------
34
+ Both routes answer 200. What the service accepts:
35
+
36
+ * **Identity**: ``Amazon-Advertising-API-Scope`` only. Sending
37
+ ``Amazon-Advertising-AccountId`` or ``Amazon-Advertising-GlobalAccountId``
38
+ instead answers 400 "profile ID required".
39
+ * **Media type**: the one the contract declares, or its BNF twin
40
+ (``application/brandStores.ListStores.v1+json``). Bare
41
+ ``application/json`` answers 400 "Cannot consume content type".
42
+ * **``identifierType``**: ``ENTITY_ID`` on stores, ``STORE`` on pages.
43
+ ``BRAND_AID_ID`` answers 400 "not supported".
44
+ * **``identifier``**: required on both, and it must match the entity id the
45
+ service derives from the identity headers. Stores take the advertiser
46
+ entity (``ENTITY3412Q8SIECJWW``); pages take the ``storeId`` returned by
47
+ stores (``106FD13E-...``).
48
+
49
+ Getting the advertiser entity id: the service truncates it in the error
50
+ ("entityId derived from headers = ENTITY3412Q8SIE" for a 21-char id), so
51
+ send a wrong value once and read the next message, which carries the full
52
+ one.
53
+
54
+ ``identifierType``, in the contract and in practice
55
+ ---------------------------------------------------
56
+ The contract lists ``ASIN``, ``BRAND_AID_ID``, ``ENTITY_ID``, ``GCOR``,
57
+ ``NODE`` and ``STORE``; the service accepts ``ENTITY_ID`` on stores and
58
+ ``STORE`` on pages, and refuses ``BRAND_AID_ID`` on both.
59
+ """
60
+
61
+ @sp_endpoint('/brand/stores/v1/stores/list', method='POST', headers=['Amazon-Advertising-API-Scope'])
62
+ def list_stores(self, **kwargs) -> ApiResponse:
63
+ r"""
64
+ list_stores(body: dict) -> ApiResponse
65
+
66
+ Amazon Ads API v0 - Brand Home ListStores (operationId: ListStores)
67
+
68
+ Request Body [identifier and identifierType are REQUIRED by the service]
69
+ | **identifier** (string) : [required] advertiser entityId, ENTITY3412Q8SIECJWW in leadtech_fr
70
+ | **identifierType** (string) : [required] ENTITY_ID (the only value the service accepts here)
71
+ | **maxResults** (int) [optional] : 1..30, default 30
72
+ | **nextToken** (string) [optional]
73
+
74
+ The contract marks no member as required and the probe answers 400
75
+ "Both identifier and identifierType need to be present." without
76
+ them, so they are required here.
77
+
78
+ Media type
79
+ application/vnd.bhstoreslist.v1+json
80
+
81
+ Returns
82
+ ApiResponse
83
+ | **stores** (list<StoreInfo>) : may be empty; each one 200-tested
84
+ | **storeId** (string)
85
+ | **storeName** (string)
86
+ | **brandEntityId** (string)
87
+ | **storeStatus** (State) : APPROVED | CANCELED | DRAFT | LIVE | PENDING | REJECTED | SCHEDULED
88
+ | **nextToken** (string)
89
+ """
90
+ headers = {
91
+ "Accept": 'application/json',
92
+ "Content-Type": 'application/vnd.bhstoreslist.v1+json',
93
+ }
94
+ return self._request(
95
+ kwargs.pop('path'),
96
+ data=Utils.convert_body(kwargs.pop('body'), False),
97
+ params=kwargs,
98
+ headers=headers,
99
+ )
100
+
101
+ @sp_endpoint('/brand/stores/v1/storePages/list', method='POST', headers=['Amazon-Advertising-API-Scope'])
102
+ def list_store_pages(self, **kwargs) -> ApiResponse:
103
+ r"""
104
+ list_store_pages(body: dict) -> ApiResponse
105
+
106
+ Amazon Ads API v0 - Brand Home ListPages (operationId: ListPages)
107
+
108
+ Request Body [Required]
109
+ | **identifier** (string) : [required] storeId from list_stores
110
+ | **identifierType** (string) : [required] STORE (BRAND_AID_ID answers not supported)
111
+ | **maxResults** (int) [optional] : 1..30, default 30
112
+ | **nextToken** (string) [optional]
113
+
114
+ Media type
115
+ application/vnd.bhstorepageslist.v1+json
116
+
117
+ Returns
118
+ ApiResponse
119
+ | **storePages** (list<StorePageInfo>)
120
+ | **storePageId** (string)
121
+ | **storePageUrl** (string)
122
+ | **storePageName** (string)
123
+ | **storePageStatus** (State)
124
+ | **nextToken** (string)
125
+ """
126
+ headers = {
127
+ "Accept": 'application/json',
128
+ "Content-Type": 'application/vnd.bhstorepageslist.v1+json',
129
+ }
130
+ return self._request(
131
+ kwargs.pop('path'),
132
+ data=Utils.convert_body(kwargs.pop('body'), False),
133
+ params=kwargs,
134
+ headers=headers,
135
+ )
ad_api/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.2.3"
1
+ __version__ = "2.2.4"
@@ -0,0 +1,373 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-amazon-ad-api
3
+ Version: 2.2.4
4
+ Summary: Python wrapper for the Amazon Advertising API
5
+ Home-page: https://github.com/denisneuf/python-amazon-ad-api
6
+ Author: Daniel Alvaro
7
+ Author-email: denisneuf@hotmail.com
8
+ License: MIT
9
+ Project-URL: Bug Tracker, https://github.com/denisneuf/python-amazon-ad-api/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests<2.35.0,>=2.27.1
16
+ Requires-Dist: six<1.18,>=1.16
17
+ Requires-Dist: cachetools<8.1,>=5.0
18
+ Requires-Dist: pycryptodome<4.7,>=3.13
19
+ Requires-Dist: pytz<2027.0,>=2021.3
20
+ Requires-Dist: confuse<2.4,>=1.7
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: home-page
24
+ Dynamic: license
25
+ Dynamic: license-file
26
+ Dynamic: requires-dist
27
+ Dynamic: summary
28
+
29
+ # PYTHON-AMAZON-AD-API
30
+
31
+ ![CodeQL](https://img.shields.io/badge/coverage-82%25-green)
32
+ ![CodeQL](https://img.shields.io/badge/Docs-sphinx-green)
33
+ ![CodeQL](https://img.shields.io/github/v/release/denisneuf/python-amazon-ad-api)
34
+ [![Documentation Status](https://readthedocs.org/projects/python-amazon-ad-api/badge/?version=latest)](https://python-amazon-ad-api.readthedocs.io/en/latest/?badge=latest)
35
+ ![PyPI Downloads](https://static.pepy.tech/badge/python-amazon-ad-api)
36
+ [![Downloads](https://static.pepy.tech/badge/python-amazon-ad-api/month)](https://pepy.tech/project/python-amazon-ad-api)
37
+ [![Downloads](https://static.pepy.tech/badge/python-amazon-ad-api/week)](https://pepy.tech/project/python-amazon-ad-api)
38
+
39
+ ## Amazon's Advertising API
40
+
41
+ A python 3 wrapper to access Amazon's Advertising API with an easy-to-use interface.
42
+
43
+ ### Install
44
+
45
+ [![Badge](https://img.shields.io/pypi/v/python-amazon-ad-api?style=for-the-badge)](https://pypi.org/project/python-amazon-ad-api/)
46
+
47
+ ```
48
+ pip install python-amazon-ad-api
49
+ ```
50
+
51
+ ### Donate
52
+
53
+ If you find this project is useful consider donating or [sponsor](https://github.com/sponsors/denisneuf) it to keep on going on it, thank you.
54
+
55
+ [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate?hosted_button_id=G3KB6M2G9YV9C)
56
+
57
+ ![alt text](https://github.com/denisneuf/python-amazon-ad-api/blob/main/test/codigo-QR.png?raw=true)
58
+
59
+
60
+ ### Overview
61
+
62
+ You need obtain your own credentials with Amazon that may include an amazon developer account and access as seller or vendor. Please view the checklist of [Amazon Ads API onboarding overview](https://advertising.amazon.com/API/docs/en-us/setting-up/overview)
63
+
64
+
65
+ ### Code Credentials
66
+ You can use your credentials as follows passing it to the client as a dict. Please review the full [documentation](https://github.com/sponsors/denisneuf) to see all posibilities to include your credentials.
67
+
68
+ ```javascript
69
+ from ad_api.api import ads_api_v1
70
+
71
+
72
+ my_credentials = dict(
73
+ refresh_token='your-refresh_token',
74
+ client_id='your-client_id',
75
+ client_secret='your-client_secret',
76
+ profile_id='your-profile_id',
77
+ )
78
+
79
+ info = {
80
+ "adProductFilter":
81
+ {
82
+ "include": [
83
+ "SPONSORED_PRODUCTS"
84
+ ]
85
+ },
86
+ "stateFilter":
87
+ {
88
+ "include": [
89
+ "ENABLED"
90
+ ]
91
+ }
92
+ }
93
+
94
+ result = ads_api_v1.Campaigns(credentials=my_credentials).query_campaigns(
95
+ body=info
96
+ )
97
+
98
+ ```
99
+
100
+ ### YAML Credentials
101
+ Use a credentials.yml file with your credentials for more convenience and manage diferent accounts or profiles. Amazon requires one profile per marketplace so it is helpful to keep all in one file and switch directly from the code, using the account.
102
+
103
+ Create a file credentials.yml
104
+
105
+ ```javascript
106
+ version: '1.0'
107
+
108
+ default:
109
+ refresh_token: 'your-refresh-token'
110
+ client_id: 'your-client-id'
111
+ client_secret: 'your-client-secret'
112
+ profile_id: 'your-profile-id'
113
+
114
+ germany:
115
+ refresh_token: 'other-refresh-token'
116
+ client_id: 'other-client-id'
117
+ client_secret: 'other-client-secret'
118
+ profile_id: 'other-profile-id'
119
+
120
+ ```
121
+
122
+ Python code
123
+
124
+ ```python
125
+ from ad_api.api import ads_api_v1
126
+
127
+ info = {
128
+ "adProductFilter":
129
+ {
130
+ "include": [
131
+ "SPONSORED_PRODUCTS"
132
+ ]
133
+ }
134
+ }
135
+
136
+ # Leave empty will use the 'default' account
137
+ result=ads_api_v1.Campaigns().query_campaigns(body=info)
138
+ # will use germany account data
139
+ result=ads_api_v1.Campaigns(account="germany").query_campaigns(body=info)
140
+ ```
141
+
142
+
143
+
144
+ ### Search path for credentials.yml
145
+
146
+ * macOS and Other Unix: `~/.config/python-ad-api`
147
+ * Windows: `%APPDATA%\python-ad-api` where the <cite>APPDATA</cite> environment variable falls
148
+ back to `%HOME%\AppData\Roaming` if undefined
149
+
150
+
151
+ [Confuse Help](https://confuse.readthedocs.io/en/latest/usage.html#search-paths)
152
+
153
+
154
+ ### Marketplaces
155
+
156
+ Marketplaces are used to define basically the [API endpoints](https://advertising.amazon.com/API/docs/en-us/info/api-overview#api-endpoints) Amazon need to use depending on the regions, by default it will use EU so if you are using one of the marketplaces that are under the Europe (EU). Covers UK, FR, IT, ES, DE, NL, AE, SE, PL, and TR marketplaces you can skip. If you are using either North America (NA) or Far East (FE), you will need import from base and pass the marketplace as follows:
157
+
158
+ ```python
159
+ from ad_api.api import ads_api_v1
160
+ from ad_api.base import Marketplaces
161
+
162
+ info = {
163
+ "adProductFilter":
164
+ {
165
+ "include": [
166
+ "SPONSORED_PRODUCTS"
167
+ ]
168
+ }
169
+ }
170
+
171
+ # You can pass NA or US, CA, MX or BR for North America and JP, AU or SG for Far East
172
+ result=ads_api_v1.Campaigns(marketplace=Marketplaces.NA).query_campaigns(body=info)
173
+
174
+ ```
175
+
176
+ ### Exceptions
177
+
178
+ You can use a [try](https://docs.python.org/3.10/reference/compound_stmts.html#try) except statement when you call the API and catch exceptions if some problem ocurred:
179
+
180
+ ```python
181
+ from ad_api.api import ads_api_v1
182
+ from ad_api.base import AdvertisingApiException
183
+
184
+ info = {
185
+ "adProductFilter":
186
+ {
187
+ "include": [
188
+ "SPONSORED_PRODUCTS"
189
+ ]
190
+ },
191
+ "stateFilter":
192
+ {
193
+ "include": [
194
+ "ENABLED"
195
+ ]
196
+ }
197
+ }
198
+
199
+ try:
200
+
201
+ result = ads_api_v1.Campaigns().query_campaigns(
202
+ body=info
203
+ )
204
+
205
+ logging.info(result)
206
+
207
+ except AdvertisingApiException as error:
208
+ logging.info(error)
209
+ ```
210
+
211
+ ### Debug
212
+
213
+ Use debug=True if you want see some logs like the header you submit to the api endpoint, the method and path used among the params and the data submitted if any, to trace some possible errors. Note that the header includes the Authorization bearer token, so do not leave debug output in shared logs.
214
+
215
+ ```python
216
+ from ad_api.api import ads_api_v1
217
+ from ad_api.base import AdvertisingApiException
218
+
219
+
220
+ info = {
221
+ "adProductFilter":
222
+ {
223
+ "include": [
224
+ "SPONSORED_PRODUCTS"
225
+ ]
226
+ },
227
+ "stateFilter":
228
+ {
229
+ "include": [
230
+ "ENABLED"
231
+ ]
232
+ }
233
+ }
234
+
235
+ try:
236
+
237
+ result = ads_api_v1.Campaigns(debug=True).query_campaigns(
238
+ body=info
239
+ )
240
+
241
+ logging.info(result)
242
+
243
+ except AdvertisingApiException as error:
244
+ logging.info(error)
245
+ ```
246
+
247
+
248
+ ### Migrating from 1.x
249
+
250
+ `ad_api.api.Invoices` no longer exists. Amazon serves `/invoices` and
251
+ `/invoices/{invoiceId}` from the same contract as the rest of billing, so both
252
+ methods moved to `Billing`:
253
+
254
+ ```python
255
+ # before
256
+ from ad_api.api import Invoices
257
+ Invoices(account=store).list_invoices()
258
+
259
+ # now
260
+ from ad_api.api import Billing
261
+ Billing(account=store).list_invoices()
262
+ ```
263
+
264
+ ### What is covered
265
+
266
+ Every Amazon Ads API family this package speaks to, and how many modules it
267
+ ships. The per-module detail, with the contract and the vendor page of each
268
+ one, lives in the documentation:
269
+
270
+ **[python-amazon-ad-api.readthedocs.io](https://python-amazon-ad-api.readthedocs.io/en/latest/)**
271
+
272
+ | Family | Modules | Docs |
273
+ |---|---|---|
274
+ | Amazon Ads API v0 | 30 | [v0](https://python-amazon-ad-api.readthedocs.io/en/latest/v0.html) |
275
+ | Amazon Ads API v1 | 19 | [v1](https://python-amazon-ad-api.readthedocs.io/en/latest/v1.html) |
276
+
277
+ Coverage against the whole vendor tree, entries implemented and pending, is on
278
+ [Coverage](https://python-amazon-ad-api.readthedocs.io/en/latest/v0/not_implemented.html)
279
+ and the tree itself on
280
+ [Full Vendor tree](https://python-amazon-ad-api.readthedocs.io/en/latest/v0/full_vendor_tree.html).
281
+
282
+ ### Amazon Ads API v1 - basic example
283
+
284
+ Both `v1` and `ads_api_v1` name the same namespace, so pick whichever reads
285
+ clearer: `from ad_api.api import v1` is shorter, and `ads_api_v1` makes it
286
+ obvious at the call site that the v1 API is being used.
287
+
288
+ ```python
289
+ from ad_api.api import v1
290
+
291
+ result = v1.Campaigns(credentials=credentials, debug=True).query_campaigns(
292
+ body={
293
+ "adProductFilter": {"include": ["SPONSORED_PRODUCTS"]},
294
+ "stateFilter": {"include": ["ENABLED"]},
295
+ "maxResults": 100,
296
+ }
297
+ )
298
+
299
+ campaigns = result.payload.get("campaigns")
300
+ next_token = result.payload.get("nextToken")
301
+ ```
302
+
303
+ ### Simple Example Usage Campaigns with Credentials (v3, legacy)
304
+
305
+ > This example uses `CampaignsV3.list_campaigns`, which is deprecated. See the v1 `query_campaigns` example above.
306
+
307
+ ```python
308
+ import logging
309
+ from ad_api.base import AdvertisingApiException
310
+ from ad_api.api import sponsored_products
311
+
312
+ logging.basicConfig(
313
+ level=logging.DEBUG,
314
+ format="%(asctime)s:%(levelname)s:%(message)s"
315
+ )
316
+
317
+ def sp_list_campaigns_v3(info: dict = None):
318
+
319
+ credentials = dict(
320
+ refresh_token='your-refresh_token',
321
+ client_id='your-client_id',
322
+ client_secret='your-client_secret',
323
+ profile_id='your-profile_id',
324
+ )
325
+
326
+ try:
327
+ result = sponsored_products.CampaignsV3(credentials=credentials, debug=True).list_campaigns(
328
+ body=info
329
+ )
330
+ payload = result.payload
331
+ return payload
332
+ except AdvertisingApiException as error:
333
+ logging.error(error)
334
+ logging.error(error.code)
335
+
336
+
337
+ state_filter = \
338
+ {
339
+ "stateFilter":
340
+ {
341
+ "include": [
342
+ "ENABLED"
343
+ ]
344
+ }
345
+ }
346
+
347
+ enabled_campaigns = sp_list_campaigns_v3(state_filter).get("campaigns")
348
+
349
+
350
+ for campaign in enabled_campaigns:
351
+ logging.info(campaign)
352
+
353
+ logging.info(len(campaigns))
354
+
355
+
356
+
357
+ ```
358
+
359
+ ### API NOTICE
360
+
361
+ This API is based on the [API Client](https://github.com/saleweaver/rapid_rest_client) created by [@saleweaver](https://github.com/saleweaver) but adapted to amazon advertising authentication requeriments
362
+
363
+ ### DISCLAIMER
364
+
365
+ We are not affiliated with Amazon but they used our api :)
366
+
367
+ ### LICENSE
368
+
369
+ ![License](https://img.shields.io/badge/license-MIT-green)
370
+
371
+
372
+ ---
373
+ *Last release: v2.2.3*
@@ -1,6 +1,6 @@
1
1
  ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ad_api/version.py,sha256=3pvG1dVJuHEcdu38cc8mGwpb57ZUjsnbAe_LVURnTPQ,22
3
- ad_api/api/__init__.py,sha256=4p60tAyAZYdSfxNrMQ1IA4vSPVhq9lNH_riZscD-99c,2028
2
+ ad_api/version.py,sha256=7vcEgCSkbhT9Gg0A1zz0ATFhMnUIE2MAurmV3fHzG8g,22
3
+ ad_api/api/__init__.py,sha256=MS9URuCMvZ7c4T2OOWhJg-ovgZHGaxa8wXruPMqRqlc,2079
4
4
  ad_api/api/account.py,sha256=jNYwfjW8b0HhqP7PjlMev55aXJP3YIuqWhrxri0Pk4Y,4673
5
5
  ad_api/api/account_budgets.py,sha256=jFce5eLWAFK3ydjnYR7_Sv7B0-gHTG5bMTx_TcHyy1A,2319
6
6
  ad_api/api/advertising_invitations.py,sha256=TRwULEFi_HVyfK35ABkuZbFOHAdl4tNnGWanxrvX32A,4629
@@ -10,6 +10,7 @@ ad_api/api/attribution.py,sha256=N7aspRbaVK7y8Q1OZ0P9O3CP7gwnS_NzhmNchISFQAI,748
10
10
  ad_api/api/audiences.py,sha256=WuOmHtXyzF1KUXiE9FayXLvb1GI9Q6Z1Y25G2bA-mjc,3575
11
11
  ad_api/api/billing.py,sha256=C_lFVdnymX3V9bg865Bf5f5DMm31IROxvJNYPhvoR7c,29322
12
12
  ad_api/api/brand_benchmarks.py,sha256=ht5EMvGeIb7MA8U2HfQtOj818T6JxM9nEY_HtsBo2H0,3280
13
+ ad_api/api/brand_home.py,sha256=snR-PFT_6NkL_FH_N8liz7Os7DP1I051930pRTzUwvA,5730
13
14
  ad_api/api/brand_metrics.py,sha256=zEOSPffq8j-2vAz_z77EcKU2sa9i1WzzBqswTmoL5yA,9321
14
15
  ad_api/api/creative_assets.py,sha256=u0bCnioUFpGOQO5Z_MO0ErSLcAgSZB5GWM5wm2oW6L0,9687
15
16
  ad_api/api/dsp_advertiser.py,sha256=ztSr0s15Z9scQNKElWxRujexsENn84MT-ihNhijLi_M,1427
@@ -144,8 +145,8 @@ ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4
144
145
  ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
145
146
  ad_api/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
147
  ad_api/shared/base_client.py,sha256=zOL_LTh-58URWf3ZDlrwmqXXbd6PX66QF5hrr2p83yY,356
147
- python_amazon_ad_api-2.2.3.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
148
- python_amazon_ad_api-2.2.3.dist-info/METADATA,sha256=womjg-1GO1RcUoKCSMjtttY5TCZp9vGYYA5RG5bTeDk,54257
149
- python_amazon_ad_api-2.2.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
150
- python_amazon_ad_api-2.2.3.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
151
- python_amazon_ad_api-2.2.3.dist-info/RECORD,,
148
+ python_amazon_ad_api-2.2.4.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
149
+ python_amazon_ad_api-2.2.4.dist-info/METADATA,sha256=4LuqczC5B4BLwABm3At8dVNOznLmGRV1mMzwpPccfHg,10678
150
+ python_amazon_ad_api-2.2.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
151
+ python_amazon_ad_api-2.2.4.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
152
+ python_amazon_ad_api-2.2.4.dist-info/RECORD,,
@@ -1,570 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: python-amazon-ad-api
3
- Version: 2.2.3
4
- Summary: Python wrapper for the Amazon Advertising API
5
- Home-page: https://github.com/denisneuf/python-amazon-ad-api
6
- Author: Daniel Alvaro
7
- Author-email: denisneuf@hotmail.com
8
- License: MIT
9
- Project-URL: Bug Tracker, https://github.com/denisneuf/python-amazon-ad-api/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: requests<2.35.0,>=2.27.1
16
- Requires-Dist: six<1.18,>=1.16
17
- Requires-Dist: cachetools<8.1,>=5.0
18
- Requires-Dist: pycryptodome<4.7,>=3.13
19
- Requires-Dist: pytz<2027.0,>=2021.3
20
- Requires-Dist: confuse<2.4,>=1.7
21
- Dynamic: author
22
- Dynamic: author-email
23
- Dynamic: home-page
24
- Dynamic: license
25
- Dynamic: license-file
26
- Dynamic: requires-dist
27
- Dynamic: summary
28
-
29
- # PYTHON-AMAZON-AD-API
30
-
31
- ![CodeQL](https://img.shields.io/badge/coverage-95%25-green)
32
- ![CodeQL](https://img.shields.io/badge/Docs-sphinx-green)
33
- ![CodeQL](https://img.shields.io/github/v/release/denisneuf/python-amazon-ad-api)
34
- [![Documentation Status](https://readthedocs.org/projects/python-amazon-ad-api/badge/?version=latest)](https://python-amazon-ad-api.readthedocs.io/en/latest/?badge=latest)
35
- ![PyPI Downloads](https://static.pepy.tech/badge/python-amazon-ad-api)
36
- [![Downloads](https://static.pepy.tech/badge/python-amazon-ad-api/month)](https://pepy.tech/project/python-amazon-ad-api)
37
- [![Downloads](https://static.pepy.tech/badge/python-amazon-ad-api/week)](https://pepy.tech/project/python-amazon-ad-api)
38
-
39
- ## Amazon's Advertising API
40
-
41
- A python 3 wrapper to access Amazon's Advertising API with an easy-to-use interface.
42
-
43
- ### Install
44
-
45
- [![Badge](https://img.shields.io/pypi/v/python-amazon-ad-api?style=for-the-badge)](https://pypi.org/project/python-amazon-ad-api/)
46
-
47
- ```
48
- pip install python-amazon-ad-api
49
- ```
50
-
51
- ### Donate
52
-
53
- If you find this project is useful consider donating or [sponsor](https://github.com/sponsors/denisneuf) it to keep on going on it, thank you.
54
-
55
- [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate?hosted_button_id=G3KB6M2G9YV9C)
56
-
57
- ![alt text](https://github.com/denisneuf/python-amazon-ad-api/blob/main/test/codigo-QR.png?raw=true)
58
-
59
-
60
- ### Overview
61
-
62
- You need obtain your own credentials with Amazon that may include an amazon developer account and access as seller or vendor. Please view the checklist of [Amazon Ads API onboarding overview](https://advertising.amazon.com/API/docs/en-us/setting-up/overview)
63
-
64
-
65
- ### Code Credentials
66
- You can use your credentials as follows passing it to the client as a dict. Please review the full [documentation](https://github.com/sponsors/denisneuf) to see all posibilities to include your credentials.
67
-
68
- ```javascript
69
- from ad_api.api import ads_api_v1
70
-
71
-
72
- my_credentials = dict(
73
- refresh_token='your-refresh_token',
74
- client_id='your-client_id',
75
- client_secret='your-client_secret',
76
- profile_id='your-profile_id',
77
- )
78
-
79
- info = {
80
- "adProductFilter":
81
- {
82
- "include": [
83
- "SPONSORED_PRODUCTS"
84
- ]
85
- },
86
- "stateFilter":
87
- {
88
- "include": [
89
- "ENABLED"
90
- ]
91
- }
92
- }
93
-
94
- result = ads_api_v1.Campaigns(credentials=my_credentials).query_campaigns(
95
- body=info
96
- )
97
-
98
- ```
99
-
100
- ### YAML Credentials
101
- Use a credentials.yml file with your credentials for more convenience and manage diferent accounts or profiles. Amazon requires one profile per marketplace so it is helpful to keep all in one file and switch directly from the code, using the account.
102
-
103
- Create a file credentials.yml
104
-
105
- ```javascript
106
- version: '1.0'
107
-
108
- default:
109
- refresh_token: 'your-refresh-token'
110
- client_id: 'your-client-id'
111
- client_secret: 'your-client-secret'
112
- profile_id: 'your-profile-id'
113
-
114
- germany:
115
- refresh_token: 'other-refresh-token'
116
- client_id: 'other-client-id'
117
- client_secret: 'other-client-secret'
118
- profile_id: 'other-profile-id'
119
-
120
- ```
121
-
122
- Python code
123
-
124
- ```python
125
- from ad_api.api import ads_api_v1
126
-
127
- info = {
128
- "adProductFilter":
129
- {
130
- "include": [
131
- "SPONSORED_PRODUCTS"
132
- ]
133
- }
134
- }
135
-
136
- # Leave empty will use the 'default' account
137
- result=ads_api_v1.Campaigns().query_campaigns(body=info)
138
- # will use germany account data
139
- result=ads_api_v1.Campaigns(account="germany").query_campaigns(body=info)
140
- ```
141
-
142
-
143
-
144
- ### Search path for credentials.yml
145
-
146
- * macOS and Other Unix: `~/.config/python-ad-api`
147
- * Windows: `%APPDATA%\python-ad-api` where the <cite>APPDATA</cite> environment variable falls
148
- back to `%HOME%\AppData\Roaming` if undefined
149
-
150
-
151
- [Confuse Help](https://confuse.readthedocs.io/en/latest/usage.html#search-paths)
152
-
153
-
154
- ### Marketplaces
155
-
156
- Marketplaces are used to define basically the [API endpoints](https://advertising.amazon.com/API/docs/en-us/info/api-overview#api-endpoints) Amazon need to use depending on the regions, by default it will use EU so if you are using one of the marketplaces that are under the Europe (EU). Covers UK, FR, IT, ES, DE, NL, AE, SE, PL, and TR marketplaces you can skip. If you are using either North America (NA) or Far East (FE), you will need import from base and pass the marketplace as follows:
157
-
158
- ```python
159
- from ad_api.api import ads_api_v1
160
- from ad_api.base import Marketplaces
161
-
162
- info = {
163
- "adProductFilter":
164
- {
165
- "include": [
166
- "SPONSORED_PRODUCTS"
167
- ]
168
- }
169
- }
170
-
171
- # You can pass NA or US, CA, MX or BR for North America and JP, AU or SG for Far East
172
- result=ads_api_v1.Campaigns(marketplace=Marketplaces.NA).query_campaigns(body=info)
173
-
174
- ```
175
-
176
- ### Exceptions
177
-
178
- You can use a [try](https://docs.python.org/3.10/reference/compound_stmts.html#try) except statement when you call the API and catch exceptions if some problem ocurred:
179
-
180
- ```python
181
- from ad_api.api import ads_api_v1
182
- from ad_api.base import AdvertisingApiException
183
-
184
- info = {
185
- "adProductFilter":
186
- {
187
- "include": [
188
- "SPONSORED_PRODUCTS"
189
- ]
190
- },
191
- "stateFilter":
192
- {
193
- "include": [
194
- "ENABLED"
195
- ]
196
- }
197
- }
198
-
199
- try:
200
-
201
- result = ads_api_v1.Campaigns().query_campaigns(
202
- body=info
203
- )
204
-
205
- logging.info(result)
206
-
207
- except AdvertisingApiException as error:
208
- logging.info(error)
209
- ```
210
-
211
- ### Debug
212
-
213
- Use debug=True if you want see some logs like the header you submit to the api endpoint, the method and path used among the params and the data submitted if any, to trace some possible errors. Note that the header includes the Authorization bearer token, so do not leave debug output in shared logs.
214
-
215
- ```python
216
- from ad_api.api import ads_api_v1
217
- from ad_api.base import AdvertisingApiException
218
-
219
-
220
- info = {
221
- "adProductFilter":
222
- {
223
- "include": [
224
- "SPONSORED_PRODUCTS"
225
- ]
226
- },
227
- "stateFilter":
228
- {
229
- "include": [
230
- "ENABLED"
231
- ]
232
- }
233
- }
234
-
235
- try:
236
-
237
- result = ads_api_v1.Campaigns(debug=True).query_campaigns(
238
- body=info
239
- )
240
-
241
- logging.info(result)
242
-
243
- except AdvertisingApiException as error:
244
- logging.info(error)
245
- ```
246
-
247
-
248
- ### Migrating from 1.x
249
-
250
- `ad_api.api.Invoices` no longer exists. Amazon serves `/invoices` and
251
- `/invoices/{invoiceId}` from the same contract as the rest of billing, so both
252
- methods moved to `Billing`:
253
-
254
- ```python
255
- # before
256
- from ad_api.api import Invoices
257
- Invoices(account=store).list_invoices()
258
-
259
- # now
260
- from ad_api.api import Billing
261
- Billing(account=store).list_invoices()
262
- ```
263
-
264
- ### [Modules Available Common Resources](https://python-amazon-ad-api.readthedocs.io/en/latest/api.html)
265
-
266
- | Module | Vendor contract | Vendor docs |
267
- |---|---|---|
268
- | [Profiles](https://python-amazon-ad-api.readthedocs.io/en/latest/api/profiles.html) | [contract](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/profiles/3-0/openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/2/profiles) |
269
- | [Manager Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/api/manager_accounts.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/ManagerAccount_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/1-0/managerAccount) |
270
- | [PortfoliosV3](https://python-amazon-ad-api.readthedocs.io/en/latest/api/portfoliosV3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Portfolios_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/portfolios) |
271
- | [Billing](https://python-amazon-ad-api.readthedocs.io/en/latest/api/billing.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingBilling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/billing) |
272
- | [Account Budgets](https://python-amazon-ad-api.readthedocs.io/en/latest/api/account_budgets.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Advertisers_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/account-budgets/) |
273
- | [Audiences](https://python-amazon-ad-api.readthedocs.io/en/latest/api/audiences.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Audiences_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/audiences/) |
274
- | [Change History](https://python-amazon-ad-api.readthedocs.io/en/latest/api/history.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Changehistory_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/change-history/) |
275
- | [Creative Assets](https://python-amazon-ad-api.readthedocs.io/en/latest/api/creative_assets.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/creative-asset-library-openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/creative-asset-library) |
276
- | [Eligibility](https://python-amazon-ad-api.readthedocs.io/en/latest/api/eligibility.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Eligibility_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/eligibility-prod-3p) |
277
- | [Insights](https://python-amazon-ad-api.readthedocs.io/en/latest/api/insights.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Insights_prod_3p.json) | - |
278
- | [Localization](https://python-amazon-ad-api.readthedocs.io/en/latest/api/localization.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Localization_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/localization/) |
279
- | [Product Selector](https://python-amazon-ad-api.readthedocs.io/en/latest/api/metadata.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/ProductSelector_prod_3p.json) | - |
280
- | [Validation Configurations](https://python-amazon-ad-api.readthedocs.io/en/latest/api/validation_configurations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/ValidationConfigurationsAPI_prod_3p.json) | - |
281
- | [Tactical recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/api/recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Recommendations_prod_3p.json) | - |
282
- | [Exports](https://python-amazon-ad-api.readthedocs.io/en/latest/api/exports.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIExports_prod_3p.json) | - |
283
-
284
- ### [Amazon Attribution open beta](https://python-amazon-ad-api.readthedocs.io/en/latest/api/attribution.html)
285
-
286
- | Operation | Vendor contract | Vendor docs |
287
- |---|---|---|
288
- | [Advertisers](https://python-amazon-ad-api.readthedocs.io/en/latest/api/attribution.html#ad_api.api.Attribution.Attribution.get_advertisers) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAttribution_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/amazon-attribution-prod-3p) |
289
- | [Publishers](https://python-amazon-ad-api.readthedocs.io/en/latest/api/attribution.html#ad_api.api.Attribution.Attribution.get_publishers) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAttribution_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/amazon-attribution-prod-3p) |
290
- | [Macro tags](https://python-amazon-ad-api.readthedocs.io/en/latest/api/attribution.html#ad_api.api.Attribution.Attribution.get_macro_tag) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAttribution_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/amazon-attribution-prod-3p) |
291
- | [Non Macro tags](https://python-amazon-ad-api.readthedocs.io/en/latest/api/attribution.html#ad_api.api.Attribution.Attribution.get_non_macro_template_tag) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAttribution_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/amazon-attribution-prod-3p) |
292
- | [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/api/attribution.html#ad_api.api.Attribution.Attribution.post_report) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAttribution_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/amazon-attribution-prod-3p) |
293
-
294
- ### [Brand Benchmarks](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_benchmarks.html)
295
-
296
- | Operation | Vendor contract | Vendor docs |
297
- |---|---|---|
298
- | [List Advertiser Report Metadata](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_benchmarks/list_advertiser_report_metadata.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/BrandBenchmarks_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/brand-benchmarks) |
299
- | [Get Advertiser Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_benchmarks/get_advertiser_report.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/BrandBenchmarks_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/brand-benchmarks) |
300
-
301
- ### [Marketing Mix Modeling](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling.html)
302
-
303
- | Operation | Vendor contract | Vendor docs |
304
- |---|---|---|
305
- | [List Brand Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/list_brand_groups.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
306
- | [Get Brand Group Campaigns](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/get_brand_group_campaigns.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
307
- | [Get Brand Group Products](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/get_brand_group_products.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
308
- | [Create Brand Group Overrides](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/create_brand_group_overrides.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
309
- | [List Brand Group Overrides](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/list_brand_group_overrides.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
310
- | [Delete Brand Group Overrides](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/delete_brand_group_overrides.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
311
- | [Create Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/create_report.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
312
- | [List Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/list_reports.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
313
- | [Get Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/get_report.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
314
- | [Delete Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/marketing_mix_modeling/delete_report.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/MarketingMixModeling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/marketing-mix-modeling) |
315
-
316
- ### [Brand Metrics (beta)](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_metrics.html)
317
-
318
- | Operation | Vendor contract | Vendor docs |
319
- |---|---|---|
320
- | [Post Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_metrics.html#ad_api.api.BrandMetrics.BrandMetrics.post_report) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/BrandMetrics_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/guides/reporting/brand-metrics/overview) |
321
- | [Get Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_metrics.html#ad_api.api.BrandMetrics.BrandMetrics.get_report) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/BrandMetrics_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/guides/reporting/brand-metrics/overview) |
322
- | [Download Report](https://python-amazon-ad-api.readthedocs.io/en/latest/api/brand_metrics.html#ad_api.api.BrandMetrics.BrandMetrics.download_report) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/BrandMetrics_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/guides/reporting/brand-metrics/overview) |
323
-
324
- ### [Advertising Test Account](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html)
325
-
326
- | Operation | Vendor contract | Vendor docs |
327
- |---|---|---|
328
- | [Create test account](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html#ad_api.api.AdvertisingTestAccount) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingTestAccount_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/test-accounts/openapi) |
329
- | [Get test account information](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html#ad_api.api.AdvertisingTestAccount.AdvertisingTestAccount.get_test_account) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingTestAccount_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/test-accounts/openapi) |
330
-
331
- ### [Advertising Invitations](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_invitations.html)
332
-
333
- | Operation | Vendor contract | Vendor docs |
334
- |---|---|---|
335
- | [Create user invitations](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_invitations.html#ad_api.api.AdvertisingInvitations.AdvertisingInvitations.create_user_invitations) | [contract](https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/AdvertisingInvitations_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-invitations) |
336
- | [Update user invitations](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_invitations.html#ad_api.api.AdvertisingInvitations.AdvertisingInvitations.update_user_invitations) | [contract](https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/AdvertisingInvitations_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-invitations) |
337
- | [List user invitations](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_invitations.html#ad_api.api.AdvertisingInvitations.AdvertisingInvitations.list_user_invitations) | [contract](https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/AdvertisingInvitations_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-invitations) |
338
- | [Redeem user invitation](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_invitations.html#ad_api.api.AdvertisingInvitations.AdvertisingInvitations.redeem_user_invitation) | [contract](https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/AdvertisingInvitations_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-invitations) |
339
- | [Get user invitation](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_invitations.html#ad_api.api.AdvertisingInvitations.AdvertisingInvitations.get_user_invitation) | [contract](https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/AdvertisingInvitations_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-invitations) |
340
-
341
- ### [Advertising User Permissions Management](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_user_permissions.html)
342
-
343
- | Operation | Vendor contract | Vendor docs |
344
- |---|---|---|
345
- | [Update user permissions](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_user_permissions.html#ad_api.api.AdvertisingUserPermissions.AdvertisingUserPermissions.update_user_permissions) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingUserPermissionsManagement_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-permissions) |
346
- | [Delete user permissions](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_user_permissions.html#ad_api.api.AdvertisingUserPermissions.AdvertisingUserPermissions.delete_user_permissions) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingUserPermissionsManagement_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-permissions) |
347
- | [Query user permissions](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_user_permissions.html#ad_api.api.AdvertisingUserPermissions.AdvertisingUserPermissions.query_user_permissions) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingUserPermissionsManagement_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-permissions) |
348
- | [Query user roles](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_user_permissions.html#ad_api.api.AdvertisingUserPermissions.AdvertisingUserPermissions.query_user_roles) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingUserPermissionsManagement_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-permissions) |
349
- | [List users](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_user_permissions.html#ad_api.api.AdvertisingUserPermissions.AdvertisingUserPermissions.list_users) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingUserPermissionsManagement_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/user-permissions) |
350
-
351
- ### [DSP Advertiser Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/api/dsp_advertiser.html)
352
-
353
- > Both routes require a DSP profile: `accountInfo.type` must be `agency` and `subType` must not be `AMAZON_ATTRIBUTION`. They have not been exercised against the API from this package; a seller profile cannot reach them.
354
-
355
- | Operation | Vendor contract | Vendor docs |
356
- |---|---|---|
357
- | [List advertisers](https://python-amazon-ad-api.readthedocs.io/en/latest/api/dsp_advertiser.html#ad_api.api.DspAdvertiser.DspAdvertiser.list_advertisers) | [contract](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/dsp/3-0/advertiser.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/dsp-advertiser) |
358
- | [Get advertiser](https://python-amazon-ad-api.readthedocs.io/en/latest/api/dsp_advertiser.html#ad_api.api.DspAdvertiser.DspAdvertiser.get_advertiser) | [contract](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/dsp/3-0/advertiser.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/dsp-advertiser) |
359
-
360
- ### [Amazon Ads API v1 (new, unified)](https://python-amazon-ad-api.readthedocs.io/en/latest/v1.html)
361
-
362
- > The v1 API lives under `/adsApi/v1/` and is **not** split by product: every call targets the same resource and the product is selected in the request body with `adProductFilter`. It supersedes the per-product v3 endpoints.
363
-
364
- | Module | Vendor contract | Vendor docs |
365
- |---|---|---|
366
- | [Campaigns](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/campaigns.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLCampaignsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-campaigns) |
367
- | [Ad Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/ad_groups.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLAdGroupsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-adgroups) |
368
- | [Ads](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/ads.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLAdsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-ads) |
369
- | [Targets](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/targets.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLTargetsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-targets) |
370
- | [Ad Extensions](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/ad_extensions.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLAdExtensionsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-adextensions) |
371
- | [Advertiser Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/advertiser_accounts.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLAdvertiserAccountsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-advertiseraccounts) |
372
- | [Ad Associations](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/ad_associations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLAdAssociationsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-adassociations) |
373
- | [Brand Store Edition Publish Versions](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/brand_store_edition_publish_versions.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLBrandStoreEditionPublishVersionsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-brandstoreeditionpublishversions) |
374
- | [Brand Stores](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/brand_stores.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLBrandStoresContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-brandstores) |
375
- | [Brand Store Editions](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/brand_store_editions.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLBrandStoreEditionsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-brandstoreeditions) |
376
- | [Brand Store Pages](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/brand_store_pages.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLBrandStorePagesContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-brandstorepages) |
377
- | [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/reports.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLReportsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-reports) |
378
- | [Labels](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/labels.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLLabelsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-labels) |
379
- | [Manager Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/manager_accounts.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLManagerAccountsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-manager-accounts) |
380
- | [Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLRecommendationsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-recommendations) |
381
- | [Selling Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/selling_accounts.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLSellingAccountsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-selling-accounts) |
382
- | [Label Object Associations](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/label_object_associations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLLabelObjectAssociationsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-label-object-associations) |
383
- | [Geo Locations](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/geo_locations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLGeoLocationsContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-geolocations) |
384
- | [Location Indexes](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/location_indexes.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLLocationIndexesContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-locationindexes) |
385
- | [Recommendation Types](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/recommendation_types.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLRecommendationTypesContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-recommendation-types) |
386
- | [Portfolios](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/portfolios.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AmazonAdsAPIALLPortfoliosContract_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/api-spec-v1-portfolios) |
387
-
388
- ### [Modules Available Sponsored Products](https://python-amazon-ad-api.readthedocs.io/en/latest/sp.html)
389
-
390
- > The campaign, ad group and product ad operations are deprecated in favour of the v1 endpoints. In product targeting only the four CRUD operations are deprecated; its helper endpoints remain supported. Keywords, negative keywords and negative product targeting have no v1 equivalent yet and stay supported.
391
-
392
- | Module | Vendor contract | Vendor docs |
393
- |---|---|---|
394
- | [ThemeBased Bid Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/bid_recommendations_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
395
- | [Keyword Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/ranked_keywords_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
396
- | [Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/keywords_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
397
- | [Negative Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/negative_keywords_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
398
- | [Product Targeting](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/product_targeting_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
399
- | [Campaign Optimization](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/campaign_optimization_rules.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
400
- | [Budget Rules](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/budget_rules.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
401
- | [Product Ads](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/product_ads_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
402
- | [Negative Targeting Clauses](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/negative_product_targeting_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
403
- | [Campaign Negative Targeting Clauses](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/campaign_negative_targets.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
404
- | [Product Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/product_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
405
- | [Budget Rules Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/budget_rules_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
406
- | [Campaigns](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/campaigns_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
407
- | [Ad Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/ad_groups_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
408
- | [Consolidated Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/campaigns_consolidated_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
409
- | [Campaign Negative Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/campaign_negative_keywords_v3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
410
- | [Budget recommendations and missed opportunities](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/budget_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
411
- | [Budget Usage](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/campaign_budget_usage.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
412
- | [Version 3 reporting](https://python-amazon-ad-api.readthedocs.io/en/latest/api/reports.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/OfflineReport_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/offline-report-prod-3p) |
413
- | [Target Promotion Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/target_promotion_groups.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
414
- | [Initial Budget Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/budget_initial_recommendation.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
415
- | [Keyword Group Targeting Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/keyword_groups_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
416
- | [Multi Country Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/global_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod) |
417
-
418
- ### [Modules Available Sponsored Brands 3.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sb_v3.html)
419
-
420
- > Campaigns and Ad Groups are deprecated in v3: Amazon answers `403 Endpoint has been deprecated` and points to the v4 API. Use the 4.0 section below for those two.
421
-
422
- | Module | Vendor contract | Vendor docs |
423
- |---|---|---|
424
- | [Campaigns (deprecated)](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/campaigns.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
425
- | [Ad Groups (deprecated)](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ad_groups.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
426
- | [Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/keywords.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
427
- | [Negative Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/negative_keywords.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
428
- | [Keywords Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/keywords_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
429
- | [Product Targeting](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/product_targeting.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
430
- | [Negative Product Targeting](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/negative_product_targeting.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
431
- | [Targeting Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/targeting_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
432
- | [Bid Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/bid_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
433
- | [Benchmarks](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/benchmarks.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
434
- | [Stores](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/stores.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
435
- | [Landing Page Asins](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/landing_page_asins.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
436
- | [Media](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/media.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
437
- | [Brands](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/brands.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
438
- | [Themes](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/themes.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
439
- | [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/reports.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi) |
440
-
441
- ### [Modules Available Sponsored Brands 4.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sb_v4.html)
442
-
443
- > The 4.0 contract is fully covered: every operation is implemented except the campaign moderation route, which the service answers with a router `404`, and the report download, which resolves through the shared `_download` helper.
444
-
445
- | Module | Vendor contract | Vendor docs |
446
- |---|---|---|
447
- | [Campaigns](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/campaigns_v4.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
448
- | [Ad Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ad_groups_v4.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
449
- | [Ads](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ads_v4.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
450
- | [Ad Creatives](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ad_creatives_v4.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
451
- | [Forecast](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/forecast.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
452
- | [Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
453
- | [Budget Rules](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/budget_rules.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
454
- | [Optimization Rules](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/optimization_rules.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
455
- | [Targeting Categories](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/targeting_categories.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
456
- | [Migration](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/migration.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-brands_4-0_openapi.json) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi/prod) |
457
-
458
- > Most 4.0 routes take a versioned media type and the service routes on it. With `application/json` they answer `404 Could not find resource`, which reads like a missing route but is only the wrong media type. This affects forecasts, budget recommendations, optimization rules, migrations, insights, negative brand recommendations and the collection creatives.
459
-
460
- ### [Modules Available Sponsored Display](https://python-amazon-ad-api.readthedocs.io/en/latest/sd.html)
461
-
462
- | Module | Vendor contract | Vendor docs |
463
- |---|---|---|
464
- | [Campaigns](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/campaigns.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
465
- | [Ad Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/ad_groups.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
466
- | [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/reports.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
467
- | [Product Ads](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/product_ads.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
468
- | [Targets](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/product_targeting.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
469
- | [Negative Targets](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/negative_product_targeting.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
470
- | [Targets Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/targeting_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
471
- | [Bid Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/bid_recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
472
- | [Creatives](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/creatives.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
473
- | [Brand Safety List](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/brand_safety.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
474
- | [Budget Rules](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/budget_rules.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
475
- | [Campaigns Budget Usage](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/campaign_budget_usage.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
476
- | [Forecasts](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/forecast.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
477
- | [Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sd/recommendations.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/sponsored-display_3-0_openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/sponsored-display/3-0/openapi) |
478
-
479
- ### Amazon Ads API v1 - basic example
480
-
481
- Both `v1` and `ads_api_v1` name the same namespace, so pick whichever reads
482
- clearer: `from ad_api.api import v1` is shorter, and `ads_api_v1` makes it
483
- obvious at the call site that the v1 API is being used.
484
-
485
- ```python
486
- from ad_api.api import v1
487
-
488
- result = v1.Campaigns(credentials=credentials, debug=True).query_campaigns(
489
- body={
490
- "adProductFilter": {"include": ["SPONSORED_PRODUCTS"]},
491
- "stateFilter": {"include": ["ENABLED"]},
492
- "maxResults": 100,
493
- }
494
- )
495
-
496
- campaigns = result.payload.get("campaigns")
497
- next_token = result.payload.get("nextToken")
498
- ```
499
-
500
- ### Simple Example Usage Campaigns with Credentials (v3, legacy)
501
-
502
- > This example uses `CampaignsV3.list_campaigns`, which is deprecated. See the v1 `query_campaigns` example above.
503
-
504
- ```python
505
- import logging
506
- from ad_api.base import AdvertisingApiException
507
- from ad_api.api import sponsored_products
508
-
509
- logging.basicConfig(
510
- level=logging.DEBUG,
511
- format="%(asctime)s:%(levelname)s:%(message)s"
512
- )
513
-
514
- def sp_list_campaigns_v3(info: dict = None):
515
-
516
- credentials = dict(
517
- refresh_token='your-refresh_token',
518
- client_id='your-client_id',
519
- client_secret='your-client_secret',
520
- profile_id='your-profile_id',
521
- )
522
-
523
- try:
524
- result = sponsored_products.CampaignsV3(credentials=credentials, debug=True).list_campaigns(
525
- body=info
526
- )
527
- payload = result.payload
528
- return payload
529
- except AdvertisingApiException as error:
530
- logging.error(error)
531
- logging.error(error.code)
532
-
533
-
534
- state_filter = \
535
- {
536
- "stateFilter":
537
- {
538
- "include": [
539
- "ENABLED"
540
- ]
541
- }
542
- }
543
-
544
- enabled_campaigns = sp_list_campaigns_v3(state_filter).get("campaigns")
545
-
546
-
547
- for campaign in enabled_campaigns:
548
- logging.info(campaign)
549
-
550
- logging.info(len(campaigns))
551
-
552
-
553
-
554
- ```
555
-
556
- ### API NOTICE
557
-
558
- This API is based on the [API Client](https://github.com/saleweaver/rapid_rest_client) created by [@saleweaver](https://github.com/saleweaver) but adapted to amazon advertising authentication requeriments
559
-
560
- ### DISCLAIMER
561
-
562
- We are not affiliated with Amazon but they used our api :)
563
-
564
- ### LICENSE
565
-
566
- ![License](https://img.shields.io/badge/license-MIT-green)
567
-
568
-
569
- ---
570
- *Last release: v1.6.0*