Can you share the api call you are using to create the post with the image link?
If you rebuild the html for a post does it create the lightbox?
Also if you manually create some posts with images just like your api calls do, does it not make light boxes for some of them? Trying to figure out if this is an api issue or if the same issue exists in the UI.