REST API · Webhooks · OpenAPI 3.1

ArtPrintery API documentation

Use the ArtPrintery API to list art prints and framed prints for each delivery country, get prices, upload artwork, link store products, create orders, track shipments and manage your wallet. Orders for India are made in the ArtPrintery workshop; every other order is printed inside the buyer's own customs area. The Shopify app and WooCommerce plugin use the same contracts. The dashboard uses the same API.

OpenAPI JSON
Live response
{
  "status": "Ready",
  "spec": "ArtPrintery API"
}

One fulfilment contract for every storefront

  1. Generate a test key with only the scopes your integration needs.
  2. Upload the original artwork and keep the returned asset ID.
  3. Create one order after payment using a stable external order ID.
  4. Subscribe to signed status and shipment webhooks instead of polling.
WooCommerceNative plugin

Product sync, customer uploads, paid-order routing, retries, and signed tracking callbacks.

Download plugin
OpenAIOAuth MCP plugin

Catalog, quotes, merchant operations, wallet checks, and secure top-up checkout tools.

Inspect MCP
Zapier, Make, n8n, PabblyOpenAPI and webhooks

Import the OpenAPI document or use HTTP actions, then receive signed fulfilment events.

Open schema
Custom, Wix, Squarespace, EtsyServer-side REST API

Upload artwork, create an idempotent order after payment, and sync status by webhook.

Order API
Create a test order
curl https://artprintery.com/api/v1/orders \
  --request POST \
  --header "Authorization: Bearer phq_test_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "externalOrderId": "STORE-1001",
    "channel": "API",
    "customer": {"name": "Customer name", "email": "[email protected]"},
    "shippingAddress": {
      "line1": "Delivery address",
      "city": "Mumbai",
      "region": "Maharashtra",
      "postalCode": "400001",
      "country": "India"
    },
    "items": [{
      "productId": "framed-print",
      "size": "A4",
      "quantity": 1,
      "artworkId": "art_YOUR_ASSET",
      "artworkName": "Customer artwork",
      "borderInches": 0.5
    }]
  }'

Authentication

Dashboard users authenticate with a secure, HttpOnly passwordless session. Server integrations send Authorization: Bearer <key> on merchant operations. Generate scoped live or test keys in Dashboard → Integrations. Stored keys derive the merchant tenant from the credential; trusted bootstrap channel apps may also send X-PHQ-Merchant. Merchant ids in request bodies are ignored.

GET/api/v1/health

Check API health

Liveness and configuration hints only; this does not verify the database or gateway connectivity. Use /ready for production configuration and database readiness.

Response
{
  "ok": true,
  "environment": "production",
  "persistence": "postgres",
  "objectStorage": true,
  "malwareScanner": true,
  "payments": {
    "razorpay": true,
    "phonepe": true,
    "paypal": true
  },
  "auth": {
    "sessionSecret": true,
    "google": true,
    "magicEmail": true
  }
}
GET/api/v1/ready

Check production readiness

Returns HTTP 200 with ready:true only when mandatory production settings are present and PostgreSQL responds; otherwise HTTP 503 with ready:false. This is not payment, courier or platform approval evidence.

Response
{
  "ready": true
}
POST/api/v1/ops/maintenance

Retry due merchant webhooks

Internal worker endpoint. Requires a Bearer PHQ_ADMIN_TOKEN, not a merchant key or cookie. Retries at most 10 due deliveries for each of 5 merchants per run. Run worker:webhooks as a separate supervised process. Delivery is at least once; receivers must deduplicate X-PHQ-Delivery. The same run re-prices up to 10 orders held as pricing_unavailable, sends up to 10 paid, hold-free orders to production that are still waiting, and sends queued low-balance reminder emails.

Response
{
  "attempted": 10,
  "delivered": 9,
  "pricing": {
    "attempted": 1,
    "priced": 1
  },
  "partner": {
    "attempted": 2,
    "submitted": 2
  },
  "emails": {
    "attempted": 1,
    "sent": 1
  }
}
POST/api/auth/magic-link

Request passwordless sign-in

Creates a one-use, 15-minute sign-in link and sends it through the configured SMTP provider. Development returns a local verification URL.

Request
{
  "email": "[email protected]",
  "role": "merchant",
  "name": "Merchant name",
  "storeName": "Merchant store"
}
Response
{
  "delivery": "email",
  "expiresAt": "2026-07-28T12:15:00.000Z",
  "message": "Check your inbox for a secure sign-in link."
}
GET/api/auth/session

Get browser session

Returns the current merchant or customer session and enabled authentication providers without exposing session tokens.

Response
{
  "authenticated": true,
  "user": {
    "id": "user_0000001",
    "role": "merchant",
    "email": "[email protected]"
  }
}
POST/api/auth/logout

End browser session

