@pintahub/printify-api
v0.1.1
Published
Printify REST API client for pintahub services
Readme
@pintahub/printify-api
Printify REST API (v1) client for pintahub services. Command pattern — see
CLAUDE.md for architecture, conventions, and the full command list.
import {PrintifyClient, CreateUploadCommand, CreateProductCommand} from '@pintahub/printify-api'
const client = new PrintifyClient({shopId, accessToken})
const upload = await client.send(
new CreateUploadCommand({file_name: 'design.png', url: presignedUrl}),
)
const product = await client.send(
new CreateProductCommand({
title,
description,
blueprint_id: 6,
print_provider_id: 99,
variants: variantIds.map((id) => ({id, price: 1999, is_enabled: true})),
print_areas: [
{
variant_ids: variantIds,
placeholders: [
{position: 'front', images: [{id: upload.id, x: 0.5, y: 0.5, scale: 1, angle: 0}]},
],
},
],
}),
)
// product.images[] = mockup URLs for every enabled variant / camera angle- Native fetch (Node ≥ 18), Bearer auth, zero runtime dependencies.
- 429 rate limits are retried inside the client (
Retry-Afteraware) — callers don't handle them. - Non-2xx responses throw
PrintifyApiError {status, code?, body}.
Develop
yarn install
yarn typecheck && yarn test:unit # no network needed
yarn build # tsc → dist/
cp .env.example .env # fill in PRINTIFY_API_TOKEN + PRINTIFY_SHOP_ID
yarn test:integration # real-API chain, cleans up after itself