{
  "openapi": "3.1.0",
  "info": {
    "title": "Melt3D Slicer API",
    "description": "Send an STL model and print settings, get G-code back.\n\nEvery answer is printable G-code, billed per slice through Stripe, conical slices at a price of their own. A new account starts with free credit. Create keys at https://auth.melt3d.eu/developers.\n\nWithin version 1, changes only add: new optional parameters, headers or error codes. Ignore what you do not know.",
    "termsOfService": "https://melt3d.eu/api/terms",
    "contact": {
      "url": "https://melt3d.eu/api"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://melt3d.eu/api/terms"
    },
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.melt3d.eu"
    }
  ],
  "paths": {
    "/v1/slices": {
      "post": {
        "tags": [
          "Slices"
        ],
        "summary": "Slice a model",
        "description": "Billed once when it answers with G-code. A request refused, turned away or failed is free.\n\nLimits per key: 4 slices at once, 120 requests a minute, and a slice waits up to 60 seconds for a free server slot.\n\nA slice that would answer after 95 seconds in all, waiting for a server slot included, is stopped and answered 504, unbilled, before the proxy in front of the servers would cut it off (524 at 100 seconds). Slice very large or detailed models in parts, or retry later.",
        "operationId": "createSlice",
        "parameters": [
          {
            "name": "engine",
            "in": "query",
            "description": "The slicing engine.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "prusaslicer",
              "enum": [
                "prusaslicer",
                "curaengine",
                "orcaslicer"
              ]
            }
          },
          {
            "name": "filename",
            "in": "query",
            "description": "The model's file name, used in the G-code's comments.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "upload.stl"
            }
          },
          {
            "name": "layer_height",
            "in": "query",
            "description": "Layer height, mm.",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 2,
              "minimum": 0.01
            }
          },
          {
            "name": "first_layer_height",
            "in": "query",
            "description": "First layer height, mm.",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 2,
              "minimum": 0.01
            }
          },
          {
            "name": "perimeters",
            "in": "query",
            "description": "Perimeter count.",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 20,
              "minimum": 0
            }
          },
          {
            "name": "infill_density",
            "in": "query",
            "description": "Infill density, %.",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 100,
              "minimum": 0
            }
          },
          {
            "name": "infill_pattern",
            "in": "query",
            "description": "The infill's pattern.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "grid",
                "gyroid",
                "honeycomb"
              ]
            }
          },
          {
            "name": "nozzle_temp",
            "in": "query",
            "description": "Nozzle temperature, °C.",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 500,
              "minimum": 0
            }
          },
          {
            "name": "bed_temp",
            "in": "query",
            "description": "Bed temperature, °C.",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 200,
              "minimum": 0
            }
          },
          {
            "name": "brim_width",
            "in": "query",
            "description": "Brim width, mm.",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 50,
              "minimum": 0
            }
          },
          {
            "name": "supports",
            "in": "query",
            "description": "`bed`: supports built up from the bed only, never on the model.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "bed"
              ]
            }
          },
          {
            "name": "layers",
            "in": "query",
            "description": "The layers' shape. `planar`: flat layers. `conical`: nonplanar conical layers, which print overhangs leaning outwards (or inwards) without support; the server bends the part, slices it and maps the G-code back onto the bed.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "planar",
              "enum": [
                "planar",
                "conical"
              ]
            }
          },
          {
            "name": "cone_angle",
            "in": "query",
            "description": "With `layers=conical`: how far the layers lean from horizontal, degrees, at least 5 either way. Positive leans them outwards, for overhangs that widen upwards; negative inwards.",
            "required": false,
            "schema": {
              "type": "number",
              "default": 15.0,
              "maximum": 85,
              "minimum": -85
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Your name for this request, 1 to 255 visible ASCII characters, such as a UUID. Sending the same request again with the same key within 24 hours is billed once, so a retry after a timeout is safe.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255,
              "minLength": 1
            }
          },
          {
            "name": "Content-Encoding",
            "in": "header",
            "description": "`gzip` if the body is gzipped.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The model, an STL, up to 100 MiB once inflated: binary, or ASCII for flat layers (conical layers need binary).",
          "content": {
            "application/octet-stream": {
              "schema": {
                "$ref": "#/components/schemas/Stl"
              }
            },
            "model/stl": {
              "schema": {
                "$ref": "#/components/schemas/Stl"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The G-code.",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Requests the key may make a minute."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Requests the key may still make this minute."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Seconds until the key's minute starts over."
              },
              "X-Melt-Gcode": {
                "schema": {
                  "type": "string"
                },
                "description": "`full`: printable G-code. `mapped`: printable conical G-code, mapped back onto the bed (`layers=conical`)."
              }
            },
            "content": {
              "text/x.gcode": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Fix the request: `bad-request`, `out-of-range`, `bad-model`, `no-engine`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`signed-out`: the key is missing, wrong or revoked.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "`payment-required`: the free credit used with no payment method on file, a failed payment, or the monthly spending cap reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "`too-large`: the model is over 100 MiB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`no-output`, `engine-failed`: the model could not be sliced, often because it is outside the print volume.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate-limited`: over the key's limits. Try again after `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`busy`: no server slot came free in time. Try again after `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "`timed-out`: the slice took longer than the server allows, or would have answered after the 95 seconds the API waits. Not billed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. The same code is in the `X-Melt-Error` header.",
        "required": [
          "status"
        ],
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, in words to match: `signed-out`, `rate-limited`, … (an\n`ErrorCode`, kept a string so a code newer than the client still\nreads)."
          },
          "detail": {
            "type": "string",
            "description": "The server's message, for people."
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "The HTTP status.",
            "minimum": 0
          },
          "title": {
            "type": "string",
            "description": "The HTTP status's reason phrase."
          },
          "type": {
            "type": "string",
            "description": "Always `about:blank`."
          }
        }
      },
      "Stl": {
        "type": "string",
        "format": "binary",
        "description": "An STL, binary or ASCII (conical layers need binary): the request's\nbody."
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer m3d_live_…`."
      }
    }
  },
  "security": [
    {
      "apiKey": []
    }
  ]
}