Is it possible to convert CMYK to RGB with Imaging API?

Is there any way to convert from CMYK to RGB using the Imaging API? For example, for taking a screenshot of a document that is in CMYK.

https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/imaging/#photoshopimagedata

You could duplicate the document, convertMode to RGB, getPixels, close the copy without saving.

What @Kayrock says is the easier way to do it, Photoshop handles the heavy part for you, unless the other way is to you manually remap the rgb pixels to fit the colorspace you want with a convertion forumula.