REST API v2

The official Tshirtgang REST API for print-on-demand. Free for sellers, pay-as-you-go on orders.

Last updated

API key auth JSON request/response REST over HTTPS

Authentication & conventions

All endpoints accept JSON over HTTPS. Put your api_key inside the request body (not a header) and send every request as a POST with Content-Type: application/json. Generate / rotate your key in the seller control panel.

https://www.tshirtgang.com
Method
All endpoints use POST.
Content-Type
application/json — UTF-8 only.
Auth
api_key field inside the JSON body.
Success shape
{ "status": "success", ...endpoint-specific... }
Failure shape
{ "response": { "failure": { "code": "3", "message": "Invalid Authorization key" } } }
Max payload
10 MB (CreateOrder: 50 MB).
Rate limits
~60 requests / minute / API key. Contact support to raise.

Orders

POST /api/v2/CreateOrder/ CreateOrder

Submit one or more orders for fulfillment. Accepts existing `product_id`s or a new-product payload inline. Returns a shiplist ID that groups the orders for batch tracking.

Orders are processed idempotently on `market_id1` — sending the same `market_id1` twice returns the original `order_id` instead of creating a duplicate. Batch payloads can be up to 50 MB.
Request parameters
FieldTypeDescription
api_key required string Your API key from /cp/api.
shipping.fullname required string Recipient's full name.
shipping.address1 required string Street address (must include house number).
shipping.address2 optional string Apartment / unit number (optional).
shipping.city required string City.
shipping.state required string State/province. 2-letter code for US/CA.
shipping.zip required string Postal/zip code.
shipping.country required string 2-letter country code (US, CA, GB, …).
shipping.phone optional string Recipient's phone — required by some carriers.
shipping.email optional string Recipient's email — used for shipping notifications if your store relay is enabled.
order required array Single order object OR an array of order objects for batch submission.
order[].product_id optional integer Existing product ID (from CreateProduct). Omit if supplying `order[].product.*` inline.
order[].product.title optional string If creating on the fly: product title.
order[].product.url optional string If creating on the fly: design image URL (HTTPS PNG).
order[].size required string Size code (S, M, L, XL, 2XL…).
order[].color required string Colour name.
order[].quantity required integer Quantity — at least 1.
order[].backprint optional boolean `true` if back-print artwork was supplied with the product. Default `false`.
order[].priority_shipping optional boolean Priority lane (costs more, ships in 1–2 business days).
order[].comments optional string Free-text note passed through to production.
order[].market_id1 optional string Your internal order ID — stored for reference and returned on GetSellerHistory.
Example request
curl -X POST https://www.tshirtgang.com/api/v2/CreateOrder/ \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_API_KEY","shipping":{"fullname":"Jane Doe","address1":"123 Main St","city":"Toronto","state":"ON","zip":"M5V 2T6","country":"CA"},"order":[{"product_id":98765,"size":"M","color":"Black","quantity":1}]}'
Example response
{
    "response": {
        "success": {
            "order_id": "8600000",
            "price": "11.00",
            "shipping": "4.95",
            "tax": "0.00"
        }
    }
}
Response fields
FieldTypeDescription
response.success.order_id string Our order ID for the created order.
response.success.price string Item price in USD (excludes shipping and tax).
response.success.shipping string Shipping cost in USD.
response.success.tax string Tax charged on the order in USD.
POST /api/v2/GetSellerHistory/ GetSellerHistory

Retrieve your order history, paginated and filterable by status. Supports single-order lookup by `order_number`. All pagination/filter fields live inside a `filter` wrapper object.