Revokes the current passwordless session and clears its HttpOnly cookie after same-origin validation.

Response
{
  "signedOut": true
}

Customer account

Customer account endpoints use the HttpOnly browser session created by magic email or Google. They are not accessible with merchant API keys.

GET/api/v1/customer/account

Get customer account

Returns the signed-in customer's account and orders matched to the verified email address.

Response
{
  "user": {
    "email": "[email protected]",
    "name": "Customer name"
  },
  "orders": []
}
PATCH/api/v1/customer/account

Update customer account

Updates the signed-in customer's name, phone and saved delivery address after same-origin validation.

Request
{
  "name": "Customer name",
  "phone": "+91 98000 00000",
  "address": {
    "line1": "14 Linking Road",
    "city": "Mumbai",
    "region": "Maharashtra",
    "postalCode": "400050",
    "country": "India"
  }
}
Response
{
  "user": {
    "email": "[email protected]",
    "name": "Customer name"
  }
}

Support

Public contact and support forms create a triage request. Request details are returned only through the protected operations endpoint.

POST/api/v1/support-requests

Create support request

Accepts a same-origin contact or merchant support request and returns a public receipt without echoing personal information.

Request
{
  "kind": "support",
  "email": "[email protected]",
  "topic": "orders",
  "message": "Order PH-100 has not moved to printing."
}
Response
{
  "supportRequest": {
    "id": "SR-000001",
    "status": "open",
    "createdAt": "2026-07-28T12:00:00.000Z"
  }
}
GET/api/v1/support-requests

List support requests

Returns support requests to authenticated operations staff. Optional query filter: status.

Response
{
  "supportRequests": [
    {
      "id": "SR-000001",
      "kind": "support",
      "email": "[email protected]",
      "topic": "orders",
      "status": "open"
    }
  ]
}
PATCH/api/v1/support-requests/{id}

Update support request

Marks a support request open or closed while retaining its audit record.

Request
{
  "status": "closed"
}
Response
{
  "supportRequest": {
    "id": "SR-000001",
    "status": "closed"
  }
}

API keys

Create least-privilege credentials for private apps, WooCommerce, automation platforms and server integrations. Secrets are returned once, stored only as SHA-256 hashes, and can be revoked immediately. Test keys use an isolated test tenant and wallet.

GET/api/v1/api-keys

List API keys

Returns safe metadata and masked values; full secrets are never returned after creation.

Scopeskeys:read
Response
{
  "apiKeys": [
    {
      "id": "key_000001",
      "name": "WooCommerce production",
      "environment": "live",
      "maskedKey": "phq_live_abcd••••••••••••8f2a",
      "scopes": [
        "orders:write",
        "orders:read",
        "artwork:write"
      ]
    }
  ]
}
POST/api/v1/api-keys

Generate API key

Creates a scoped key and returns its complete secret exactly once.

Scopeskeys:write
Request
{
  "name": "WooCommerce production",
  "environment": "live",
  "scopes": [
    "catalog:read",
    "catalog:write",
    "artwork:write",
    "orders:read",
    "orders:write",
    "shipments:read",
    "webhooks:write"
  ]
}
Response
{
  "apiKey": {
    "id": "key_000001",
    "name": "WooCommerce production",
    "environment": "live"
  },
  "secret": "phq_live_store-this-value-now"
}
DELETE/api/v1/api-keys/{id}

Revoke API key

Revokes a credential immediately without deleting its audit metadata.

Scopeskeys:write
Response
{
  "apiKey": {
    "id": "key_000001",
    "revokedAt": "2026-07-28T12:00:00.000Z"
  }
}

Products

Retrieve the active ArtPrintery POD catalog available for store sync.

GET/api/v1/products

List products

Returns A4 and A3 variants for framed prints with acrylic/poly glass glazing.

Response
{
  "products": [
    {
      "sku": "PHQ-framed-print-A4",
      "baseCost": 799,
      "dpi": 300,
      "frameProfile": "0.5 inch"
    }
  ]
}
POST/api/v1/products/quote

Quote fulfilment

Calculates base cost and quantity discount for one product line. Quantity must be an integer from 1 to 10000. Discounts are 10% at 25 units, 18% at 100, and 22% at 500; each final line total is rounded to the nearest rupee. These are not cumulative monthly discounts.

Request
{
  "productId": "framed-print",
  "size": "A4",
  "quantity": 100
}
Response
{
  "unitBase": 799,
  "discountPercent": 18,
  "total": 65518
}
GET/api/v1/catalog

List what can be ordered

Art prints and framed prints available for delivery to ?country= (ISO code or English name), or everything made anywhere when no country is given. Each size has its code, width and height in millimetres, a metric and an inch label, the papers it can be printed on, its frame colours (black, white, natural-wood, dark-wood) and its orientations. paperIds and frameColors are the ids to send in an order; paperOptions and frameColorOptions repeat them with a display name ({ id, name }), and each product lists its frameColors with names too. Each paper has a one-line bestFor description. A country that is not listed in countries cannot be delivered to; India lists the workshop's framed A4 and A3.

