How to upload gcode to Karmen with curl


Thank you for all the awesome features you introduced lately. I benefit greatly from the queue and automation functionality. Currently, I’m trying to take the automation mindset even further in my workflow (and laziness), so I slice everything with my default profile using PrusaSlicer CLI, but it doesn’t support uploading gcodes to the “physical printer Karmen” from the CLI. I thought I would just use the same query I would use with the Octoprint API because my understanding is that Karmen implements that. Unfortunately, I wasn’t successful.

I tried:

curl -vvv -k -H "X-Api-Key: [Settings > API tokens]" -F "select=false" -F "print=false" -F file="@test.gcode" "[the id here]/"

But I got:

*   Trying
* Connected to ( port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject:
*  start date: Nov 12 11:59:11 2023 GMT
*  expire date: Feb 10 11:59:10 2024 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
> POST /api/2/groups/REDACTED/ HTTP/1.1
> Host:
> User-Agent: curl/7.79.1
> Accept: */*
> Content-Length: 923512
> Content-Type: multipart/form-data; boundary=------------------------03d388272a8c4e34
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Server: nginx/1.14.2
< Date: Thu, 14 Dec 2023 13:00:42 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 179
< Connection: keep-alive
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< Referrer-Policy: same-origin
< Cross-Origin-Opener-Policy: same-origin
< Vary: origin

<!doctype html>
<html lang="en">
  <title>Not Found</title>
  <h1>Not Found</h1><p>The requested resource was not found on this server.</p>
* Connection #0 to host left intact

What am I doing wrong? Would you mind sharing a working curl example with me, please?

A :raising_hand_man:

Hello Adam,

Good question. It took me a while to realize that the slicer is adding a path to the URL next to the one provided in PrusaSlicer settings. The correct URL to POST your request is:

Anyway, it looks like the rest is fine.

Let me know whether it works for you.

By the way, we also have API key scopes that are to be used to call our REST API. Unfortunately, our REST API doesn’t have public documentation yet. If you would be interested in calling other APIs as well, just let me know.


Hello Adam, I am currently using Orcaslicer and upload the finished sliced models directly to the printer. I uploaded the two test cubes manually via Karmen. I can take a look at the whole thing sometime. But there isn’t that much time at the moment


I confirm it works! Just adding the Octoprint endpoint path after the Karmen upload URL works.

Thank you so much for the swift response and the magnificent support you provide here! It helped me to get the job done while at it.


Great, happy to hear that! :+1: