{
  "openapi": "3.1.0",
  "info": {
    "title": "SheetYield DTF Planning API",
    "version": "1.0.0",
    "description": "Read-only transfer planning and artwork resolution checks."
  },
  "externalDocs": {
    "url": "https://sheetyield.com/agent-tools/"
  },
  "servers": [
    {
      "url": "https://sheetyield.com"
    }
  ],
  "paths": {
    "/api/v1/estimate": {
      "post": {
        "operationId": "estimate_dtf_order",
        "summary": "Compare delivered DTF quotes",
        "description": "Estimate what it costs to print a direct-to-film (DTF) order on gang sheets. Compare up to three supplier rate cards, up to 40 transfers in total, and an optional quote for individual transfers. Requires actual rates and finished sizes. Returns checked layouts, shipping, per-design costs, and whether the cheapest price was proven. The review link shows the inputs, layout, and next steps for printing. Share it only with the intended recipients.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "designs": {
                    "minItems": 1,
                    "maxItems": 4,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40,
                          "description": "A short design label for the layout and cost ledger, such as Back print."
                        },
                        "width_in": {
                          "type": "number",
                          "minimum": 0.01,
                          "maximum": 200,
                          "multipleOf": 0.01,
                          "description": "Finished print width in inches, to two decimal places. Exclude transparent margins."
                        },
                        "height_in": {
                          "type": "number",
                          "minimum": 0.01,
                          "maximum": 200,
                          "multipleOf": 0.01,
                          "description": "Finished print height in inches, to two decimal places. Exclude transparent margins."
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 40,
                          "description": "Number of copies of this design. Include any spares the customer wants printed."
                        }
                      },
                      "required": [
                        "label",
                        "width_in",
                        "height_in",
                        "quantity"
                      ],
                      "additionalProperties": false,
                      "description": "One design at one finished size."
                    },
                    "description": "Finished design dimensions. Up to 40 transfers across all designs."
                  },
                  "suppliers": {
                    "minItems": 1,
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40,
                          "description": "A short supplier label for the comparison, such as Shop A."
                        },
                        "shipping_cents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 500000,
                          "description": "Flat shipping charge for one complete order below any free-shipping minimum, in whole US cents. Use 0 for free shipping or pickup."
                        },
                        "free_shipping_at_cents": {
                          "description": "Minimum sheet subtotal for free shipping, in whole US cents. The exact minimum qualifies. Omit if there is no threshold.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 500000
                        },
                        "stocks": {
                          "minItems": 1,
                          "maxItems": 4,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "width_in": {
                                "type": "number",
                                "minimum": 1,
                                "maximum": 30,
                                "multipleOf": 0.01,
                                "description": "Full stock width in inches, to two decimal places. The tool applies edge clearance."
                              },
                              "height_in": {
                                "type": "number",
                                "minimum": 1,
                                "maximum": 120,
                                "multipleOf": 0.01,
                                "description": "Full stock length in inches, to two decimal places. The tool applies edge clearance."
                              },
                              "price_cents": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 500000,
                                "description": "Price of one sheet at this size before tax and shipping, in whole US cents. $12.50 is 1250."
                              }
                            },
                            "required": [
                              "width_in",
                              "height_in",
                              "price_cents"
                            ],
                            "additionalProperties": false,
                            "description": "One purchasable sheet size from the rate card."
                          },
                          "description": "One to four sheet sizes this supplier sells, with the quoted price for each."
                        }
                      },
                      "required": [
                        "label",
                        "shipping_cents",
                        "stocks"
                      ],
                      "additionalProperties": false,
                      "description": "The quoted rate card for one supplier."
                    },
                    "description": "Each complete order uses one supplier."
                  },
                  "gap_in": {
                    "default": 0.25,
                    "description": "Minimum space between prints, in inches. Use the supplier requirement. Default 0.25.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 2,
                    "multipleOf": 0.01
                  },
                  "edge_in": {
                    "default": 0.25,
                    "description": "Unused inset along each sheet edge, in inches. Use the supplier requirement. Default 0.25.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 2,
                    "multipleOf": 0.01
                  },
                  "allow_rotation": {
                    "default": true,
                    "description": "Whether the layout may turn artwork 90 degrees. Use false when direction must be preserved. Default true.",
                    "type": "boolean"
                  },
                  "individual_quote_cents": {
                    "description": "Optional delivered quote for individually sized transfers, in whole US cents. Include shipping, omit tax, and use the same finished sizes and quantities.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5000000
                  }
                },
                "required": [
                  "designs",
                  "suppliers"
                ],
                "additionalProperties": false
              },
              "examples": {
                "free-shipping-cliff": {
                  "summary": "One 6 by 6 inch design needs one transfer. A 10 by 10 sheet is $38, a 12 by 12 is $40, and shipping is $16 below a $40 sheet subtotal. Compare the delivered totals.",
                  "value": {
                    "designs": [
                      {
                        "label": "Badge",
                        "width_in": 6,
                        "height_in": 6,
                        "quantity": 1
                      }
                    ],
                    "suppliers": [
                      {
                        "label": "Shop A",
                        "shipping_cents": 1600,
                        "free_shipping_at_cents": 4000,
                        "stocks": [
                          {
                            "width_in": 10,
                            "height_in": 10,
                            "price_cents": 3800
                          },
                          {
                            "width_in": 12,
                            "height_in": 12,
                            "price_cents": 4000
                          }
                        ]
                      }
                    ]
                  }
                },
                "delivered-beats-subtotal": {
                  "summary": "Compare two rate cards for four 5 by 5 inch prints and a $24 delivered individual-transfer quote. Use zero gap and zero margin for this test.",
                  "value": {
                    "designs": [
                      {
                        "label": "Chest patch",
                        "width_in": 5,
                        "height_in": 5,
                        "quantity": 4
                      }
                    ],
                    "suppliers": [
                      {
                        "label": "Shop A",
                        "shipping_cents": 900,
                        "stocks": [
                          {
                            "width_in": 10,
                            "height_in": 10,
                            "price_cents": 1200
                          }
                        ]
                      },
                      {
                        "label": "Shop B",
                        "shipping_cents": 300,
                        "stocks": [
                          {
                            "width_in": 10,
                            "height_in": 10,
                            "price_cents": 1400
                          }
                        ]
                      }
                    ],
                    "gap_in": 0,
                    "edge_in": 0,
                    "individual_quote_cents": 2400
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version",
                    "status",
                    "currency",
                    "transfers",
                    "optimality_proven",
                    "options",
                    "review_url"
                  ],
                  "properties": {
                    "version": {
                      "const": "1"
                    },
                    "status": {
                      "enum": [
                        "estimated",
                        "no_layout_found"
                      ]
                    },
                    "currency": {
                      "const": "USD"
                    },
                    "transfers": {
                      "type": "integer"
                    },
                    "best_supplier_index": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Zero-based index in the request."
                    },
                    "best_total_cents": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "lower_bound_cents": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Relaxed lower bound across the supplied rate cards."
                    },
                    "optimality_proven": {
                      "type": "boolean",
                      "description": "A checked layout matches the lower bound under the submitted rules and sheet limit."
                    },
                    "comparison": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "individual_quote_cents": {
                          "type": "integer"
                        },
                        "savings_cents": {
                          "type": "integer"
                        }
                      }
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "Per-supplier status, print and shipping cents, sheet sizes and placements, and the per-design cost ledger."
                      }
                    },
                    "review_url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Share only with intended recipients. The URL fragment contains the quote inputs."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or missing JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Origin is not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds 8 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Invalid fields or job exceeds the transfer limit",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Estimate rate limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/artwork-dpi": {
      "post": {
        "operationId": "check_artwork_dpi",
        "summary": "Check effective print DPI",
        "description": "Check both axes of a DTF artwork at the intended print size using cropped pixel dimensions. Returns the limiting effective DPI, the target check, and maximum print dimensions at that target rounded down to 0.01 inch. The user should preserve the artwork aspect ratio.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pixel_width": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000,
                    "description": "Width of the visible artwork in pixels after cropping transparent margins."
                  },
                  "pixel_height": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000,
                    "description": "Height of the visible artwork in pixels after cropping transparent margins."
                  },
                  "width_in": {
                    "type": "number",
                    "minimum": 0.01,
                    "maximum": 200,
                    "multipleOf": 0.01,
                    "description": "Finished print width in inches, to two decimal places. Exclude transparent margins."
                  },
                  "height_in": {
                    "type": "number",
                    "minimum": 0.01,
                    "maximum": 200,
                    "multipleOf": 0.01,
                    "description": "Finished print height in inches, to two decimal places. Exclude transparent margins."
                  },
                  "target_dpi": {
                    "default": 300,
                    "description": "Minimum resolution required on both axes. Use the printer’s requirement. Default 300 DPI.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2400
                  }
                },
                "required": [
                  "pixel_width",
                  "pixel_height",
                  "width_in",
                  "height_in"
                ],
                "additionalProperties": false
              },
              "examples": {
                "dpi-weak-axis": {
                  "summary": "Check a 1500 by 1199 pixel crop printed at 5 by 4 inches against a 300 DPI target.",
                  "value": {
                    "pixel_width": 1500,
                    "pixel_height": 1199,
                    "width_in": 5,
                    "height_in": 4,
                    "target_dpi": 300
                  }
                },
                "dpi-exact-target": {
                  "summary": "Check a 975 by 600 pixel crop printed at 3.25 by 2 inches against a 300 DPI target.",
                  "value": {
                    "pixel_width": 975,
                    "pixel_height": 600,
                    "width_in": 3.25,
                    "height_in": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version",
                    "dpi_x",
                    "dpi_y",
                    "limiting_dpi",
                    "target_dpi",
                    "meets_target",
                    "max_width_in_at_target",
                    "max_height_in_at_target"
                  ],
                  "properties": {
                    "version": {
                      "const": "1"
                    },
                    "dpi_x": {
                      "type": "integer"
                    },
                    "dpi_y": {
                      "type": "integer"
                    },
                    "limiting_dpi": {
                      "type": "integer"
                    },
                    "target_dpi": {
                      "type": "integer"
                    },
                    "meets_target": {
                      "type": "boolean"
                    },
                    "max_width_in_at_target": {
                      "type": "number"
                    },
                    "max_height_in_at_target": {
                      "type": "number"
                    },
                    "guide_url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or missing JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Origin is not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds 8 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Invalid fields or job exceeds the transfer limit",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