Response
{
  "country": "DE",
  "countries": [
    "DE",
    "IN",
    "US"
  ],
  "products": [
    {
      "kind": "framed-poster",
      "name": "Framed print",
      "papers": [
        {
          "id": "silk-200",
          "name": "Silk",
          "weightGsm": 200,
          "bestFor": "A gentle sheen with deeper blacks and richer colour; the natural choice for photography."
        }
      ],
      "frameColors": [
        {
          "id": "black",
          "name": "Black"
        },
        {
          "id": "white",
          "name": "White"
        },
        {
          "id": "natural-wood",
          "name": "Natural wood"
        },
        {
          "id": "dark-wood",
          "name": "Dark wood"
        }
      ],
      "sizes": [
        {
          "code": "30x40cm",
          "system": "metric",
          "widthMm": 300,
          "heightMm": 400,
          "metricLabel": "30 × 40 cm",
          "imperialLabel": "11.8 × 15.7 in",
          "paperIds": [
            "silk-200"
          ],
          "frameColors": [
            "black",
            "white",
            "natural-wood",
            "dark-wood"
          ],
          "paperOptions": [
            {
              "id": "silk-200",
              "name": "Silk"
            }
          ],
          "frameColorOptions": [
            {
              "id": "black",
              "name": "Black"
            },
            {
              "id": "white",
              "name": "White"
            },
            {
              "id": "natural-wood",
              "name": "Natural wood"
            },
            {
              "id": "dark-wood",
              "name": "Dark wood"
            }
          ],
          "orientations": [
            "portrait",
            "landscape"
          ]
        }
      ],
      "orientations": [
        "portrait",
        "landscape"
      ]
    }
  ]
}
GET/api/v1/prices

List prices for a country

Without ?country= returns the countries we deliver to. With it, returns what one print costs you delivered there, before local sales tax. prices is the flat list, one entry per size, paper (paperId) and frame colour. groups is the same list shaped for a price table: per product, one entry per size, and under it one option per distinct price with the papers or frame colours that share it. papers names the paper ids.

Scopescatalog:read
Response
{
  "country": "DE",
  "currency": "EUR",
  "updatedAt": "2026-11-25T18:09:12.843Z",
  "papers": [
    {
      "id": "matte-200",
      "name": "Matte",
      "weightGsm": 200
    }
  ],
  "prices": [
    {
      "kind": "framed-poster",
      "sizeCode": "30x40cm",
      "paperId": "silk-200",
      "frameColor": "black",
      "priceMinor": 3884,
      "shippingMinor": 874,
      "minDeliveryDays": 6,
      "maxDeliveryDays": 9,
      "madeInCountry": true
    }
  ],
  "groups": [
    {
      "kind": "framed-poster",
      "sizes": [
        {
          "sizeCode": "30x40cm",
          "system": "metric",
          "metricLabel": "30 × 40 cm",
          "imperialLabel": "11.8 × 15.7 in",
          "options": [
            {
              "paperIds": [
                "silk-200"
              ],
              "frameColors": [
                "black",
                "white"
              ],
              "priceMinor": 3884,
              "shippingMinor": 874,
              "minDeliveryDays": 6,
              "maxDeliveryDays": 9,
              "madeInCountry": true
            }
          ]
        }
      ]
    }
  ]
}
GET/api/v1/mappings

List product links

Returns the links between your store variants and prints, plus what a link can point at: products (India workshop products, by sku) and catalog (every print made for other countries, in the shape GET /api/v1/catalog returns, including display names for papers and frame colours). Filter with ?channel=shopify|woocommerce|api.

Scopescatalog:read
Response
{
  "mappings": [
    {
      "id": "map_00001",
      "channel": "Shopify",
      "externalVariantId": "44912345678901",
      "label": "Sunset print",
      "sku": "PHQ-framed-print-A3",
      "spec": {
        "kind": "framed-poster",
        "sizeCode": "30x40cm",
        "paperId": "silk-200",
        "frameColor": "black",
        "orientation": "portrait"
      },
      "image": {
        "type": "fixed",
        "artworkId": "art_abc123"
      },
      "onLowResolution": "hold",
      "active": true
    }
  ],
  "products": [
    {
      "sku": "PHQ-framed-print-A3",
      "name": "Framed Print with Acrylic / Poly Glass",
      "size": "A3"
    }
  ],
  "catalog": []
}
POST/api/v1/mappings

Link a store variant to a print

