You could, but with EU and other legislations you'd have to make it clear it's an ad, so in API-speak, there'd be a "is_sponsored=true".
That makes it too easy for API consumers to ignore. (Compared to human eyeballs browsing a webpage)
But you could make it part of the ToS: if you're using the API to present posts to users, you MUST show all the posts in the list, including the is_sponsored=true ones.