How to get recording id of a new session

I want to implement a feature that tells the recording to stop at X minutes in my app.

The REST documentation has this endpoint:

POST `/openvidu/api/recordings/stop/<RECORDING_ID>

However, i don’t know how to get the recording id from the session? I had a look at the return data from the REST call to start the session but it doesn’t return the recording id.

So the idea is, that anyone in the app can live stream, but i want to limit the max length of a recording to 30 minutes for storage preservation.

I initially thought the setting: OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT would do it but after reading it a little more this only happens if the session is not active at the time during the value set here, but i want to make a custom api call to force the recording to stop.

You can get the recording id in the response of start recording endpoint

It will return a recording object REST API - OpenVidu Docs

If you are using recordingMode=ALWAYS (so you don’t need to call the start recording operation), just get the recordings (REST API - OpenVidu Docs) and filter the correct one with property sessionId and status=started. That will give you the currently active Recording of the desired session.