Creates the link for a store variant, or replaces it. Send sku (an India workshop product) for delivery within India, spec { kind, sizeCode, paperId?, frameColor?, orientation? } for delivery to every other country, or both; the order's delivery country picks which is used. A request with only sku, as before, is still a complete link. When an order needs the side a link does not have, the order is saved and held with a message saying so. image is { type: fixed, artworkId } or { type: order-property, propertyName, queryParam?, fallbackArtworkId? }; on a link with only sku a fixed artwork must be prepared for that product's size, while on a link with a spec any artwork that passed its print check can be used and is prepared for each order's own print size automatically. An artwork id the shopper's order line carries in _phq_artwork_id is printed ahead of the link's image.

Scopescatalog:write
Request
{
  "channel": "Shopify",
  "externalVariantId": "44912345678901",
  "label": "Sunset print",
  "sku": "PHQ-framed-print-A3",
  "spec": {
    "kind": "framed-poster",
    "sizeCode": "30x40cm",
    "frameColor": "black",
    "orientation": "portrait"
  },
  "image": {
    "type": "fixed",
    "artworkId": "art_abc123"
  }
}
Response
{
  "mapping": {
    "id": "map_00001",
    "channel": "Shopify",
    "externalVariantId": "44912345678901",
    "sku": "PHQ-framed-print-A3",
    "spec": {
      "kind": "framed-poster",
      "sizeCode": "30x40cm",
      "paperId": "silk-200",
      "frameColor": "black",
      "orientation": "portrait"
    },
    "image": {
      "type": "fixed",
      "artworkId": "art_abc123"
    },
    "active": true
  }
}
GET/api/v1/designs

List published designs

Returns the merchant's reusable design gallery with artwork asset links and sales counts.

Scopescatalog:read
Response
{
  "designs": [
    {
      "id": "design_000001",
      "artworkId": "art_abc123",
      "name": "Coastal Dawn",
      "size": "A4",
      "salesCount": 12
    }
  ]
}
POST/api/v1/designs

Publish design

Publishes a processed artwork asset into the merchant gallery for reuse across orders and stores.

Scopescatalog:write
Request
{
  "artworkId": "art_abc123",
  "name": "Coastal Dawn",
  "size": "A4"
}
Response
{
  "design": {
    "id": "design_000001",
    "artworkId": "art_abc123",
    "name": "Coastal Dawn",
    "size": "A4",
    "status": "published"
  }
}

Artwork

Upload original artwork and receive links for an editor thumbnail, untouched original, cropped master and final print-ready image. The thumbnail is a public, opaque, cacheable preview. Original, cropped and print-ready files require the owning merchant session, an artwork:read API key, or an operations-admin session.

GET/api/v1/artwork

List artwork assets

Returns uploaded artwork asset sets with thumbnail, original, cropped and print-ready URLs.

Scopesartwork:read
Response
{
  "artwork": []
}
POST/api/v1/artwork

Upload artwork

Accepts multipart upload or base64 JSON and generates derivative assets from the original file. targetSize is any catalogue size code (A4, A3, 30x40cm, 12x16in ...; see GET /api/v1/catalog) and defaults to A4; orientation is portrait (default) or landscape. The print-ready file is made at 300 DPI for that sheet. An image below the resolution the size needs (300 DPI up to A3, less for larger prints, never under 150) gets a resolution warning in preflight. An order line accepts an artwork only when it was prepared for the line's size and orientation.

Scopesartwork:write
Request
{
  "fileName": "poster.jpg",
  "contentType": "image/jpeg",
  "targetSize": "A4",
  "borderInches": 0.5
}
Response
{
  "artwork": {
    "id": "art_abc123",
    "thumbnailUrl": "/api/v1/artwork/art_abc123/thumbnail",
    "originalUrl": "/api/v1/artwork/art_abc123/assets/original",
    "croppedUrl": "/api/v1/artwork/art_abc123/assets/cropped",
    "printReadyUrl": "/api/v1/artwork/art_abc123/assets/print-ready"
  }
}
GET/api/v1/artwork/{id}/thumbnail

Get artwork thumbnail

Streams the opaque 900 px WebP editor preview. The thumbnail contains no original or print-master bytes and is publicly cacheable for storefront preview.

Response
{
  "binary": true
}
GET/api/v1/artwork/{id}/assets/{variant}

Download protected artwork asset

Streams the untouched original, cropped master, or print-ready file. Variant must be original, cropped, or print-ready. Requires a merchant credential. ArtPrintery production alone is given time-limited signed links (merchant, expires and signature query parameters) to the print-ready variant; a request carrying an invalid or expired signature is refused with 401.

Scopesartwork:read
Response
{
  "binary": true
}

Orders

Create and update fulfilment orders routed from custom storefronts, Shopify, WooCommerce or direct API clients. Shopify automatic intake accepts app metafields and line item properties for artwork/file routing.

GET/api/v1/orders

List orders

