{
 "openapi": "3.1.0",
 "info": {
  "title": "i Can Print That ordering API",
  "version": "2.0.0",
  "description": "Business printing and custom apparel, shipped anywhere in the US. Browse the catalog, get exact all-in prices, create a one-tap cart link, or place an order and get a secure pay link. Customers pay first, then approve a free digital proof; nothing prints until they approve it.",
  "contact": {
   "email": "hello@icanprintthat.com",
   "url": "https://icanprintthat.com"
  }
 },
 "servers": [
  {
   "url": "https://icanprintthat.com/apparel/api"
  }
 ],
 "paths": {
  "/agent.php": {
   "get": {
    "operationId": "getCatalog",
    "summary": "Product catalog with options, quantities and prices",
    "parameters": [
     {
      "name": "action",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "catalog"
       ]
      }
     },
     {
      "name": "q",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Search words, e.g. polo, banner, youth"
     },
     {
      "name": "type",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "print",
        "apparel",
        "design"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "422": {
      "description": "Validation errors (errors[] explains what to fix)"
     }
    }
   },
   "post": {
    "operationId": "orderAction",
    "summary": "quote | cart_link | checkout | status",
    "description": "quote \u2192 exact total. cart_link \u2192 cart_url that opens the filled cart on icanprintthat.com (customer pays there). checkout \u2192 creates the order, returns job + pay_url (only after the customer confirms items, total, name, email and address). status \u2192 order status.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "action"
        ],
        "properties": {
         "action": {
          "type": "string",
          "enum": [
           "quote",
           "cart_link",
           "checkout",
           "status"
          ]
         },
         "items": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/Item"
          },
          "maxItems": 25
         },
         "ship_to_state": {
          "type": "string"
         },
         "promo": {
          "type": "string"
         },
         "agent": {
          "type": "string"
         },
         "customer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "phone": {
            "type": "string"
           },
           "business": {
            "type": "string"
           }
          }
         },
         "ship_to": {
          "type": "object",
          "properties": {
           "line1": {
            "type": "string"
           },
           "line2": {
            "type": "string"
           },
           "city": {
            "type": "string"
           },
           "state": {
            "type": "string"
           },
           "zip": {
            "type": "string"
           }
          }
         },
         "artwork_url": {
          "type": "string"
         },
         "notes": {
          "type": "string"
         },
         "job": {
          "type": "string"
         },
         "email": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "422": {
      "description": "Validation errors (errors[] explains what to fix)"
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Item": {
    "type": "object",
    "required": [
     "product"
    ],
    "properties": {
     "product": {
      "type": "string",
      "description": "Product id from the catalog, e.g. bizcards, gildan-5000, design:piece"
     },
     "qty": {
      "type": "integer"
     },
     "options": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      },
      "description": "Print only, e.g. {\"Stock\":\"16PT C2S\",\"Coating\":\"Matte\"}"
     },
     "turnaround": {
      "type": "string"
     },
     "method": {
      "type": "string",
      "enum": [
       "screen",
       "dtg",
       "embroidery"
      ]
     },
     "ink_colors": {
      "type": "integer",
      "minimum": 1,
      "maximum": 4
     },
     "garment_color": {
      "type": "string"
     },
     "sizes": {
      "type": "object",
      "additionalProperties": {
       "type": "integer"
      }
     },
     "for": {
      "type": "string"
     },
     "notes": {
      "type": "string"
     }
    }
   }
  }
 }
}