For high-volume stores, combine `since` with periodic sync rather than paging through history every time. Address fields are AES-256 encrypted at rest and only returned to the API key that placed the order.
Request parameters
FieldTypeDescription
api_key required string Your API key from /cp/api.
filter.items_per_page optional integer How many items to display per results page. Minimum value `1`. Maximum value `100`. Default value `100`.
filter.page optional integer Using `items_per_page` tag, configure which page to display. Default value `1`.
filter.order_number optional string Specify a single order number to retrieve just that order's information. `page` and `items_per_page` are ignored when `order_number` is present.
filter.order_status optional string Specify the status of the orders you are searching for. Valid statuses: `Unpaid`, `Processing`, `Shipped`.
Example request
curl -X POST https://www.tshirtgang.com/api/v2/GetSellerHistory/ \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_API_KEY","filter":{"items_per_page":"100","page":"1"}}'
Example response
{
    "response": {
        "success": {
            "orders": [
                {
                    "order": {
                        "order_number": "8615939",
                        "buyers_name": "Doug Heffernan",
                        "buyers_address": "519 Longview Ave",
                        "buyers_address2": "",
                        "buyers_city": "Cliffside Park",
                        "buyers_state": "NJ",
                        "buyers_zip": "07010",
                        "buyers_country": "United States",
                        "status": "Shipped",
                        "product_id": "999912345",
                        "style": "Classic",
                        "color": "White",
                        "size": "Large",
                        "qty": "1",
                        "priority_shipping": false,
                        "price": "10.00",
                        "price_shipping": "4.95",
                        "price_tax": "0.00",
                        "shipping": {
                            "tracking_number": "100000000123456789",
                            "courier": "Fedex",
                            "tracking_link": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=100000000123456789&cntry_code=us&locale=en_US"
                        }
                    }
                }
            ]
        }
    }
}
Response fields
FieldTypeDescription
response.success.orders array Page of order entries. Each entry is wrapped in an `order` object.
response.success.orders[].order.order_number string Our order ID for the order.
response.success.orders[].order.buyers_name string Recipient's full name.
response.success.orders[].order.buyers_address string Recipient street address (line 1).
response.success.orders[].order.buyers_address2 string Recipient apartment / unit (line 2). Empty string if none.
response.success.orders[].order.buyers_city string Recipient city.
response.success.orders[].order.buyers_state string Recipient state/province (2-letter code where applicable).
response.success.orders[].order.buyers_zip string Recipient postal/zip code.
response.success.orders[].order.buyers_country string Recipient country (full name).
response.success.orders[].order.status string Human-readable status (e.g. `Paid`, `Printing`, `Shipped`, `Cancelled`).
response.success.orders[].order.product_id string Product ID of the ordered SKU.
response.success.orders[].order.style string Style name (e.g. `Classic`).
response.success.orders[].order.color string Colour name (e.g. `White`).
response.success.orders[].order.size string Size name (e.g. `Large`).
response.success.orders[].order.qty string Quantity ordered.
response.success.orders[].order.priority_shipping boolean Whether priority shipping was selected.
response.success.orders[].order.price string Item price in USD.
response.success.orders[].order.price_shipping string Shipping cost in USD.
response.success.orders[].order.price_tax string Tax charged on the order in USD.
response.success.orders[].order.shipping object Tracking object (present once shipped).
response.success.orders[].order.shipping.tracking_number string Carrier tracking number.
response.success.orders[].order.shipping.courier string Carrier name (e.g. `Fedex`, `USPS`, `Canada Post`).
response.success.orders[].order.shipping.tracking_link string Direct link to the carrier tracking page.

Products

POST /api/v2/GetAvailableProducts/ GetAvailableProducts

Retrieve the current blank catalogue (style / colour / size combinations) available for printing.

Calls without filters can return thousands of rows — narrow down by style + color + size when you can.
Request parameters
FieldTypeDescription
api_key required string Your API key from /cp/api.
filter.style optional string Style name (e.g. "Gildan 5000") or numeric style ID.
filter.color optional string Colour name (e.g. "Black"). Partial matches not accepted.
filter.size optional string Size code (S, M, L, XL, 2XL, 3XL, 4XL, 5XL, 6XL).
filter.available optional boolean `true` = only in-stock rows, `false` = only unavailable rows. Omit for all.
Example request
curl -X POST https://www.tshirtgang.com/api/v2/GetAvailableProducts/ \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_API_KEY","filter":{"available":"true"}}'
Example response
{
    "response": {
        "success": {
            "products": [
                {
                    "product": {
                        "style": "Classic",
                        "color": "Red",
                        "size": "2 X-Large",
                        "price": "14.00",
                        "available": "true"
                    }
                }
            ]
        }
    }
}
Response fields
FieldTypeDescription
response.success.products array List of style / colour / size combinations matching the filter. Each entry is wrapped in a `product` object.
response.success.products[].product.style string Style name (e.g. `Classic`, `Hoodie`).
response.success.products[].product.color string Colour name (e.g. `Red`).
response.success.products[].product.size string Size name (e.g. `Large`, `2 X-Large`).
response.success.products[].product.price string Per-unit price in USD for this SKU.
response.success.products[].product.available string `"true"` if currently in stock, `"false"` otherwise.
POST /api/v2/CreateProduct/ CreateProduct

Create a new product in your catalogue from a design image URL. The product is generated for every size that exists in your Pricing for the chosen style + colour. Sizes are NOT specified in the request — the system uses what you have priced.

