You can quickly grab embed code for any toot, by choosing the Embed option from the [...] menu on the Mastodon web interface underneath the toot.

Alternatively, you can use the oEmbed API to get the same iFrame code directly. For example, the embed below could be retrieved using

curl "https://mastodon.social/api/oembed?url=https://mastodon.social/@andypiper/108237453365199182"

The HTML is in the html property in the JSON reponse.
{
  "type": "rich",
  "version": "1.0",
  "author_name": "Andy Piper",
  "author_url": "https://mastodon.social/@andypiper",
  "provider_name": "mastodon.social",
  "provider_url": "https://mastodon.social/",
  "cache_age": 86400,
  "html":"\u003ciframe src=\"https://mastodon.social/@andypiper/108237453365199182/embed\" class=\"mastodon-embed\" style=\"max-width: 100%; border: 0\" width=\"400\" allowfullscreen=\"allowfullscreen\"\u003e\u003c/iframe\u003e\u003cscript src=\"https://static-cdn.mastodon.social/embed.js\" async=\"async\"\u003e\u003c/script\u003e"
  "width": 400,
  "height": null
}
This is what that looks like when rendered.