LinkedIn has a /share API endpoint which accepts a link and a message. The link is afterwards expanded to an OpenGraph card and that gives you a way to stick an image preview in there, but it seems there's no other way to upload an image/picture to LinkedIn feed like you can do in the web app itself.
Is there a way, private API, undocumented endpoint or some other way to do that?
No. You need to give us the URL and we'll scrape it (or pull it from our cache).
Creating a rich media share is done in two steps. First, the media is uploaded to LinkedIn's media platform. Then, a personal or organization share referencing that media is created.
This URL might be help you. https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload