---
description: For generating OEmbed previews.
---

# oembed

## OEmbed as JSON

<mark style="color:blue;">`GET`</mark> `https://mastodon.example/api/oembed`

**Returns:** OEmbed metadata\
**OAuth:** Public\
**Version history:**\
1.0.0 - added

#### Query Parameters

| Name      | Type   | Description                            |
| --------- | ------ | -------------------------------------- |
| url       | string | URL of a status                        |
| maxwidth  | number | width of the iframe. Defaults to 400   |
| maxheight | number | height of the iframe. Defaults to null |

{% tabs %}
{% tab title="200 Represents OEmbed "rich" preview, with associated iframe and metadata." %}
```javascript
{
  "type": "rich",
  "version": "1.0",
  "title": "New status by trwnh",
  "author_name": "infinite love ⴳ",
  "author_url": "https://mastodon.social/@trwnh",
  "provider_name": "mastodon.social",
  "provider_url": "https://mastodon.social/",
  "cache_age": 86400,
  "html": "<iframe src=\"https://mastodon.social/@trwnh/99664077509711321/embed\" class=\"mastodon-embed\" style=\"max-width: 100%; border: 0\" width=\"400\" allowfullscreen=\"allowfullscreen\"></iframe><script src=\"https://mastodon.social/embed.js\" async=\"async\"></script>",
  "width": 400,
  "height": null
}
```
{% endtab %}

{% tab title="404 Status not found" %}
```javascript
{
  "error": "Record not found"
}
```
{% endtab %}
{% endtabs %}
