{
  "info": {
    "description": "Let AI assistants quote and prepare print orders for AI-generated designs. Assistants never handle payment: create a checkout link and give it to the user.",
    "title": "PrintFromAI Agent API",
    "version": "2.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/agent/catalog": {
      "get": {
        "operationId": "getPrintCatalog",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "summary": "List products, sizes (inches), stocks, options and quantity tiers"
      }
    },
    "/api/agent/checkout": {
      "post": {
        "operationId": "createCheckoutLink",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "agent": {
                    "description": "Name of the calling assistant (attribution)",
                    "example": "chatgpt",
                    "type": "string"
                  },
                  "back_image_url": {
                    "format": "uri",
                    "type": "string"
                  },
                  "coupon_code": {
                    "description": "Optional promo code (see /api/agent/promotions). Sales apply automatically.",
                    "example": "WELCOME10",
                    "type": "string"
                  },
                  "has_back": {
                    "description": "Print a design on the back (4/4)",
                    "type": "boolean"
                  },
                  "human_edit": {
                    "description": "Add the $25 Human Edit (designer fixes the file and sends a proof)",
                    "type": "boolean"
                  },
                  "image_url": {
                    "description": "Public https URL of the front design (checkout only)",
                    "format": "uri",
                    "type": "string"
                  },
                  "instructions": {
                    "maxLength": 1000,
                    "type": "string"
                  },
                  "options": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "example": {
                      "Corner Cut": "round-1-8"
                    },
                    "type": "object"
                  },
                  "orientation": {
                    "description": "Products with orientable=true (business cards): portrait prints a vertical card at the same price",
                    "enum": [
                      "landscape",
                      "portrait"
                    ],
                    "type": "string"
                  },
                  "product_slug": {
                    "description": "Slug from the catalog",
                    "example": "business-cards",
                    "type": "string"
                  },
                  "quantity": {
                    "description": "Must be one of the quantity tiers for the size",
                    "example": 250,
                    "type": "integer"
                  },
                  "size": {
                    "description": "sizes[].value from the catalog",
                    "example": "2x3.5",
                    "type": "string"
                  },
                  "variant_index": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "variant_name": {
                    "description": "Stock/material name (or use variant_index)",
                    "example": "Premium Suede",
                    "type": "string"
                  }
                },
                "required": [
                  "product_slug",
                  "size",
                  "quantity"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "checkout_url": {
                      "format": "uri",
                      "type": "string"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "quote": {
                      "properties": {
                        "currency": {
                          "type": "string"
                        },
                        "double_sided": {
                          "type": "boolean"
                        },
                        "product": {
                          "type": "string"
                        },
                        "promo": {
                          "description": "Present when a sale or code applies: total_cents is after the discount",
                          "properties": {
                            "coupon_cents": {
                              "type": "integer"
                            },
                            "coupon_code": {
                              "type": "string"
                            },
                            "list_total": {
                              "example": "$45.00",
                              "type": "string"
                            },
                            "note": {
                              "type": "string"
                            },
                            "sale_cents": {
                              "type": "integer"
                            },
                            "sale_name": {
                              "type": "string"
                            },
                            "saved_cents": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "quantity": {
                          "type": "integer"
                        },
                        "recommended_pixels": {
                          "example": "1088x638",
                          "type": "string"
                        },
                        "shipping": {
                          "type": "string"
                        },
                        "size": {
                          "type": "string"
                        },
                        "stock": {
                          "type": "string"
                        },
                        "total": {
                          "example": "$45.00",
                          "type": "string"
                        },
                        "total_cents": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          }
        },
        "summary": "Store the design and configuration; returns a checkout_url valid for 72 hours"
      }
    },
    "/api/agent/promotions": {
      "get": {
        "operationId": "getPromotions",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "summary": "Sales running now (applied automatically) and public coupon codes"
      }
    },
    "/api/agent/quote": {
      "post": {
        "operationId": "calculatePrintQuote",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "agent": {
                    "description": "Name of the calling assistant (attribution)",
                    "example": "chatgpt",
                    "type": "string"
                  },
                  "back_image_url": {
                    "format": "uri",
                    "type": "string"
                  },
                  "coupon_code": {
                    "description": "Optional promo code (see /api/agent/promotions). Sales apply automatically.",
                    "example": "WELCOME10",
                    "type": "string"
                  },
                  "has_back": {
                    "description": "Print a design on the back (4/4)",
                    "type": "boolean"
                  },
                  "human_edit": {
                    "description": "Add the $25 Human Edit (designer fixes the file and sends a proof)",
                    "type": "boolean"
                  },
                  "image_url": {
                    "description": "Public https URL of the front design (checkout only)",
                    "format": "uri",
                    "type": "string"
                  },
                  "instructions": {
                    "maxLength": 1000,
                    "type": "string"
                  },
                  "options": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "example": {
                      "Corner Cut": "round-1-8"
                    },
                    "type": "object"
                  },
                  "orientation": {
                    "description": "Products with orientable=true (business cards): portrait prints a vertical card at the same price",
                    "enum": [
                      "landscape",
                      "portrait"
                    ],
                    "type": "string"
                  },
                  "product_slug": {
                    "description": "Slug from the catalog",
                    "example": "business-cards",
                    "type": "string"
                  },
                  "quantity": {
                    "description": "Must be one of the quantity tiers for the size",
                    "example": 250,
                    "type": "integer"
                  },
                  "size": {
                    "description": "sizes[].value from the catalog",
                    "example": "2x3.5",
                    "type": "string"
                  },
                  "variant_index": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "variant_name": {
                    "description": "Stock/material name (or use variant_index)",
                    "example": "Premium Suede",
                    "type": "string"
                  }
                },
                "required": [
                  "product_slug",
                  "size",
                  "quantity"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "currency": {
                      "type": "string"
                    },
                    "double_sided": {
                      "type": "boolean"
                    },
                    "product": {
                      "type": "string"
                    },
                    "promo": {
                      "description": "Present when a sale or code applies: total_cents is after the discount",
                      "properties": {
                        "coupon_cents": {
                          "type": "integer"
                        },
                        "coupon_code": {
                          "type": "string"
                        },
                        "list_total": {
                          "example": "$45.00",
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        },
                        "sale_cents": {
                          "type": "integer"
                        },
                        "sale_name": {
                          "type": "string"
                        },
                        "saved_cents": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "recommended_pixels": {
                      "example": "1088x638",
                      "type": "string"
                    },
                    "shipping": {
                      "type": "string"
                    },
                    "size": {
                      "type": "string"
                    },
                    "stock": {
                      "type": "string"
                    },
                    "total": {
                      "example": "$45.00",
                      "type": "string"
                    },
                    "total_cents": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          }
        },
        "summary": "Exact price for a configuration (free US shipping included)"
      }
    }
  },
  "servers": [
    {
      "url": "https://printfromai.com"
    }
  ]
}