Returns fulfilment orders. Optional query filters: status and channel. Each order carries total (major units, kept for older integrations), totalMinor (integer minor units: paise, cents) and currency, plus madeIn, paymentState (paid, unpaid or refunded), holds and, for orders made outside India, priceBreakdown and fulfillment.state (pending, submitted or failed).

Scopesorders:read
Response
{
  "orders": [
    {
      "id": "#PH-2049",
      "status": "New",
      "total": 47.58,
      "totalMinor": 4758,
      "currency": "EUR",
      "madeIn": "partner-network",
      "paymentState": "paid",
      "priceBreakdown": {
        "productMinor": 3884,
        "shippingMinor": 874,
        "taxMinor": 0
      },
      "fulfillment": {
        "state": "submitted",
        "attempts": 1
      },
      "trackingNumber": "PENDING-PH-2049"
    }
  ]
}
POST/api/v1/orders

Create fulfilment order

Creates a print job and pays for it from the wallet. Delivery to India is made in the ArtPrintery workshop from the INR price list: send productId framed-print with size A4 or A3. Delivery to any other country is priced live for the delivery address in your wallet currency (the same all-in figure POST /api/v1/quotes returns) and each item needs a spec { kind: poster | framed-poster, sizeCode, paperId?, frameColor?, orientation? } plus an artworkId or an https printFileUrl. The spec may name a paperId (matte-200 or silk-200 for art prints; framed prints are always silk-200; the older id premium-silk-200 still means silk-200) and must be a print the catalogue lists for the delivery country. An artworkId must be prepared for the line's size and orientation; artwork can be prepared for every catalogue size, so no outside print file is needed. Send the country as an ISO code or English name. shippingAddress.postalCode is required except for countries that have no postcodes (for example the United Arab Emirates, Hong Kong and Qatar). The order is created only if the wallet covers it (400 Insufficient fulfillment balance otherwise); a 503 with retryable:true means live prices are briefly unavailable. Repeating an externalOrderId returns the order already created. Orders arriving from Shopify or WooCommerce are never rejected for money, price or image reasons: they are saved with a hold (insufficient_balance, pricing_unavailable, missing_image, image_download_failed, low_resolution or partner_error) and continue automatically once the hold clears.

Scopesorders:write
Request
{
  "externalOrderId": "SHOP-1001",
  "channel": "Shopify",
  "customer": {
    "name": "Riya Sharma",
    "email": "[email protected]",
    "phone": "+91 98000 00021"
  },
  "shippingAddress": {
    "name": "Riya Sharma",
    "line1": "14 Linking Road",
    "city": "Mumbai",
    "region": "Maharashtra",
    "postalCode": "400050",
    "country": "India"
  },
  "items": [
    {
      "productId": "framed-print",
      "size": "A3",
      "quantity": 1,
      "artworkName": "Coastal Dawn",
      "artworkId": "art_abc123",
      "sourceFileUrl": "https://cdn.example.com/original.png",
      "printFileUrl": "https://cdn.example.com/print-ready.png",
      "borderInches": 1,
      "crop": {
        "left": 0,
        "top": 0,
        "width": 2400,
        "height": 3394
      }
    }
  ]
}
Response
{
  "order": {
    "id": "#PH-2049",
    "status": "New",
    "total": 1199,
    "totalMinor": 119900,
    "currency": "INR",
    "madeIn": "india-workshop",
    "paymentState": "paid",
    "trackingNumber": "PENDING-PH-2049"
  }
}
PATCH/api/v1/orders/{id}

Update order status

Merchants may cancel a New order (wallet debit refunded once) or resend its current status to sync tracking. An order made outside India is first canceled with production; if production can no longer stop it the request fails with 400 and nothing is refunded. Only authenticated ArtPrintery operations can advance production stages.

Scopesorders:write
Request
{
  "status": "Canceled"
}
Response
{
  "order": {
    "id": "#PH-2049",
    "status": "Canceled"
  }
}
GET/api/v1/orders/{id}/assets

Get order asset links

Returns thumbnail, original, cropped master and final print-ready links for each order item.

Scopesorders:readartwork:read
Response
{
  "orderId": "#PH-2049",
  "assets": [
    {
      "artworkName": "Coastal Dawn",
      "printReadyUrl": "/api/v1/artwork/art_abc123/assets/print-ready"
    }
  ]
}
POST/api/v1/orders/{id}/pay

Pay for one held order

Opens a checkout for an order held with insufficient_balance, for its unpaid total in the wallet currency (rounded up to a whole unit where the gateway takes no decimals). gateway must be one of the options from GET /api/v1/payments/options. Works in both payment modes. Once the gateway confirms the payment it is credited to the wallet and the order is charged from it (two ledger entries), its hold is cleared and it goes to print. If the order was canceled or paid in the meantime, the payment stays in the wallet. The response is a payment intent with purpose order_payment, opened the same way as a top-up (Razorpay public key, or a checkoutUrl for PhonePe and PayPal).

