{
  "openapi": "3.1.0",
  "info": {
    "title": "ImageToPES Embroidery Digitizer & Binary Inspector API",
    "version": "1.2.0",
    "contact": {
      "name": "ImageToPES Support",
      "url": "https://imagetopes.com/contact",
      "email": "hello@imagetopes.com"
    },
    "description": "Public REST endpoints for converting PNG, JPG, and SVG artwork into Brother .PES (#PES0001), Tajima .DST, Janome .JEF, Bernina .EXP, and Pfaff .VP3 embroidery files and inspecting .PES/.DST binary stitch trajectories."
  },
  "x-service-info": {
    "categories": [
      "embroidery",
      "design",
      "cad",
      "commerce"
    ],
    "docs": {
      "homepage": "https://imagetopes.com",
      "apiReference": "https://imagetopes.com/openapi.json",
      "llms": "https://imagetopes.com/llms.txt"
    }
  },
  "servers": [
    {
      "url": "https://imagetopes.com"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Verify ImageToPES Studio and Rust Core health status",
        "responses": {
          "200": {
            "description": "Service health status and available presets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/inspect-embroidery": {
      "post": {
        "operationId": "inspectEmbroideryBinary",
        "summary": "Inspect a Brother .PES (#PES0001) or Tajima .DST (512-byte header) binary file for free",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileName": {
                    "type": "string"
                  },
                  "fileBase64": {
                    "type": "string"
                  }
                },
                "required": [
                  "fileName",
                  "fileBase64"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decoded stitch count, dimensions, color stops, and 2D trajectory",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "format": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "valid",
                    "format"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/convert-pes": {
      "post": {
        "operationId": "convertImageToPes",
        "summary": "Compile SVG or raster PNG/JPG/WebP artwork into 5 embroidery machine formats (.PES, .DST, .JEF, .EXP, .VP3) with 3D thread preview and worksheet",
        "x-payment-info": {
          "intent": "charge",
          "method": "stripe",
          "amount": "990",
          "currency": "USD",
          "description": "Unlock 5-format embroidery machine bundle (.PES, .DST, .JEF, .EXP, .VP3) with Starter Pack (15 Credits + 10 Studio Designs)",
          "protocols": [
            {
              "x402": {}
            },
            {
              "mpp": {
                "method": "stripe",
                "intent": "charge",
                "currency": "USD"
              }
            }
          ],
          "offers": [
            {
              "intent": "charge",
              "method": "stripe",
              "amount": "990",
              "currency": "USD",
              "description": "Starter Digitizer Pack (15 Credits)"
            },
            {
              "intent": "charge",
              "method": "stripe",
              "amount": "1990",
              "currency": "USD",
              "description": "Etsy Seller Pro Pack (60 Credits)"
            },
            {
              "intent": "charge",
              "method": "stripe",
              "amount": "2990",
              "currency": "USD",
              "description": "Commercial Studio Pack (200 Credits)"
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "presetId": {
                    "type": "string"
                  },
                  "svgText": {
                    "type": "string"
                  },
                  "imageBase64": {
                    "type": "string"
                  },
                  "imageExtension": {
                    "type": "string"
                  },
                  "fabric": {
                    "type": "string"
                  },
                  "hoop": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Compiled stitch preview, color stop worksheet, and download URLs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "unlocked": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required to download custom machine binary files (.PES, .DST, .JEF, .EXP, .VP3)"
          }
        }
      }
    }
  }
}