npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

printify-sdk

v0.2.0

Published

TypeScript SDK for the Printify API

Readme

printify-sdk

TypeScript SDK for the Printify API. Fully typed, zero dependencies, ESM-only.

Install

npm install printify-sdk

Requires Node.js 18+.

Quick Start

import { PrintifyClient } from 'printify-sdk';

const client = new PrintifyClient({
  accessToken: 'YOUR_API_TOKEN',
  shopId: 'YOUR_SHOP_ID', // optional, can be passed per-call
});

// List shops
const shops = await client.shops.list();

// List products
const products = await client.products.list();

// Create a product
const product = await client.products.create({
  title: 'My T-Shirt',
  description: 'A great shirt',
  blueprint_id: 6,
  print_provider_id: 1,
  variants: [{ id: 17390, price: 2000, is_enabled: true }],
  print_areas: [
    {
      variant_ids: [17390],
      placeholders: [
        {
          position: 'front',
          images: [
            {
              id: 'image-id',
              name: 'design.png',
              type: 'image/png',
              height: 1000,
              width: 1000,
              x: 0.5,
              y: 0.5,
              scale: 1,
              angle: 0,
            },
          ],
        },
      ],
    },
  ],
});

API

new PrintifyClient(options)

| Option | Type | Required | Description | | ------------- | -------- | -------- | ------------------------------------ | | accessToken | string | Yes | Printify API token | | shopId | string | No | Default shop ID for shop-scoped calls | | baseUrl | string | No | API base URL (defaults to https://api.printify.com/v1). Must be a valid URL. | | timeoutMs | number | No | Request timeout in milliseconds (default: 30 000) |

Shops

client.shops.list(): Promise<Shop[]>

Blueprints (Catalog)

client.blueprints.list(): Promise<Blueprint[]>
client.blueprints.get(blueprintId): Promise<Blueprint>
client.blueprints.getPrintProviders(blueprintId): Promise<PrintProvider[]>
client.blueprints.getVariants(blueprintId, printProviderId): Promise<VariantsResponse>

Products

All methods accept an optional shopId parameter to override the default.

client.products.list(shopId?): Promise<PaginatedResponse<Product>>
client.products.get(productId, shopId?): Promise<Product>
client.products.create(data, shopId?): Promise<Product>
client.products.update(productId, data, shopId?): Promise<Product>
client.products.delete(productId, shopId?): Promise<void>
client.products.publish(productId, publishData, shopId?): Promise<void>
client.products.getImages(productId, shopId?): Promise<ProductImage[]>

Orders

client.orders.list(shopId?, params?): Promise<PaginatedResponse<PrintifyOrder>>
client.orders.get(orderId, shopId?): Promise<PrintifyOrder>
client.orders.create(data, shopId?): Promise<PrintifyOrder>
client.orders.sendToProduction(orderId, shopId?): Promise<PrintifyOrder>
client.orders.cancel(orderId, shopId?): Promise<void>
client.orders.calculateShipping(data, shopId?): Promise<ShippingRate[]>

Uploads

client.uploads.uploadImage(data): Promise<UploadedImage>
client.uploads.getImage(imageId): Promise<UploadedImage>
client.uploads.archiveImage(imageId): Promise<void>

Webhooks

client.webhooks.list(shopId?): Promise<Webhook[]>
client.webhooks.create(data, shopId?): Promise<Webhook>
client.webhooks.update(webhookId, data, shopId?): Promise<Webhook>
client.webhooks.delete(webhookId, shopId?): Promise<void>

Input Validation

All resource IDs are validated before use — path traversal attempts (../, /, special characters) throw immediately. Upload URLs must use HTTPS. Order list page/limit must be positive integers.

Error Handling

import { PrintifyApiError, PrintifyRateLimitError } from 'printify-sdk';

try {
  await client.products.get('non-existent');
} catch (err) {
  if (err instanceof PrintifyRateLimitError) {
    // err.retryAfter — seconds to wait (or null)
    console.log(`Rate limited. Retry after ${err.retryAfter}s`);
  } else if (err instanceof PrintifyApiError) {
    // err.statusCode, err.message, err.errors
    console.log(`API error ${err.statusCode}: ${err.message}`);
  }
}

Development

npm run lint        # eslint
npm run typecheck   # tsc --noEmit
npm run test        # vitest
npm run build       # compile to dist/

Pre-commit hooks (via husky) run lint, typecheck, and tests automatically.

License

MIT