Images must be publicly reachable over HTTPS at request time — we fetch them synchronously. PNG with transparency is strongly recommended; JPG is rejected with error 93. SKUs are generated automatically for every size you have priced for this style + colour — you don't pass a sizes list.
Request parameters
FieldTypeDescription
api_key required string Your API key from /cp/api.
product.title required string Product title. Shown on the product page and on invoices/order summaries.
product.url required string Publicly reachable design image URL (PNG with transparency preferred, minimum 2400×3200 recommended for DTG). Must begin with `https://`. Base64-encoded image data may also be sent in this field.
product.style required string Style name (e.g. `Classic`, `Apron`, `Hoodie`, `Ladies`, `V-Neck`). Use GetAvailableProducts to list valid style names.
product.color required string Single colour name (e.g. `Black`, `Navy`, `Heather Grey`). Use GetAvailableProducts to list valid colour names for the chosen style.
product.category optional string Top-level category that helps organize products on Tshirtgang (e.g. `Various`, `Funny`, `Holiday`).
product.custom_category.category optional string Custom category name. Max 80 characters. Created on-the-fly if it doesn't already exist for your account.
Example request
curl -X POST https://www.tshirtgang.com/api/v2/CreateProduct/ \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_API_KEY","product":{"title":"My Product Title T Shirt","url":"https://mywebsite.com/path/to/valid/file.png","style":"Apron","color":"Black","category":"Various","custom_category":{"category":"custom category"}}}'
Example response
{
    "response": {
        "success": {
            "product_id": "1234567",
            "preview_image": "https://s3.us-east-2.amazonaws.com/path/to/your/image.png"
        }
    }
}
Response fields
FieldTypeDescription
response.success.product_id integer Product ID — use as `product_id` in CreateOrder.
response.success.preview_image string CDN URL of the generated mockup preview image.
POST /api/v2/GetSellerProducts/ GetSellerProducts

Retrieve your product catalogue with pagination and optional filters. All pagination/filter fields live inside a `filter` wrapper object.

Increment `page` until an empty `products` array is returned.
Request parameters
FieldTypeDescription
api_key required string Your API key from /cp/api.
filter.items_per_page required integer How many items to display per results page. Minimum value `1`. Maximum value `1000`. Default value `1000`.
filter.page required integer Using `items_per_page` tag, configure which page to display. Default value `1`.
filter.style optional string Filter by the style of shirt your product is on. Use GetAvailableProducts to list valid style names.
filter.color optional string Filter by the shirt colour. Use GetAvailableProducts to list valid colour names.
filter.product_id optional string Look up a single product from the seller. Only details for this product will be returned.
filter.category optional string Filter by the top-level category you have organised the product into.
Example request
curl -X POST https://www.tshirtgang.com/api/v2/GetSellerProducts/ \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_API_KEY","filter":{"items_per_page":"10","page":"1","product_id":"999912345"}}'
Example response
{
    "response": {
        "success": {
            "products": [
                {
                    "product": {
                        "product_id": "999912345",
                        "title": "My Custom Title",
                        "style": "Classic",
                        "color": "Black",
                        "category": "Various",
                        "model": "1",
                        "preview_image": "https://s3.us-east-2.amazonaws.com/path/to/your/image.png"
                    }
                }
            ]
        }
    }
}
Response fields
FieldTypeDescription
response.success.products array Page of product entries. Each entry is wrapped in a `product` object.
response.success.products[].product.product_id string Product ID — use as `product_id` in CreateOrder.
response.success.products[].product.title string Product title.
response.success.products[].product.style string Style name (e.g. `Classic`, `Hoodie`).
response.success.products[].product.color string Shirt colour name (e.g. `Black`).
response.success.products[].product.category string Top-level category assigned to the product.
response.success.products[].product.model string Model identifier for the product.
response.success.products[].product.preview_image string CDN URL of the front mockup preview image.
POST /api/v2/GetProductLatency/ GetProductLatency

Estimated production turnaround (in business days) per style, before shipping. Use this to display "Ships in X days" on your product pages. Returns every style with a recorded latency; pass `filter.style` to scope to one.

Latency is a live estimate, recalculated from the production queue. Retry this once per day for cached "estimated ship date" displays. Omitting `filter.style` returns the full table.
Request parameters
FieldTypeDescription
api_key required string Your API key from /cp/api.
filter.style optional string Style name (e.g. `Classic`, `Hoodie`, `Ladies`). Returns just the matching style. Omit to return every style.
Example request
curl -X POST https://www.tshirtgang.com/api/v2/GetProductLatency/ \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_API_KEY","filter":{"style":"Classic"}}'
Example response
{
    "response": {
        "success": {
            "products": [
                {
                    "product": {
                        "style": "Classic",
                        "style_id": 1,
                        "latency": 1
                    }
                }
            ]
        }
    }
}
Response fields
FieldTypeDescription
response.success.products array List of latency records. Each entry is wrapped in a `product` object.
response.success.products[].product.style string Style name.
response.success.products[].product.style_id integer Internal style ID for the row.
response.success.products[].product.latency integer Average in-house production time, in business days, excluding shipping.

Ready to build?

Free to create, pay-as-you-go on orders. Be live in minutes.

  1. 1
    Create an account Free Tshirtgang seller account — no card required.
  2. 2
    Grab your API key Generate from the control panel at /cp/api.
  3. 3
    Integrate & launch POST your first product or order — done.