{
  "openapi": "3.0.3",
  "info": {
    "title": "Slant 3D V2 API",
    "description": "3D Printing and manufacturing API that exists on top of the Slant 3D print farm. Allowing order creation for 3D Print on Demand applications, Prototyping, Bulk Ordering Parts, Price Estimations, and Internal Fulfillment operations. This spec is for automated tools and AI Agents.",
    "version": "2.0.0",
    "contact": {
      "email": "dev4@slant3d.com",
      "site-url": "https://slant3dapi.com"
    },
    "x-agent-hints": {
      "authentication": "Authorization: Bearer sl-******",
      "rate-limit": "100 requests per minute",
      "max-api-keys": "3",
      "maximum-platforms": "5",
      "pagination": "page and limit parameters on requests.",
      "usage": "api/usage to review key usage for all user keys",
      "file-upload": "Use presigned URLs for direct browser upload. Confirm upload required for a file to be valid.",
      "order-workflow": "Upload files → Draft order → Process Order → Fulfillment Label Created Internally → Webhook Order Updates",
      "webhooks": "Configure webhook URLs on platforms for order status updates",
      "platform-workflow": "A Platform ID is required on most requests, as it is the organizational foundation of the API. Create or utilize one of the already created platforms and attach the ID to requests where it is required."
    }
  },
  "servers": [
    {
      "url": "https://slant3dapi.com/v2/api",
      "description": "Production API server location for all requests"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "SessionAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API Key authentication using Bearer token (sl_****)"
      },
      "SessionAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "session",
        "description": "Session-based authentication for web interface"
      }
    },
    "schemas": {
      "ApiResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Whether the request was successful"
          },
          "message": {
            "type": "string",
            "description": "Human-readable response message"
          },
          "data": {
            "description": "Response data payload"
          }
        },
        "required": [
          "success",
          "message"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "message": {
            "type": "string",
            "example": "Error message"
          },
          "error": {
            "type": "string",
            "description": "Technical error details"
          }
        }
      },
      "Address": {
        "type": "object",
        "required": [
          "name",
          "line1",
          "city",
          "state",
          "zip",
          "country"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Full name for delivery"
          },
          "line1": {
            "type": "string",
            "description": "Address line 1"
          },
          "line2": {
            "type": "string",
            "description": "Address line 2 (optional)"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "zip": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "default": "US"
          }
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "publicPaymentServiceId": {
            "type": "string",
            "description": "Customer ID for payment processing"
          },
          "platformId": {
            "type": "string",
            "format": "uuid"
          },
          "details": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email"
              },
              "address": {
                "$ref": "#/components/schemas/Address"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "File": {
        "type": "object",
        "properties": {
          "publicFileServiceId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the file - use this for all file references"
          },
          "name": {
            "type": "string",
            "description": "Original file name"
          },
          "ownerId": {
            "type": "string",
            "description": "Your application's user ID"
          },
          "platformId": {
            "type": "string",
            "format": "uuid",
            "description": "Platform this file belongs to"
          },
          "type": {
            "type": "string",
            "enum": [
              "stl"
            ],
            "description": "File type - currently only STL supported"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Production notes from Slant3D team"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "fileURL": {
            "type": "string",
            "format": "uri",
            "description": "Presigned download URL (1 hour expiry)"
          },
          "STLMetrics": {
            "type": "object",
            "description": "Automatically generated file analysis",
            "properties": {
              "x": {
                "type": "number",
                "description": "Width in millimeters"
              },
              "y": {
                "type": "number",
                "description": "Depth in millimeters"
              },
              "z": {
                "type": "number",
                "description": "Height in millimeters"
              },
              "weight": {
                "type": "number",
                "description": "Estimated weight in grams"
              },
              "volume": {
                "type": "number",
                "description": "Volume in cubic centimeters"
              },
              "surfaceArea": {
                "type": "number",
                "description": "Surface area in square millimeters"
              },
              "imageURL": {
                "type": "string",
                "format": "uri",
                "description": "Preview image generated by OpenSCAD"
              }
            }
          }
        }
      },
      "OrderItem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "PRINT",
              "COMPONENT",
              "STATIONERY"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PROCESSING",
              "READY",
              "SHIPPED",
              "DELIVERED"
            ]
          },
          "price": {
            "type": "string",
            "description": "Item price in USD"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "SKU": {
            "type": "string",
            "nullable": true
          },
          "publicFileServiceId": {
            "type": "string",
            "format": "uuid",
            "description": "For PRINT items"
          },
          "filamentId": {
            "type": "string",
            "format": "uuid",
            "description": "For PRINT items"
          },
          "componentId": {
            "type": "string",
            "format": "uuid",
            "description": "For COMPONENT items"
          },
          "stationeryId": {
            "type": "string",
            "format": "uuid",
            "description": "For STATIONERY items"
          },
          "imageUrl": {
            "type": "string",
            "format": "uri",
            "description": "For STATIONERY items with custom image"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "publicId": {
            "type": "string",
            "description": "Public order identifier (SLANT_XXXXXXXXXX format)"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "PROCESSING",
              "SHIPPED",
              "DELIVERED",
              "CANCELED"
            ]
          },
          "platformId": {
            "type": "string",
            "format": "uuid"
          },
          "ownerId": {
            "type": "string",
            "description": "Your application's user ID"
          },
          "creatorId": {
            "type": "string",
            "format": "uuid"
          },
          "paymentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "processedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "arriveByDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveryCost": {
            "type": "string",
            "description": "Shipping cost in USD"
          },
          "printingCost": {
            "type": "string",
            "description": "Print cost in USD"
          },
          "customer": {
            "$ref": "#/components/schemas/Customer"
          },
          "fulfillment": {
            "type": "object",
            "nullable": true,
            "description": "Shipping and tracking information"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "options": {
            "type": "object",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Platform": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Platform unique identifier"
          },
          "name": {
            "type": "string",
            "description": "Platform display name"
          },
          "description": {
            "type": "string",
            "description": "Platform description"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Your application URL"
          },
          "webhookURL": {
            "type": "string",
            "format": "uri",
            "description": "Webhook endpoint for order status updates"
          },
          "webhookSecret": {
            "type": "string",
            "description": "Secret for webhook authentication"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "creatorId": {
            "type": "string",
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Component": {
        "type": "object",
        "description": "Available 3D printing components and add-ons",
        "properties": {
          "publicId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Component name"
          },
          "description": {
            "type": "string"
          },
          "price": {
            "type": "number",
            "description": "Price in USD"
          },
          "weight": {
            "type": "number",
            "description": "Weight in grams"
          },
          "imageUrl": {
            "type": "string",
            "format": "uri"
          },
          "dimensions": {
            "type": "string",
            "description": "Formatted dimensions string"
          },
          "quantity": {
            "type": "integer"
          },
          "public": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Filament": {
        "type": "object",
        "description": "Available filament materials and colors",
        "properties": {
          "publicId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Filament name"
          },
          "provider": {
            "type": "string",
            "description": "Filament manufacturer"
          },
          "profile": {
            "type": "string",
            "enum": [
              "PLA",
              "PETG",
              "ABS"
            ],
            "description": "Material type"
          },
          "color": {
            "type": "string",
            "description": "Color name"
          },
          "hexValue": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "description": "Hex color code"
          },
          "public": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          }
        }
      },
      "Stationery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "price": {
            "type": "number",
            "nullable": true
          },
          "weight": {
            "type": "number",
            "nullable": true
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "dimensions": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "public": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1,
            "description": "Current page number"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Items per page"
          },
          "total": {
            "type": "integer",
            "description": "Total number of items"
          },
          "totalPages": {
            "type": "integer",
            "description": "Total number of pages"
          },
          "hasNext": {
            "type": "boolean",
            "description": "Whether next page exists"
          },
          "hasPrevious": {
            "type": "boolean",
            "description": "Whether previous page exists"
          }
        }
      }
    }
  },
  "paths": {
    "/files": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Get files with filtering and pagination",
        "description": "Retrieve files associated with your account. Supports filtering by platform, owner, date range, and pagination.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "platformId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filter files by platform ID"
          },
          {
            "name": "ownerId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter files by your application's user ID"
          },
          {
            "name": "publicId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Get specific file by public ID"
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Filter files created after this date (YYYY-MM-DD)"
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Filter files created before this date (YYYY-MM-DD)"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "description": "Page number for pagination"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Number of files per page"
          }
        ],
        "responses": {
          "200": {
            "description": "Files retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/File"
                          }
                        },
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/files/{publicFileId}": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Get file by public ID",
        "description": "Retrieve a specific file by its public ID with fresh download URL",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "publicFileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Public file service ID"
          }
        ],
        "responses": {
          "200": {
            "description": "File retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/File"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "File not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "summary": "Delete file",
        "description": "Delete a file from storage. Only file creator can delete files.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "publicFileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "403": {
            "description": "Unauthorized to delete this file",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/files/direct-upload": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Generate presigned upload URL",
        "description": "Generate a presigned URL for direct browser upload to S3. This is the recommended method for file uploads.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "platformId"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "File name (will be sanitized)"
                  },
                  "platformId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Platform ID to associate file with"
                  },
                  "ownerId": {
                    "type": "string",
                    "description": "Your application's user ID"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Presigned URL generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "presignedUrl": {
                              "type": "string",
                              "format": "uri",
                              "description": "URL to upload file to (1 hour expiry)"
                            },
                            "key": {
                              "type": "string",
                              "description": "S3 object key"
                            },
                            "filePlaceholder": {
                              "$ref": "#/components/schemas/File",
                              "description": "File metadata to use in confirmation request"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/files/confirm-upload": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Confirm presigned upload completion",
        "description": "REQUIRED: Call this endpoint after successfully uploading to the presigned URL to trigger file processing and analysis.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "filePlaceholder"
                ],
                "properties": {
                  "filePlaceholder": {
                    "description": "The exact filePlaceholder object returned from /files/direct-upload",
                    "$ref": "#/components/schemas/File"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload confirmed and file processed",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/File",
                          "description": "Processed file with STL metrics and preview image"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/files/batch": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Get multiple files by IDs",
        "description": "Retrieve multiple files by their public IDs in a single request",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "publicIds"
                ],
                "properties": {
                  "publicIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "Array of public file service IDs"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Files retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/File"
                          }
                        },
                        "count": {
                          "type": "integer",
                          "description": "Number of files returned"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/platforms": {
      "get": {
        "tags": [
          "Platforms"
        ],
        "summary": "Get user platforms",
        "description": "Retrieve all platforms associated with your account",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Platforms retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Platform"
                          }
                        },
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Platforms"
        ],
        "summary": "Create platform",
        "description": "Create a new platform for organizing your 3D printing projects",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "url"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Platform name"
                  },
                  "description": {
                    "type": "string",
                    "description": "Platform description"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Your application URL"
                  },
                  "webhookURL": {
                    "type": "string",
                    "format": "uri",
                    "description": "Webhook endpoint for order status updates"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Platform created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Platform"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/platforms/{platformId}": {
      "get": {
        "tags": [
          "Platforms"
        ],
        "summary": "Get platform by ID",
        "description": "Retrieve details for a specific platform",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "platformId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Platform retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Platform"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Platforms"
        ],
        "summary": "Update platform",
        "description": "Update platform details",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "parameters": [
          {
            "name": "platformId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "webhookURL": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Platform updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Platform"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Platforms"
        ],
        "summary": "Delete platform",
        "description": "Delete a platform",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "parameters": [
          {
            "name": "platformId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Platform deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/platforms/stripe/public-key": {
      "get": {
        "tags": [
          "Platforms"
        ],
        "summary": "Get Stripe public key",
        "description": "Retrieve Stripe public key for payment processing",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Stripe public key retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "publicKey": {
                              "type": "string",
                              "description": "Stripe public key"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get orders",
        "description": "Retrieve orders associated with your account with filtering and pagination",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "platformId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "ownerId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "PROCESSING",
                "SHIPPED",
                "DELIVERED",
                "CANCELED"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Orders retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Order"
                          }
                        },
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Draft order",
        "description": "Create a draft order to estimate costs before processing",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "platformId",
                  "customer",
                  "items"
                ],
                "properties": {
                  "platformId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "ownerId": {
                    "type": "string",
                    "description": "Your application's user ID"
                  },
                  "customer": {
                    "type": "object",
                    "required": [
                      "details"
                    ],
                    "properties": {
                      "details": {
                        "type": "object",
                        "required": [
                          "email",
                          "address"
                        ],
                        "properties": {
                          "email": {
                            "type": "string",
                            "format": "email"
                          },
                          "address": {
                            "$ref": "#/components/schemas/Address"
                          }
                        }
                      },
                      "publicPaymentServiceId": {
                        "type": "string",
                        "description": "Customer payment ID for direct billing"
                      }
                    }
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "PRINT",
                            "COMPONENT",
                            "STATIONERY"
                          ]
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "default": 1
                        },
                        "publicFileServiceId": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Required for PRINT items"
                        },
                        "filamentId": {
                          "type": "string",
                          "format": "uuid",
                          "description": "For PRINT items"
                        },
                        "componentId": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Required for COMPONENT items"
                        },
                        "stationeryId": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Required for STATIONERY items"
                        },
                        "imageUrl": {
                          "type": "string",
                          "format": "uri",
                          "description": "For STATIONERY items with custom image"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Draft order created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "order": {
                              "$ref": "#/components/schemas/Order"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/orders/{publicOrderId}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get order by public ID",
        "description": "Retrieve details for a specific order using its public ID",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "publicOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public order ID (SLANT_XXXXXXXXXX format)"
          }
        ],
        "responses": {
          "200": {
            "description": "Order retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "order": {
                              "$ref": "#/components/schemas/Order"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Process order",
        "description": "Process a draft order to begin production and charge payment",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "publicOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public order ID (SLANT_XXXXXXXXXX format)"
          }
        ],
        "responses": {
          "200": {
            "description": "Order processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "order": {
                              "$ref": "#/components/schemas/Order"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Orders"
        ],
        "summary": "Cancel order",
        "description": "Cancel an order if it hasn't started production",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "publicOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public order ID (SLANT_XXXXXXXXXX format)"
          }
        ],
        "responses": {
          "200": {
            "description": "Order cancelled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/orders/batch": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Get multiple orders by IDs",
        "description": "Retrieve multiple orders by their public IDs in a single request",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "public_ids"
                ],
                "properties": {
                  "public_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Array of public order IDs"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Orders retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "order": {
                                "$ref": "#/components/schemas/Order"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/orders/search": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Search orders",
        "description": "Search orders with advanced filtering",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search query"
          }
        ],
        "responses": {
          "200": {
            "description": "Search results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Order"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/components": {
      "get": {
        "tags": [
          "Components"
        ],
        "summary": "Get available components",
        "description": "Retrieve all available 3D printing components and add-ons",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Components retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Component"
                          }
                        },
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/filaments": {
      "get": {
        "tags": [
          "Filaments"
        ],
        "summary": "Get available filaments",
        "description": "Retrieve all available filament materials and colors",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Filaments retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Filament"
                          }
                        },
                        "count": {
                          "type": "integer"
                        },
                        "lastUpdated": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/stationery": {
      "get": {
        "tags": [
          "Stationery"
        ],
        "summary": "Get available stationery",
        "description": "Retrieve all available stationery options",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Stationery retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Stationery"
                          }
                        },
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Get comprehensive usage statistics",
        "description": "Get detailed usage statistics across all your API keys and platforms",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usage statistics retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/apiKey": {
      "get": {
        "tags": [
          "API Keys"
        ],
        "summary": "Get user API keys",
        "description": "Retrieve all API keys for your account",
        "security": [
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "API keys retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "API Keys"
        ],
        "summary": "Create API key",
        "description": "Generate a new API key for programmatic access",
        "security": [
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Human-readable name for the API key"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "API key created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/files/openScad": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Convert OpenSCAD code to STL",
        "description": "Generate an STL file from OpenSCAD code. Returns the STL file as a binary download.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "scadCode"
                ],
                "properties": {
                  "scadCode": {
                    "type": "string",
                    "description": "OpenSCAD code to convert to STL"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "STL file generated successfully",
            "content": {
              "application/sla": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "description": "STL file binary data"
                }
              }
            }
          }
        }
      }
    },
    "/files/{publicFileId}/estimate": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Estimate print cost for a file",
        "description": "Get a price estimate for printing a file. Optionally specify a filament ID, otherwise defaults to PLA Black.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "publicFileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Public file service ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "options"
                ],
                "properties": {
                  "options": {
                    "type": "object",
                    "properties": {
                      "filamentId": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Filament ID for the estimate. Defaults to PLA Black if not provided."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Print cost estimated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number",
                              "description": "Total estimated print cost in USD"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Files",
      "description": "STL file upload, management, processing, and analysis. Core functionality for 3D printing workflow."
    },
    {
      "name": "Platforms",
      "description": "Platform management for organizing projects and configuring webhooks"
    },
    {
      "name": "Orders",
      "description": "3D printing order creation, management, and status tracking. Draft \u2192 Process workflow."
    },
    {
      "name": "Components",
      "description": "Available 3D printing components, add-ons, and finishing services"
    },
    {
      "name": "Filaments",
      "description": "Available filament materials, colors, and properties"
    },
    {
      "name": "Stationery",
      "description": "Packaging inclusions and custom cards"
    },
    {
      "name": "API Keys",
      "description": "API key management and usage tracking"
    },
    {
      "name": "Usage",
      "description": "Usage statistics and analytics"
    }
  ]
}