If I understand your question correctly, you are trying to render the content of a component presentation. No OOTB APIs are available, to my knowledge. You can write a custom controller to which you need to parse the component ID and the component presentation ID to produce the output as a string.
You can take a look at the below answer by Rick for rendering a dynamic component presentation as a stringdynamic component presentation as a string.