Printify Python API Docs | dltHub
Build a Printify-to-database pipeline in Python using dlt with AI Workbench support for Claude Code, Cursor, and Codex.
Last updated:
Printify is a print-on-demand and order fulfillment platform that provides a REST API to manage shops, products, catalog (blueprints), print providers, and orders. The REST API base URL is https://api.printify.com/v1/ (v1) and https://api.printify.com/v2/ (v2) and All requests require either a Personal Access Token (Bearer) or OAuth2 bearer tokens..
dlt is an open-source Python library that handles authentication, pagination, and schema evolution automatically. dlthub provides AI context files that enable code assistants to generate production-ready pipelines. Install with uv pip install "dlt[workspace]" and start loading Printify data in under 10 minutes.
What data can I load from Printify?
Here are some of the endpoints you can load from Printify:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| shops | /v1/shops.json | GET | data | List shops in the merchant account (paginated; response contains "data" array) |
| products | /v1/shops/{shop_id}/products.json | GET | data | List products in a shop (paginated; response example includes "data" array and pagination fields) |
| orders | /v1/shops/{shop_id}/orders.json | GET | data | List orders for a shop (paginated; response contains "data" array) |
| order | /v1/shops/{shop_id}/orders/{order_id}.json | GET | (single object) | Retrieve order details by id (returns single order object) |
| catalog_blueprints | /v1/catalog/blueprints.json | GET | (top-level array) | Retrieve list of catalog blueprints (examples show top-level JSON array) |
| catalog_print_providers | /v1/catalog/blueprints/{blueprint_id}/print_providers.json | GET | (top-level array) | List print providers for blueprint (example response is a top-level array) |
| catalog_print_providers_v2 | /v2/catalog/blueprints/{blueprint_id}/print_providers/{print_provider_id}/shipping.json | GET | data | V2 catalog shipping endpoints return JSON:API style with "data" array |
| catalog_print_providers_list | /v1/catalog/print_providers.json | GET | (top-level array) | Retrieve list of all available print providers (example shows top-level array) |
| uploads | /v1/uploads.json | GET | data | List uploaded files (v1 uses pagination with "data" in responses) |
| Note: Many v1 list endpoints return paginated responses with pagination fields and a "data" array key (e.g., products, orders). Some catalog endpoints (v1 catalog) return a top-level JSON array. V2 follows JSON:API conventions and uses a "data" array. |
How do I authenticate with the Printify API?
Authentication is via Bearer tokens sent in the Authorization header (Authorization: Bearer {token}). Requests must also include a User-Agent header. Both Personal Access Tokens and OAuth 2.0 access tokens are supported.
1. Get your credentials
- Log into your Printify account. 2) Go to Developers / API settings (https://developers.printify.com/ Authentication > Create a personal access token). 3) Generate a Personal Access Token and copy it. 4) Use that token in the Authorization header as "Bearer {token}". (Alternatively implement OAuth2 flow per developers.printify.com if managing multiple merchant accounts.)
2. Add them to .dlt/secrets.toml
[sources.printify_source] api_token = "your_personal_access_token_here"
dlt reads this automatically at runtime — never hardcode tokens in your pipeline script. For production environments, see setting up credentials with dlt for environment variable and vault-based options.
How do I set up and run the pipeline?
Set up a virtual environment and install dlt:
uv venv && source .venv/bin/activate uv pip install "dlt[workspace]"
1. Install the dlt AI Workbench:
dlt ai init --agent <your-agent> # <agent>: claude | cursor | codex
This installs project rules, a secrets management skill, appropriate ignore files, and configures the dlt MCP server for your agent. Learn more →
2. Install the rest-api-pipeline toolkit:
dlt ai toolkit rest-api-pipeline install
This loads the skills and context about dlt the agent uses to build the pipeline iteratively, efficiently, and safely. The agent uses MCP tools to inspect credentials — it never needs to read your secrets.toml directly. Learn more →
3. Start LLM-assisted coding:
Use /find-source to load data from the Printify API into DuckDB.
The rest-api-pipeline toolkit takes over from here — it reads relevant API documentation, presents you with options for which endpoints to load, and follows a structured workflow to scaffold, debug, and validate the pipeline step by step.
4. Run the pipeline:
python printify_pipeline.py
If everything is configured correctly, you'll see output like this:
Pipeline printify_pipeline load step completed in 0.26 seconds 1 load package(s) were loaded to destination duckdb and into dataset printify_data The duckdb destination used duckdb:/printify.duckdb location to store data Load package 1749667187.541553 is LOADED and contains no failed jobs
Inspect your pipeline and data:
dlt pipeline printify_pipeline show
This opens the Pipeline Dashboard where you can verify pipeline state, load metrics, schema (tables, columns, types), and query the loaded data directly.
Python pipeline example
This example loads products and orders from the Printify API into DuckDB. It mirrors the endpoint and data selector configuration from the table above:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def printify_source(api_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.printify.com/v1/ (v1) and https://api.printify.com/v2/ (v2)", "auth": { "type": "bearer", "token": api_token, }, }, "resources": [ {"name": "products", "endpoint": {"path": "shops/{shop_id}/products.json", "data_selector": "data"}}, {"name": "orders", "endpoint": {"path": "shops/{shop_id}/orders.json", "data_selector": "data"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="printify_pipeline", destination="duckdb", dataset_name="printify_data", ) load_info = pipeline.run(printify_source()) print(load_info)
To add more endpoints, append entries from the resource table to the "resources" list using the same name, path, and data_selector pattern.
How do I query the loaded data?
Once the pipeline runs, dlt creates one table per resource. You can query with Python or SQL.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("printify_pipeline").dataset() sessions_df = data.products.df() print(sessions_df.head())
SQL (DuckDB example):
SELECT * FROM printify_data.products LIMIT 10;
In a marimo or Jupyter notebook:
import dlt data = dlt.pipeline("printify_pipeline").dataset() data.products.df().head()
See how to explore your data in marimo Notebooks and how to query your data in Python with dataset.
What destinations can I load Printify data to?
dlt supports loading into any of these destinations — only the destination parameter changes:
| Destination | Example value |
|---|---|
| DuckDB (local, default) | "duckdb" |
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Change the destination in dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. See the full destinations list.
Troubleshooting
Authentication failures
If you receive 401 Unauthorized, verify the Authorization header is set to "Bearer {token}" and the token is valid. Personal Access Tokens and OAuth2 bearer tokens are accepted. Ensure you include a User-Agent header.
Rate limits
Global rate limit: 600 requests per minute per integration; Catalog API endpoints additionally limited to 100 requests per minute per integration. Exceeding limits returns 429 Too Many Requests.
Pagination and selectors
V1 paginated list endpoints return objects with pagination fields and a "data" array containing records (e.g., products, orders). Some v1 catalog endpoints return a top-level JSON array. V2 uses JSON:API and returns results under "data".
Common HTTP errors
400 Bad Request – invalid JSON/payload. 401 Unauthorized – invalid credentials. 403 Forbidden – insufficient scopes. 404 Not Found – route or resource missing. 422 Invalid Request – validation errors with detailed message and code. 429 Too Many Requests – rate limit exceeded. 402 Payment Required – account quota exceeded.
Ensure that the API key is valid to avoid 401 Unauthorized errors. Also, verify endpoint paths and parameters to avoid 404 Not Found errors.
Next steps
Continue your data engineering journey with the other toolkits of the dltHub AI Workbench:
data-exploration— Build custom notebooks, charts, and dashboards for deeper analysis with marimo notebooks.dlthub-runtime— Deploy, schedule, and monitor your pipeline in production.
dlt ai toolkit data-exploration install dlt ai toolkit dlthub-runtime install
Was this page helpful?
Community Hub
Need more dlt context for Printify?
Request dlt skills, commands, AGENT.md files, and AI-native context.