How to use bambulab api?

I’m trying to connect to the Bambulab API (https://api.bambulab.com) in my program, specifically these two endpoints for logging print status:

  • /v1/iot-service/api/user/bind
  • /v1/iot-service/api/user/print

But when I run my code locally, I keep getting blocked by CORS policy. I can connect through the browser console when I’m on the API page, but after the first request, I get a 403 (Forbidden) error. How do I use the API properly?

CORS is a pain to deal with, especially when you use a language like javascript that uses the browser to do the requests (which enforces CORS).

I would look at what Bambu Studio/Orca Slicer/the App does. You could look at the web traffic (assuming none of them use cert pinning, then you will have more work to do) or you could take a look at their source code, which you can find here:

Another thing that can help is to search in all of GitHub for specific endpoints, for example Code search results · GitHub which yields a few resources that might help.

1 Like

Moved the processing off the browser, that revolved the CORS issue, but i’m still getting 403 (Forbidden)
I looked through the github codes, tested them, but still 403

Did you ask ChatGPT if it knew a sollution? Many coders use ChatGPT to work out coding problems and it seems to work very well.

1 Like

looked through more examples, and fed a lot of it thru GPT
Worked out what i needed, it’s so convoluted, would have appreciated if Bambu had proper documentation.

1 Like

You likely need authentication if you havent implemented that yet