Scopespayments:writeorders:write
Request
{
  "gateway": "paypal",
  "returnUrl": "https://app.example.com/app/credits"
}
Response
{
  "paymentIntent": {
    "id": "PAY-00003",
    "gateway": "paypal",
    "purpose": "order_payment",
    "orderId": "#PH-2050",
    "status": "created",
    "amount": 142.5,
    "amountMinor": 14250,
    "currency": "EUR",
    "checkoutUrl": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T"
  }
}
POST/api/v1/orders/{id}/reprice

Check an order's price again

Asks again for a live price for an order held with pricing_unavailable. A priced order is charged from the wallet at once if the balance covers it, otherwise it waits for payment like any other order. Allowed once a minute per order; an earlier request returns 429 with a Retry-After header. An order that is not waiting for a price returns 400.

Scopesorders:write
Response
{
  "priced": true,
  "order": {
    "id": "#PH-2050",
    "status": "New",
    "paymentState": "paid",
    "totalMinor": 14250,
    "currency": "EUR"
  }
}

Shipments

Expose courier tracking for merchants and customer account pages.

GET/api/v1/shipments/{trackingNumber}

Get shipment tracking

Returns courier, status and tracking event history for a shipment. Orders made outside India report the carrier's own name and, when the carrier provides one, a trackingUrl.

Scopesshipments:read
Response
{
  "shipment": {
    "trackingNumber": "PHQ-102050",
    "courier": "Bluedart",
    "status": "In transit",
    "trackingUrl": "https://carrier.example.com/track/PHQ-102050"
  }
}

Merchant settings

Store identity, packing-slip return details, brand colour, logo and shipping defaults are isolated by merchant tenant.

GET/api/v1/profile

Get merchant profile

Returns the current merchant's operational and branding settings.

Scopessettings:read
Response
{
  "profile": {
    "storeName": "Studio Antara",
    "contactName": "Antara Mehta",
    "email": "[email protected]",
    "brandColor": "#1d4ed8",
    "shippingDefault": "standard",
    "walletCurrency": "INR",
    "walletCurrencyEditable": true,
    "paymentMode": "wallet",
    "lowBalanceAlertMinor": 200000
  }
}
PATCH/api/v1/profile

Update merchant profile

Updates validated account, packing-slip, brand and shipping-default fields. walletCurrency (an ISO 4217 code: INR, USD, EUR, GBP and the other supported currencies) sets the currency the wallet is held and charged in. It can be changed only while the wallet has no top-ups, charges or open payments (walletCurrencyEditable is true); after that it is locked. Orders still waiting for payment are re-priced in the new currency. paymentMode is wallet (default: orders are paid from the prepaid balance) or per_order (each order waiting for payment is paid on its own with POST /api/v1/orders/{id}/pay); store orders are never rejected in either mode, they are held until paid; in per_order mode an order created through the API is held for payment too instead of being refused for the balance. lowBalanceAlertMinor, in minor units of the wallet currency, emails the account address at most once every 24 hours when a charge takes the balance below it; send null or 0 to turn it off. No email is sent when the server has no email delivery configured.

Scopessettings:write
Request
{
  "storeName": "Studio Antara",
  "returnAddress": "14 Linking Road, Mumbai 400050",
  "brandColor": "#1d4ed8",
  "walletCurrency": "EUR",
  "paymentMode": "per_order",
  "lowBalanceAlertMinor": 5000
}
Response
{
  "profile": {
    "storeName": "Studio Antara",
    "brandColor": "#1d4ed8",
    "walletCurrency": "EUR",
    "walletCurrencyEditable": true,
    "paymentMode": "per_order",
    "lowBalanceAlertMinor": 5000
  }
}
POST/api/v1/profile/logo

Upload merchant logo

Accepts multipart PNG, JPG or WebP, optimizes it, and stores it under the merchant's ArtPrintery R2 namespace.

Scopessettings:write
Request
{
  "file": "merchant-logo.png"
}
Response
{
  "logoUrl": "/generated/printhouse/brand/merchant-hash/logo.png"
}

Credits

Wallet credits fund fulfilment automatically when orders are created.

GET/api/v1/credits

Get wallet ledger

Returns current wallet balance and recent ledger entries. balance and each entry's amount and balance are in major units (kept for older integrations); balanceMinor and amountMinor are the exact integer values in the minor unit of currency (paise, cents).

Scopescredits:read
Response
{
  "balance": 24551,
  "balanceMinor": 2455100,
  "currency": "INR",
  "entries": [
    {
      "id": "CR-0002",
      "at": "2026-07-28T12:00:00.000Z",
      "label": "Order #PH-2049 · 1 item",
      "amount": -1199,
      "balance": 24551,
      "amountMinor": -119900,
      "balanceMinor": 2455100,
      "currency": "INR"
    }
  ]
}
POST/api/v1/credits/top-up

