Before you can make any API calls, you need to:
This chapter walks through each step.
Navigate to Etsy’s Developer Portal and sign in with your Etsy account. You must use the same account that owns your shop.
Etsy requires you to accept their API Terms of Use before creating applications. Read through them carefully—they include important restrictions on:
| Field | Recommendation |
|---|---|
| App Name | Something descriptive like “My Shop Automation” |
| Description | Explain what you’ll use it for |
| App Website | Your shop URL or personal site |
| App Type | Select “Seller tool” for shop management |
Once approved, you’ll receive:
⚠️ Never share your Shared Secret or commit it to public repositories.
Etsy currently uses Open API v3, which replaced the older v2 API. Key characteristics:
https://openapi.etsy.com/v3/When authenticating, you request specific permissions (scopes):
| Scope | Description |
|---|---|
listings_r |
Read your listings |
listings_w |
Create and modify listings |
listings_d |
Delete listings |
transactions_r |
Read your sales/transactions |
profile_r |
Read your profile information |
shops_r |
Read your shop information |
shops_w |
Modify shop settings |
For digital products management, you’ll typically need:
listings_r listings_w listings_d transactions_r shops_r
Create a clean project structure:
etsy-automation/
├── .env # Credentials (never commit!)
├── .gitignore # Exclude sensitive files
├── requirements.txt # Python dependencies
├── config.py # Configuration management
├── auth.py # OAuth authentication
├── client.py # API client wrapper
└── scripts/ # Your automation scripts
└── update_prices.py
Store your credentials in a .env file:
# .env
ETSY_API_KEY=your_keystring_here
ETSY_API_SECRET=your_shared_secret_here
ETSY_REDIRECT_URI=http://localhost:3000/callback
ETSY_SHOP_ID=your_shop_id
Always exclude sensitive files:
# .gitignore
.env
*.pyc
__pycache__/
tokens.json
Create a requirements.txt:
requests>=2.28.0
python-dotenv>=1.0.0
Install with:
pip install -r requirements.txt
The first piece of code we need is a configuration manager. See the complete implementation in code/config.py.
Here’s the key part:
import os
from dotenv import load_dotenv
load_dotenv()
class Config:
API_KEY = os.getenv("ETSY_API_KEY")
API_SECRET = os.getenv("ETSY_API_SECRET")
REDIRECT_URI = os.getenv("ETSY_REDIRECT_URI")
SHOP_ID = os.getenv("ETSY_SHOP_ID")
BASE_URL = "https://openapi.etsy.com/v3"
This pattern keeps your credentials separate from your code.
You’ll need your Shop ID for most API operations. There are two ways to find it:
Your shop URL format is etsy.com/shop/YourShopName. The shop ID is different from the name—you need to look it up via the API.
Once authenticated, you can find your shop ID:
# After authentication (covered in next chapter)
response = requests.get(
f"{BASE_URL}/application/shops",
headers={"Authorization": f"Bearer {access_token}"}
)
shop_id = response.json()["results"][0]["shop_id"]
print(f"Your Shop ID: {shop_id}")
Before moving to authentication, verify your setup:
# test_setup.py
from config import Config
# Check all required variables are set
required = ["API_KEY", "API_SECRET", "REDIRECT_URI"]
missing = [var for var in required if not getattr(Config, var)]
if missing:
print(f"❌ Missing configuration: {', '.join(missing)}")
else:
print("✅ Configuration complete!")
print(f" API Key: {Config.API_KEY[:8]}...")
Run it:
python test_setup.py
Etsy enforces rate limits to prevent abuse:
| Limit Type | Value |
|---|---|
| Per-second burst | 10 requests |
| Daily limit | 10,000 requests |
| Per-listing updates | Limited (varies) |
For digital product shops with hundreds of listings, these limits are usually sufficient. We’ll cover handling rate limits in the Error Handling chapter.
.env.env is in your project rootload_dotenv() before accessing variablesWith your credentials ready and project structure in place, the next chapter covers OAuth 2.0 authentication—the process of obtaining an access token that lets you make API calls on behalf of your shop.
| ← Previous: Introduction | Next: Authentication → |