Amazon Affiliate Integration Setup
This guide covers setting up Amazon Product Advertising API (PA-API) integration for catalog items.Overview
The catalog system supports Amazon affiliate products through two methods:- Simple Affiliate Links — Direct affiliate URLs (e.g.,
amzn.toshort links) - Product Advertising API — Full product data enrichment via Amazon PA-API 5.0
Quick Start: Simple Affiliate Links
For basic affiliate link integration (no API required):Amazon Product Advertising API Setup
For full product data (prices, images, ratings, availability):1. Prerequisites
- Amazon Associates account (associates.amazon.com)
- Product Advertising API access (apply via Associates dashboard)
- Approved API credentials
2. Environment Variables
Add to your.env or environment configuration:
3. Install Dependencies
4. API Client
The client lives atsyntropy_journals/app/integrations/amazon/client.py and provides:
AmazonProductAPI.get_item_by_asin(asin)— Fetch product details by ASINextract_asin_from_url(url)— Extract ASIN from Amazon URLsresolve_short_link(short_url)— Resolveamzn.toshort links
5. Enrichment Service
The enrichment service atsyntropy_journals/app/integrations/amazon/enrichment.py provides:
enrich_amazon_item(session, item)— Enrich a single catalog item with PA-API dataenrich_all_pending_items(session)— Batch enrich all items flagged for enrichment
Rate Limits
| Traffic Level | Requests/Day | Requests/Second |
|---|---|---|
| New Associate | 8,640 | 0.1 |
| Growing | 86,400 | 1 |
| Established | 864,000 | 10 |
Best Practices
- Cache responses — Store product data locally, refresh daily
- Batch requests — Use
GetItemsfor multiple ASINs (max 10 per request) - Handle errors gracefully — Fall back to cached/manual data
- Respect rate limits — Implement exponential backoff
- Keep affiliate tags consistent — Use environment variables
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
| ”Request is throttled” | Rate limit exceeded | Implement caching and backoff |
| ”InvalidParameterValue” | Bad ASIN format | Check ASIN is 10 alphanumeric chars starting with B0 |
| ”ItemsNotFound” | Product unavailable | Check marketplace availability |
Related Documentation
- Architecture — Catalog model structure
- Environment Variables — Configuration
- Amazon PA-API 5.0 Docs