Top up wallet

Internal operations endpoint protected by the separate admin token. Merchant apps must create a verified payment intent instead. amount is in major units of the wallet currency; amountMinor may be sent instead for an exact value. INR wallets have a ₹500 minimum and bonus tiers; every other currency has a minimum of 10 units and no bonus. Unpaid orders the new balance covers are charged and released.

Request
{
  "amount": 5000
}
Response
{
  "balance": 30250,
  "balanceMinor": 3025000,
  "currency": "INR",
  "releasedOrders": []
}

Payments

Pay ArtPrintery for prints and shipping with a wallet top-up or, per order, with POST /api/v1/orders/{id}/pay. The gateways offered depend on the wallet currency: INR is paid with Razorpay (UPI, cards, netbanking) or PhonePe; other currencies with Razorpay International where it supports the currency, and with PayPal where PayPal does (never INR). A gateway that is not configured on the server is never offered. Every payment is in the wallet currency, and the wallet is credited exactly once whether the return page or the gateway's webhook confirms it first.

GET/api/v1/payments/intent

List payment intents

Returns recent payment intents, top-ups and order payments, newest first.

Scopespayments:read
Response
{
  "paymentIntents": []
}
GET/api/v1/payments/options

List payment options

The gateways this merchant can pay with now, for the wallet currency, in the order to show them. INR: razorpay then phonepe. Other currencies: razorpay where Razorpay International supports the currency, then paypal where PayPal does. Only gateways configured on the server are listed; an empty list means online payment is not available for this currency yet.

Scopespayments:read
Response
{
  "currency": "EUR",
  "paymentMode": "wallet",
  "options": [
    {
      "gateway": "razorpay",
      "label": "Card",
      "primary": true
    },
    {
      "gateway": "paypal",
      "label": "PayPal",
      "primary": false
    }
  ]
}
POST/api/v1/payments/intent

Create payment intent

Creates a wallet top-up with a Razorpay order, a PhonePe hosted checkout or a PayPal order. gateway must be one of GET /api/v1/payments/options. amount is in major units of the wallet currency (minimum ₹500 with bonus tiers for INR; 10 units and no bonus otherwise; whole units for PayPal in HUF, JPY and TWD); the intent is always in the wallet currency and returns amount, amountMinor and currency. PhonePe takes INR only and PayPal never takes INR. For PhonePe and PayPal, send returnUrl and open checkoutUrl; PayPal sends the payer back to returnUrl with paypal=return, intent and token parameters, and the page then calls POST /api/v1/payments/paypal/capture. Order payments are created with POST /api/v1/orders/{id}/pay.

Scopespayments:write
Request
{
  "gateway": "razorpay",
  "amount": 5000,
  "returnUrl": "https://app.example.com/app/credits"
}
Response
{
  "paymentIntent": {
    "id": "PAY-00002",
    "gateway": "razorpay",
    "status": "created",
    "amount": 5000,
    "amountMinor": 500000,
    "currency": "INR",
    "providerOrderId": "order_abc123",
    "providerPublicKey": "rzp_live_..."
  }
}
POST/api/v1/payments/verify/razorpay

Verify Razorpay checkout

Validates the signed checkout response and rechecks order id, amount, currency (INR or any Razorpay International currency, in its minor unit) and gateway payment status before crediting the wallet or paying the order.

Scopespayments:write
Request
{
  "razorpayOrderId": "order_abc123",
  "razorpayPaymentId": "pay_abc123",
  "razorpaySignature": "signed-response"
}
Response
{
  "verified": true,
  "captured": true
}
POST/api/v1/payments/webhooks/razorpay

Razorpay webhook

Verifies Razorpay's raw-body HMAC, amount and currency before crediting the wallet or paying the order. Authentication is supplied by X-Razorpay-Signature.

Response
{
  "paymentIntent": {
    "gateway": "razorpay",
    "status": "captured"
  }
}
POST/api/v1/payments/paypal/capture

Capture an approved PayPal payment

Called when the payer returns from PayPal. Send paymentIntentId (the intent query parameter) or paypalOrderId (PayPal's token query parameter). Only the merchant's own intent can be captured. The capture's status, amount, currency and reference must match the intent before the wallet is credited or the order paid. Safe to call again: an intent already captured is returned unchanged. captured:false means PayPal declined or is still processing the payment.

Scopespayments:write
Request
{
  "paymentIntentId": "PAY-00003",
  "paypalOrderId": "5O190127TN364715T"
}
Response
{
  "captured": true,
  "paymentIntent": {
    "id": "PAY-00003",
    "gateway": "paypal",
    "status": "captured",
    "appliedToOrder": true
  }
}
POST/api/v1/payments/webhooks/paypal

PayPal webhook

Each event is confirmed with PayPal's verify-webhook-signature API against PAYPAL_WEBHOOK_ID before it is used; an unverified event gets 401. PAYMENT.CAPTURE.COMPLETED credits the wallet or pays the order once (repeats and a capture already recorded by the return page change nothing), PAYMENT.CAPTURE.DENIED marks an uncaptured payment failed, and PAYMENT.CAPTURE.REFUNDED takes the refunded amount back out of the wallet once per refund. Other events are acknowledged and ignored.

Response
{
  "paymentIntent": {
    "gateway": "paypal",
    "status": "captured"
  }
}
POST/api/v1/payments/webhooks/phonepe

PhonePe webhook

Verifies PhonePe's configured callback authorization, then rechecks status and amount against PhonePe before crediting the wallet.

Response
{
  "paymentIntent": {
    "gateway": "phonepe",
    "status": "captured"
  }
}

Webhooks

Subscribe automation tools and commerce plugins to signed events, inspect delivery attempts and retry failures. Delivery requests include X-PHQ-Event, X-PHQ-Delivery, X-PHQ-Timestamp and X-PHQ-Signature. Verify v1=HMAC_SHA256(secret, timestamp + '.' + rawBody), reject timestamps older than five minutes, and return any 2xx response.

GET/api/v1/webhooks

List webhook endpoints

Returns endpoint metadata without exposing encrypted signing secrets.

Scopeswebhooks:read
Response
{
  "webhooks": [
    {
      "id": "wh_000001",
      "name": "Order automation",
      "url": "https://hooks.example.com/artprintery",
      "events": [
        "order.status.updated"
      ]
    }
  ]
}
POST/api/v1/webhooks

Create webhook endpoint

Creates an HTTPS subscription and returns its signing secret exactly once.

Scopeswebhooks:write
Request
{
  "name": "Order automation",
  "url": "https://hooks.example.com/artprintery",
  "events": [
    "order.created",
    "order.status.updated",
    "shipment.updated"
  ]
}
Response
{
  "webhook": {
    "id": "wh_000001",
    "events": [
      "order.created",
      "order.status.updated",
      "shipment.updated"
    ]
  },
  "secret": "whsec_store-this-value-now"
}
DELETE/api/v1/webhooks/{id}

Disable webhook endpoint

Stops future deliveries while preserving endpoint and delivery audit metadata.

Scopeswebhooks:write
Response
{
  "webhook": {
    "id": "wh_000001",
    "disabledAt": "2026-07-28T12:00:00.000Z"
  }
}
GET/api/v1/webhooks/deliveries

List webhook deliveries

Returns recent pending, delivered or failed attempts. Optional query filters: status and limit.

Scopeswebhooks:read
Response
{
  "deliveries": [
    {
      "id": "wd_00000001",
      "event": "order.created",
      "status": "delivered",
      "attempts": 1
    }
  ]
}
POST/api/v1/webhooks/deliveries/retry

Retry due webhook deliveries

Retries due failed deliveries using exponential backoff metadata and returns the resulting attempts.

Scopeswebhooks:write
Request
{
  "limit": 25
}
Response
{
  "deliveries": [
    {
      "id": "wd_00000002",
      "status": "delivered",
      "attempts": 2
    }
  ]
}
POST/api/v1/webhooks/shopify/order

Ingest Shopify paid order

Internal endpoint used by the Shopify app after webhook verification and product-metafield enrichment. The order is priced for its delivery country and is never rejected for money, price or image reasons: it is saved with holds instead.

Scopesorders:write
Response
{
  "order": {
    "id": "#PH-2049",
    "channel": "Shopify",
    "status": "New",
    "totalMinor": 119900,
    "currency": "INR"
  }
}
POST/api/v1/webhooks/shopify/cancellation

Resolve Shopify cancellation request

Internal endpoint used by the authenticated Shopify app. Accepts and refunds a matching New print job exactly once; rejects the request after printing has started. An order made outside India is canceled with production first and is rejected, without a refund, if production can no longer stop it.

Scopesorders:write
Request
{
  "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/501"
}
Response
{
  "accepted": true,
  "order": {
    "id": "#PH-2049",
    "status": "Canceled"
  }
}
POST/api/v1/webhooks/woocommerce/order

Ingest WooCommerce paid order

Requires paid:true and status processing or completed. Maps ArtPrintery-enabled line items and artwork metadata into one idempotent fulfilment order; rejects unpaid/canceled/refunded orders.

Scopesorders:write
Response
{
  "order": {
    "id": "#PH-2050",
    "channel": "WooCommerce",
    "status": "New",
    "totalMinor": 79900,
    "currency": "INR"
  }
}