Upload a G-code file to OctoPrint and select or print it via the Files API
domain: docs.octoprint.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
POST multipart/form-data to /api/files/{location} (location is local or sdcard) with a file field and a Content-Length header to upload a .gcode or .stl file.
Set the select=true and print=true form fields to auto-select and immediately start printing right after upload.
Alternatively, POST /api/files/{location}/{path} with {"command": "select", "print": true} to select an already-uploaded file.
Use {"command": "copy"} or {"command": "move", "destination": "<folder>"} to reorganize files within the same location.
GET /api/files/{location}/{filename} to confirm the resulting file metadata.
Known gotchas
A 415 Unsupported Media Type is returned if the uploaded file is anything other than .gcode or .stl (and .stl additionally requires slicing support to be enabled).
Uploads targeting sdcard are also stored locally first, and SD-card file-list cache refreshes are disabled during printing due to serial bandwidth limits.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?