Automated Product Uploader for Printify
This script automates the process of uploading products to Printify shops. It reads product data from a CSV file, including SKUs, titles, descriptions, tags, and images, then uploads each product to specified Printify shop IDs using their API. It handles image uploads, sets product variants, and assigns prices based on predefined settings.

CSV Example



import os
import requests
import pandas as pd
import base64

# API credentials
access_token = “YOUR KEY HERE”

# List of shop IDs for iteration
shop_ids = [YOUR SHOP ID HERE”] # Add more shop IDs to this list as needed

# Base URL for API endpoints
base_url = “”

# Path to your CSV file
csv_path = “products.csv”
image_df = pd.read_csv(csv_path)

# Headers for your requests
headers = {
“Authorization”: f”Bearer {access_token}”,
“Content-Type”: “application/json”

# Define your variants and prices
variant_prices = {
87919: 995,
87920: 1495,
87921: 1995,
87922: 3495

# Path to the directory where your images are stored
images_directory = r”C:\etsy_automation\images”

# Main loop for iterating over shops and creating products
for shop_id in shop_ids:
print(f”Processing products for shop ID: {shop_id}”)
product_url = f”{base_url}/shops/{shop_id}/products.json”

for idx, row in image_df.iterrows():
sku = str(row[‘SKU’]).strip() # Ensures SKU is a string and properly stripped
title = str(row[‘title’]).strip()
description = str(row[‘description’]).strip()
tags = [tag.strip() for tag in str(row[‘tags’]).split(‘,’)]
categories = [str(row[‘category’]).strip()]

variant_data = []
print_areas = []

for column in row.index:
if column in map(str, variant_prices.keys()) and not pd.isna(row[column]):
image_path = row[column]
full_image_path = os.path.join(images_directory, image_path)

with open(full_image_path, “rb”) as img_file:
img_b64 = base64.b64encode(‘utf-8’)
except FileNotFoundError:
print(f”File not found: {full_image_path}, skipping variant.”)

upload_data = {“file_name”: os.path.basename(image_path), “contents”: img_b64}
response =”{base_url}/uploads/images.json”, headers=headers, json=upload_data)

if response.ok:
image_id = response.json()[“id”]
variant_id = int(column)
price = variant_prices[variant_id]
variant_sku = f”{sku}_{variant_id}”

“id”: variant_id,
“price”: price,
“is_enabled”: True,
“sku”: variant_sku

“variant_ids”: [variant_id],
“placeholders”: [{
“position”: “front”,
“images”: [{“id”: image_id, “x”: 0.5, “y”: 0.5, “scale”: 1.0, “angle”: 0}]
print(f”Failed to upload image for variant {variant_id}, skipping.”)

product_data = {
“title”: title,
“description”: description,
“tags”: tags,
“categories”: categories,
“blueprint_id”: 1149, # Set your actual blueprint ID
“print_provider_id”: 28, # Set your actual print provider ID
“variants”: variant_data,
“print_areas”: print_areas

response =, headers=headers, json=product_data)
if response.ok:
print(f”Product {idx + 1} created successfully in shop {shop_id}!”)
print(f”Failed to create product {idx + 1} in shop {shop_id}. Server responded with: {response.text}”)

Product Data Downloader from Printify
This script fetches product listings from a Printify shop and saves the information into a CSV file. It logs all activities, providing details on successful fetches and errors. This is useful for backing up product data or for analysis purposes, ensuring you have offline access to your product data.

import requests

# API credentials
access_token = “YOUR KEY HERE”

# Headers for your requests
headers = {
“Authorization”: f”Bearer {access_token}”

# Make a request to get all shops
response = requests.get(“”, headers=headers)

if response.ok:
shops = response.json()
for shop in shops:
# Check if the ‘name’ and ‘id’ keys exist in the shop dictionary
if ‘name’ in shop and ‘id’ in shop:
print(f”Shop Name: {shop[‘name’]}, Shop ID: {shop[‘id’]}”)
print(“Missing ‘name’ or ‘id’ in shop data:”, shop)
print(“Failed to retrieve shops:”, response.text)

Retrieve Print Providers for a Blueprint
This script queries the Printify API to get all available print providers for a specific blueprint ID. It outputs the names and IDs of these providers, which can help in making informed decisions about which print providers to use for specific products based on their performance and offerings

import requests

# Your Printify API Token and Shop ID

access_token = “YOUR KEY HERE”

shop_id = “YOUR SHOP ID”

blueprint_id = 1149

def get_print_providers_for_blueprint(api_token, blueprint_id):
url = f”{blueprint_id}/print_providers.json”
headers = {“Authorization”: f”Bearer {api_token}”}

response = requests.get(url, headers=headers)

if response.status_code == 200:
print_providers = response.json()
for provider in print_providers:
print(f”Print Provider ID: {provider[‘id’]}, Name: {provider[‘title’]}”) # Adjusted to use ‘title’ instead of getting ‘name’
print(f”Failed to retrieve print providers. Status code: {response.status_code}”)

if __name__ == “__main__”:
get_print_providers_for_blueprint(access_token, blueprint_id)

Extract Variant Information from Printify Products
This script is designed to gather detailed variant information for all products in a specified Printify shop. It retrieves each product’s ID, title, and associated variants, then exports this data to a CSV file. This can be particularly helpful for inventory management or analysis of product variations.

import requests
import csv

# Your Printify API Token and Shop ID

access_token = “YOUR KEY HERE”

shop_id = “YOUR SHOP ID”

def get_variant_ids(api_token, shop_id):
url = f”{shop_id}/products.json”
headers = {“Authorization”: f”Bearer {api_token}”}

response = requests.get(url, headers=headers)

if response.status_code == 200:
data = response.json()
products = data[‘data’]

with open(‘variants_get_etsy.csv’, mode=’w’, newline=”, encoding=’utf-8′) as file:
writer = csv.writer(file)
writer.writerow([‘Product ID’, ‘Product Title’, ‘Variant ID’, ‘Variant Title’])

for product in products:
print(f”Product ID: {product[‘id’]}, Title: {product[‘title’]}”)
for variant in product[‘variants’]:
print(f” Variant ID: {variant[‘id’]}, Title: {variant[‘title’]}”)
print(f”Failed to retrieve products. Status code: {response.status_code}”)

if __name__ == “__main__”:
get_variant_ids(access_token, shop_id)

Create a CSV File

You will need to create a CSV file you receive the data. In my example it is variants_get_etsy.csv

Good luck! If you have any questions, post them in the YouTube Comment section so everyone can benefit!