{
  "openapi": "3.1.1",
  "info": {
    "title": "Connect",
    "version": "v0.1-alpha"
  },
  "paths": {
    "/v0.1-alpha/nesting/nest": {
      "post": {
        "tags": [
          "nesting"
        ],
        "summary": "Create a nest",
        "description": "Creates a Nest from a set of parts. Need to turn a file into parts? Check out [Import Part](import-parts).",
        "operationId": "CreateNest",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectEnvelopeOfCreateNestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "An unexpected error occurred on the server.",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "$ref": "#/components/schemas/ConnectEnvelopeObjectResult"
                }
              }
            }
          }
        },
        "security": [
          {
            "apikey": []
          }
        ]
      }
    },
    "/v0.1-alpha/parts/import": {
      "post": {
        "tags": [
          "parts"
        ],
        "summary": "Import parts",
        "description": "Parts are the portable, singular geometry units for use within the Stella Connect ecosystem.\n        \nYou'll need these if you want to perform a Nest, for example. If you use a file that has multiple parts (separate closed contours) we will attempt to extract all of the individual parts contained within that file. \n        \nFile types supported:\n   - DXF\n   - DWG",
        "operationId": "ImportParts",
        "requestBody": {
          "description": "",
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImportFilesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateNestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "413": {
            "description": "The upload exceeded the maximum request body size.",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "$ref": "#/components/schemas/ConnectEnvelopeObjectResult"
                }
              }
            }
          },
          "500": {
            "description": "Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectEnvelopeObjectResult"
                }
              }
            }
          }
        },
        "security": [
          {
            "apikey": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "CreateNestResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "parts": {
            "type": "array",
            "description": "Collection of parts included in the nest",
            "items": {
              "$ref": "#/components/schemas/NestingPart"
            }
          },
          "sheets": {
            "type": "array",
            "description": "Collection of sheets with their rendered layout images",
            "items": {
              "$ref": "#/components/schemas/SheetWithImage"
            }
          },
          "cutLength": {
            "type": "number",
            "description": "Total cut length across all nested parts",
            "format": "double"
          },
          "measurementUnit": {
            "type": "string",
            "description": "Unit of measurement for the cut length"
          }
        }
      },
      "NestingPart": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "partId": {
            "type": "string",
            "description": "Unique identifier for the part",
            "format": "guid"
          },
          "partName": {
            "type": "string",
            "description": "Name of the part"
          },
          "measurementUnit": {
            "type": "string",
            "description": "Unit of measurement for the part's dimensions"
          },
          "scaleToMeasurementUnit": {
            "type": "boolean",
            "description": "Whether the part geometry was scaled to match the measurement unit"
          },
          "grain": {
            "type": "boolean",
            "description": "Whether grain direction was enforced during nesting"
          },
          "quantity": {
            "type": "integer",
            "description": "Quantity of this part requested",
            "format": "int32"
          }
        }
      },
      "SheetWithImage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "sheet": {
            "description": "Sheet layout details including dimensions and weight information",
            "$ref": "#/components/schemas/NestedSheet"
          },
          "images": {
            "type": "array",
            "description": "Base64-encoded PNG images of the nested layout on this sheet",
            "items": {
              "type": "string"
            }
          },
          "imageFormat": {
            "type": "string",
            "description": "MIME type and encoding of the images (e.g., \"image/png;base64\")"
          }
        }
      },
      "NestedSheet": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "sheetId": {
            "type": "string",
            "description": "Unique identifier for the sheet",
            "format": "guid"
          },
          "productId": {
            "type": "string",
            "description": "Product identifier for the sheet in the material catalog"
          },
          "variantId": {
            "type": "string",
            "description": "Product variant identifier"
          },
          "name": {
            "type": "string",
            "description": "Display name of the sheet material"
          },
          "materialType": {
            "type": "string",
            "description": "Material classification (e.g., \"Steel\", \"Aluminum\")"
          },
          "weightCategory": {
            "type": "string",
            "description": "Weight category classification of the material"
          },
          "keepRemnant": {
            "type": "boolean",
            "description": "Whether the remnant is retained after cutting"
          },
          "remnantCropType": {
            "type": "string",
            "description": "How the remnant is cropped (e.g., \"VerticalCrop\", \"HorizontalCrop\")"
          },
          "isCoil": {
            "type": "boolean",
            "description": "Whether the source material is a coil"
          },
          "lengthUnit": {
            "type": "string",
            "description": "Unit of measure for all length values"
          },
          "weightUnit": {
            "type": "string",
            "description": "Unit of measure for all weight values"
          },
          "length": {
            "type": "number",
            "description": "Total length of the sheet",
            "format": "double"
          },
          "lengthUsed": {
            "type": "number",
            "description": "Length of the sheet consumed by the nested parts",
            "format": "double"
          },
          "width": {
            "type": "number",
            "description": "Total width of the sheet",
            "format": "double"
          },
          "widthUsed": {
            "type": "number",
            "description": "Width of the sheet consumed by the nested parts",
            "format": "double"
          },
          "thickness": {
            "type": "number",
            "description": "Sheet thickness",
            "format": "double"
          },
          "weight": {
            "type": "number",
            "description": "Total weight of the sheet",
            "format": "double"
          },
          "unitPartWeight": {
            "type": "number",
            "description": "True weight of one piece of the nested part",
            "format": "double"
          },
          "unitNestedWeight": {
            "type": "number",
            "description": "Nested weight of one piece (accounts for orientation and grain)",
            "format": "double"
          },
          "unitRectangularWeight": {
            "type": "number",
            "description": "Bounding-box weight of one piece of the nested part",
            "format": "double"
          },
          "totalPartWeight": {
            "type": "number",
            "description": "True weight of all nested parts combined",
            "format": "double"
          },
          "totalRectangularWeight": {
            "type": "number",
            "description": "Bounding-box weight of all nested parts combined",
            "format": "double"
          },
          "numberOfFullSheets": {
            "type": "integer",
            "description": "Number of complete full sheets used",
            "format": "int32"
          },
          "numberOfUnitsPerSheet": {
            "type": "integer",
            "description": "Number of parts nested on a single sheet",
            "format": "int32"
          },
          "numberOfUnitsNested": {
            "type": "integer",
            "description": "Total number of part units successfully nested",
            "format": "int32"
          },
          "numberOfSheetsRequired": {
            "type": "integer",
            "description": "Total number of sheets required (rounded up)",
            "format": "int32"
          },
          "totalNumberOfSheets": {
            "type": "number",
            "description": "Fractional total number of sheets consumed",
            "format": "double"
          },
          "totalSheetWeight": {
            "type": "number",
            "description": "Total weight of all sheets consumed",
            "format": "double"
          }
        }
      },
      "ConnectEnvelopeObjectResult": {
        "type": "object",
        "description": "Non-generic base of ConnectEnvelope`1. Used by endpoints that return\nan untyped or error-only response.",
        "additionalProperties": false,
        "properties": {
          "data": {
            "description": "The response payload. Typed callers should prefer Data."
          },
          "errors": {
            "type": "array",
            "description": "One or more errors describing why the request failed. Absent (`null`) on success.",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/ConnectApiError"
            }
          },
          "paging": {
            "description": "Paging metadata for list endpoints. Absent on single-item responses.",
            "nullable": true,
            "$ref": "#/components/schemas/Paging"
          }
        }
      },
      "ConnectApiError": {
        "type": "object",
        "description": "A single error entry attached to a ConnectEnvelope`1 or\nConnectEnvelopeObjectResult response. Multiple errors may be returned\nin one response when several problems are detected (e.g. batch validation).",
        "additionalProperties": false,
        "properties": {
          "description": {
            "type": "string",
            "description": "Human-readable explanation of the error. Intended for display to end users or logs.\nWording is not stable and should not be branched on.",
            "nullable": true
          },
          "errorId": {
            "type": "string",
            "description": "Machine-readable, stable error identifier. Consumers should branch on this value\nrather than on Description. See `ConnectErrorIds` for the catalog.",
            "nullable": true
          }
        }
      },
      "Paging": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "limit": {
            "type": "integer",
            "format": "int32"
          },
          "start": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "ImportFilesRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "minLength": 1,
            "nullable": false,
            "items": {
              "type": "string",
              "format": "binary"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "the dto used to send an error response to the client",
        "additionalProperties": false,
        "properties": {
          "statusCode": {
            "type": "integer",
            "description": "the http status code sent to the client. default is 400.",
            "format": "int32",
            "default": 400
          },
          "message": {
            "type": "string",
            "description": "the message for the error response",
            "default": "One or more errors occurred!"
          },
          "errors": {
            "type": "object",
            "description": "the collection of errors for the current context",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "ConnectEnvelopeOfCreateNestResponse": {
        "type": "object",
        "description": "Standard response wrapper for every Stella Connect endpoint. Successful responses\npopulate Data; failures populate Errors.\nList responses additionally populate Paging.",
        "additionalProperties": false,
        "properties": {
          "data": {
            "nullable": true,
            "$ref": "#/components/schemas/CreateNestResponse"
          },
          "errors": {
            "type": "array",
            "description": "One or more errors describing why the request failed. Absent (`null`) on success.",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/ConnectApiError"
            }
          },
          "paging": {
            "description": "Paging metadata for list endpoints. Absent on single-item responses.",
            "nullable": true,
            "$ref": "#/components/schemas/Paging"
          }
        }
      },
      "CreateNestRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "nestingOptions",
          "parts",
          "sheetOptions",
          "imageHeight",
          "imageWidth"
        ],
        "properties": {
          "outputLengthUnit": {
            "type": "string",
            "description": "The unit of measurement for output lengths."
          },
          "outputTimeUnit": {
            "type": "string",
            "description": "The unit of measurement for output times."
          },
          "outputWeightUnit": {
            "type": "string",
            "description": "The unit of measurement for output weights."
          },
          "nestingOptions": {
            "$ref": "#/components/schemas/CreateNestRequest_PlanarNestingOptions"
          },
          "parts": {
            "type": "array",
            "nullable": false,
            "items": {
              "$ref": "#/components/schemas/CreateNestRequest_NestingPart"
            }
          },
          "sheetOptions": {
            "nullable": false,
            "$ref": "#/components/schemas/CreateNestRequest_NestingSheet"
          },
          "measurementUnit": {
            "type": "string"
          },
          "imageHeight": {
            "type": "integer",
            "format": "int32",
            "minLength": 1,
            "nullable": false
          },
          "imageWidth": {
            "type": "integer",
            "format": "int32",
            "minLength": 1,
            "nullable": false
          },
          "croppingOptions": {
            "$ref": "#/components/schemas/CreateNestRequest_CroppingRenderOptions"
          },
          "deadZoneOptions": {
            "$ref": "#/components/schemas/CreateNestRequest_DeadZoneRenderOptions"
          },
          "partOptions": {
            "$ref": "#/components/schemas/CreateNestRequest_RenderOptions"
          },
          "remnantOptions": {
            "$ref": "#/components/schemas/CreateNestRequest_RenderOptions"
          }
        }
      },
      "CreateNestRequest_PlanarNestingOptions": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "keepRemnant": {
            "type": "boolean"
          },
          "horizontalRemnantPercentage": {
            "type": "number",
            "format": "float"
          },
          "verticalRemnantPercentage": {
            "type": "number",
            "format": "float"
          },
          "horizontalCrop": {
            "type": "number",
            "format": "float"
          },
          "verticalCrop": {
            "type": "number",
            "format": "float"
          },
          "edgeDistance": {
            "type": "number",
            "format": "float"
          },
          "partClearance": {
            "type": "number",
            "format": "float"
          },
          "bottomDeadZone": {
            "type": "number",
            "format": "float"
          },
          "leftDeadZone": {
            "type": "number",
            "format": "float"
          },
          "deadZoneUnit": {
            "type": "string"
          },
          "scrapPercentage": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "CreateNestRequest_NestingPart": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "partId": {
            "type": "string",
            "format": "guid"
          },
          "partName": {
            "type": "string"
          },
          "measurementUnit": {
            "type": "string"
          },
          "scaleToMeasurementUnit": {
            "type": "boolean"
          },
          "grain": {
            "type": "boolean"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "CreateNestRequest_NestingSheet": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "productId": {
            "type": "string"
          },
          "materialType": {
            "type": "string"
          },
          "density": {
            "type": "number",
            "format": "double"
          },
          "densityUnit": {
            "type": "string"
          },
          "thickness": {
            "type": "number",
            "format": "double"
          },
          "lengthUnit": {
            "type": "string"
          },
          "sizes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateNestRequest_SheetSize"
            }
          }
        }
      },
      "CreateNestRequest_SheetSize": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "variantId": {
            "type": "string"
          },
          "measurementUnit": {
            "type": "string"
          },
          "length": {
            "type": "number",
            "format": "double"
          },
          "width": {
            "type": "number",
            "format": "double"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "CreateNestRequest_CroppingRenderOptions": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fillColor": {
            "type": "string"
          },
          "hatchStyle": {
            "nullable": true,
            "$ref": "#/components/schemas/HatchStyle"
          },
          "strokeColor": {
            "type": "string"
          },
          "strokeStyle": {
            "$ref": "#/components/schemas/StrokeStyle"
          },
          "cropLength": {
            "type": "number",
            "format": "float"
          },
          "cropWidth": {
            "type": "number",
            "format": "float"
          }
        }
      },
      "HatchStyle": {
        "type": "string",
        "description": "",
        "x-enumNames": [
          "Horizontal",
          "Vertical",
          "ForwardDiagonal",
          "BackwardDiagonal",
          "Cross",
          "DiagonalCross",
          "Percent05",
          "Percent10",
          "Percent20",
          "Percent25",
          "Percent30",
          "Percent40",
          "Percent50",
          "Percent60",
          "Percent70",
          "Percent75",
          "Percent80",
          "Percent90",
          "LightDownwardDiagonal",
          "LightUpwardDiagonal",
          "DarkDownwardDiagonal",
          "DarkUpwardDiagonal",
          "WideDownwardDiagonal",
          "WideUpwardDiagonal",
          "LightVertical",
          "LightHorizontal",
          "NarrowVertical",
          "NarrowHorizontal",
          "DarkVertical",
          "DarkHorizontal",
          "DashedDownwardDiagonal",
          "DashedUpwardDiagonal",
          "DashedHorizontal",
          "DashedVertical",
          "SmallConfetti",
          "LargeConfetti",
          "ZigZag",
          "Wave",
          "DiagonalBrick",
          "HorizontalBrick",
          "Weave",
          "Plaid",
          "Divot",
          "DottedGrid",
          "DottedDiamond",
          "Shingle",
          "Trellis",
          "Sphere",
          "SmallGrid",
          "SmallCheckerBoard",
          "LargeCheckerBoard",
          "OutlinedDiamond",
          "SolidDiamond"
        ],
        "enum": [
          "Horizontal",
          "Vertical",
          "ForwardDiagonal",
          "BackwardDiagonal",
          "Cross",
          "DiagonalCross",
          "Percent05",
          "Percent10",
          "Percent20",
          "Percent25",
          "Percent30",
          "Percent40",
          "Percent50",
          "Percent60",
          "Percent70",
          "Percent75",
          "Percent80",
          "Percent90",
          "LightDownwardDiagonal",
          "LightUpwardDiagonal",
          "DarkDownwardDiagonal",
          "DarkUpwardDiagonal",
          "WideDownwardDiagonal",
          "WideUpwardDiagonal",
          "LightVertical",
          "LightHorizontal",
          "NarrowVertical",
          "NarrowHorizontal",
          "DarkVertical",
          "DarkHorizontal",
          "DashedDownwardDiagonal",
          "DashedUpwardDiagonal",
          "DashedHorizontal",
          "DashedVertical",
          "SmallConfetti",
          "LargeConfetti",
          "ZigZag",
          "Wave",
          "DiagonalBrick",
          "HorizontalBrick",
          "Weave",
          "Plaid",
          "Divot",
          "DottedGrid",
          "DottedDiamond",
          "Shingle",
          "Trellis",
          "Sphere",
          "SmallGrid",
          "SmallCheckerBoard",
          "LargeCheckerBoard",
          "OutlinedDiamond",
          "SolidDiamond"
        ]
      },
      "StrokeStyle": {
        "type": "string",
        "description": "",
        "x-enumNames": [
          "Solid",
          "Dash",
          "Dot",
          "DashDot",
          "DashDotDot",
          "Custom"
        ],
        "enum": [
          "Solid",
          "Dash",
          "Dot",
          "DashDot",
          "DashDotDot",
          "Custom"
        ]
      },
      "CreateNestRequest_DeadZoneRenderOptions": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fillColor": {
            "type": "string"
          },
          "hatchStyle": {
            "nullable": true,
            "$ref": "#/components/schemas/HatchStyle"
          },
          "strokeColor": {
            "type": "string"
          },
          "strokeStyle": {
            "$ref": "#/components/schemas/StrokeStyle"
          },
          "bottom": {
            "type": "number",
            "format": "float"
          },
          "left": {
            "type": "number",
            "format": "float"
          }
        }
      },
      "CreateNestRequest_RenderOptions": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fillColor": {
            "type": "string"
          },
          "hatchStyle": {
            "nullable": true,
            "$ref": "#/components/schemas/HatchStyle"
          },
          "strokeColor": {
            "type": "string"
          },
          "strokeStyle": {
            "$ref": "#/components/schemas/StrokeStyle"
          }
        }
      }
    },
    "securitySchemes": {
      "apikey": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      }
    }
  },
  "servers": [
    {
      "url": "https://connect.stellasource.com"
    }
  ]
}
