Getting gcode stream from API

I'm looking through the OctoPrint API docs and I can't seem to find an endpoint for the stream in the "Terminal" tab. How do I programmatically get access to this stream? Is there some sort of e.g. websocket endpoint?

There is indeed a websocket. Documentation is here:
https://docs.octoprint.org/en/master/api/push.html

Oh awesome this is exactly what I needed. Thanks!