Can you get a post preview through API?

I’m trying to get a preview of each topic through the discourse API so that each topic has a small preview and then a read more…

Through the API I couldn’t find anything that could help me get the preview of a specific topic

I’m unclear if you’re referring to the API for external applications, e.g. to present these previews on another website, or the APIs available to plugins.

If it’s the former, I can’t see anything directly in the API but you would be able to get a topic, get its first post, get that post’s cooked content and then probably use some library to create an excerpt from that.

If it’s the latter, the discourse-tooltips plugin does that for its tooltips so you can take a look at that to see how it’s done. Specifically, this is where it generates excerpts for topics:

1 Like

but if it is in a list of posts how would you get each post individually?