But I’m talking about WordPress REST API, not Yoast. Yoast isn’t doing its thing when a post is being published in a different way than manually on the website. And from what I remember this worked a few months ago for XML-RPC so it seems like a bug in the newer version.
I’ve checked the database and Yoast is creating a row with information about the post, but the og:image information are missing.