REST API – access to full Galvo cut/sub-layer settings (Q-Pulse, interval, scan angle, etc.)?

Hi Jon,

A quick update on my testing of the LightBurn REST API.

I’m pleased to report that the API is now providing the core settings information I need.

I’ve successfully tested:

/api/project — device information, project details, units and workspace configuration.

/api/layers — layer information, visibility, output state and shape counts.

/api/cuts — detailed cut settings, including individual sublayers and their separate parameters.

/api/material_library — successfully retrieving and storing the response.

My detailed testing so far has been with a UV galvo laser using the JCZFiber controller. I still need to complete real-job timing tests and broader compatibility testing, but I haven’t identified any outstanding gaps in the core settings information needed for this application.

Thanks for the work that’s gone into the API and for the additions that have made this possible. It’s now at the point where I can concentrate on building the analysis and comparison functionality rather than trying to obtain the underlying data.

Really love seeing all the API progress. Guess it’s time to buy my update license so I can start playing with the new API.. should give me better control for my auto-focus/dynamic-z system. Currently I do repeated status checks to see when the laser is ready to tell when the job ended, is there a better way now to check the laser status on the new api?

Cheers all. I am learning the REST API. So far have Prusa Slicer for images to operations mapped to layers to tool and or multiple spindles CNC and laser. Fully integrated true 3D visualizer with Nintendo switch game controller, bed calibration, z axis tests, stalled job recovery, full 3D Jumpstart 3D tool that drops STL to MM workspace, GIT Vault for revision tracking of project. Still debugging of course and running into wall, but learning a lot. Thanks to all that contributed it will be fun to see what else we can figure out. Thanks Lightburn for very Cool we tool interface.

Is the start/stop/pause action exposed in the new API or is that still just start stop through UDP? I see that the status is exposed, sending the start stop and pause commands to the laser would be great too.

At this point, no, expressly not. We expect people using LLMs with it to some extent… And we have concerns about an AI running your laser :sweat_smile:

LOL! No problem, I’ll continue to use UDP and/or keyboard emulation to accomplish it.

Hi Jon,

Can you confirm whether the SSE stream supports an event for changes to the currently selected device in LightBurn?

For example, if I switch from one laser device profile to another within LightBurn, is there an SSE event my app can listen for so it can immediately update the displayed device name?

I’d prefer to handle this through an event rather than periodically polling the API.

Thanks!

Hi Jon,

2x things - firstly I found the currently selected device is reflected in the SSE stream so nothing amiss there, and no action require. But I have found a fairly major oversight (unless I’m missing something).

I’m testing with LightBurn Pro 2.2.00 and a JCZFiber-controlled 5W UV galvo laser.

I’ve encountered an issue with the /api/events SSE stream: Framing and actual marking operations both appear to generate job events with state: "running".

This makes it impossible for my application to reliably determine whether the laser is framing or executing an actual job.

Tests performed

1. Framing only

With the Framing window open, the SSE stream reports:

event: job | data: {"progress":97.8,"state":"running"}
event: job | data: {"progress":99.2,"state":"running"}
event: job | data: {"progress":99.5,"state":"running"}
event: job | data: {"state":"idle"}

No engraving was performed, but my application interpreted this as a job.

2. Actual engraving without framing

I disabled LightBurn’s “Require Framing Before Start” option and ran a real engraving job lasting approximately 14 seconds.

The SSE stream reported:

[13:38:51.897] event: job | data: {"progress":100,"state":"running"}
[13:39:06.497] event: job | data: {"state":"idle"}

The event interval was approximately 14.6 seconds, matching the actual job duration.

3. Framing followed by engraving

With framing active before the engraving operation, the stream continued reporting running events without a reliable idle transition between the operations.

Requested enhancement

Could the REST API expose the type of operation currently running?

For example:

{"state":"running","operation":"framing"}

versus:

{"state":"running","operation":"marking"}

Alternatively, separate SSE events for framing start/stop and marking start/stop would work equally well.

Ideally, the events would also include timestamps corresponding to the actual operation start and completion, rather than just the time the API notification was generated or received.

Why this matters

My application needs to measure total elapsed marking job time, from the start of the actual operation until completion, including galvo movements between shapes.

It does not need to measure individual laser firing pulses.

Framing time must be excluded completely, and timing must be fully automatic without any manual interaction with the companion application.

The existing state and progress fields don’t appear sufficient to make this distinction, as both framing and engraving can report progress values close to or equal to 100%.

Is there already an API property or event that identifies these operations separately? If not, would it be possible to add this to a future release?

Thanks!

@goeland86 - Thoughts? Have I overlooked an SSE stream event I can reference, or if not do you think this adjustment would be doable (and if so when would the next RC release be scheduled for?)

Hi @ihockings

Sorry I missed your request earlier. This is actually a completely valid request for improvement.

Can I ask you to post it on the LightBurn-REST GitHub issues directly? It will make tracking requests & bugs easier.

The issue you’re running into is because I was mostly concerned about whether the machine was moving and I wasn’t paying attention to whether it was a proper Start action, or a Frame action that triggered it.

I don’t think you missed anything - the docs are pretty complete with what the API currently does.
Feature/patch requests like this are absolutely welcome, especially when you explain where the confusion leads to problems on your end.

We’re here to try and make peoples’ lives easier :slight_smile:

Jon

@goeland86 sure no problem. Happy to post it there (didn’t know there was a separate post for those things but it makes sense to get them all in the one spot for you to work through). I’ll do that now.

I’m all for discussing things back and forth, and sharing knowledge in multiple places. But for developers (and their LLM-powered tooling), having the requests & changes tracked on GitHub makes the most sense in my opinion :slight_smile:

It also simplifies tracking overall since the “official” requests are then trackable in one place.

Thanks!

I think the SSE feed is the better way to go for passively receiving notice of the status change:

  1. Pair with the state capability.
  2. Open GET /api/events before starting the job, so you don’t miss the change to running.
  3. Treat a change from running or paused to idle as the end of the job.
  4. Don’t use connected for this. On some controllers it switches on and off around ordinary activity, so it isn’t a busy or done signal (mostly DSPs like Ruida).
  5. If the stream drops, call GET /api/events/poll once after reconnecting to get the current state. Then you’ll still notice a job that finished while they were disconnected.

Note: as noted by @ihockings just above, there’s a gap in tracking frame vs laser-on jobs at the moment, and I’ll be addressing that in the patch release, at the same time as the galvo Device Settings->Extensions tab bug. I’ll make sure to point the release notes to the documentation PR to help you guys keep track of what’s changed in the API.

I’m still trying to catch up through all the questions we’ve had about the API. It’s awesome to see so much engagement, I’m just a little overwhelmed by all of it coming at once on multiple channels :slight_smile: