You can query the Threads oEmbed endpoint to get a public Threads post's embed HTML and basic metadata in order to display the post in another website or app. Text, image, video, and carousel posts are supported.
This guide assumes you are a registered Meta developer and have created a Meta app with the Threads use case.
You will need the following:
Rate limits are dependent on the type of access token your app includes in each request.
Apps that rely on app access tokens can make up to 5 million requests per 24 hours.
You can get the embed HTML programmatically via the API or from threads.net by clicking on a post's share icon and selecting the Get embed code button.
To get a Threads post's embed HTML using the API, send a request to the /oembed
endpoint:
GET /oembed?url=<URL_OF_THE_POST>&access_token=<ACCESS_TOKEN>
URL_OF_THE_POST
— The permalink of the Threads post that you want to query.ACCESS_TOKEN
— Your app access token. You can also pass it in an Authorization HTTP header, e.g., Authorization: Bearer <ACCESS_TOKEN>
.Upon success, the API will respond with a JSON object containing the post's embed HTML and additional data. The embed HTML will be in the returned html
property.
Refer to the Threads oEmbed reference for a list of query string parameters you can include to augment the request.
With an access token:
curl -X GET \ "https://graph.threads.net/v1.0/oembed?url=<URL_OF_THE_POST>&access_token=<ACCESS_TOKEN>"
With an Authorization HTTP header:
curl -i -X GET \ --header "Authorization: Bearer 96481..." \ "https://graph.threads.net/v1.0/oembed?url=<URL_OF_THE_POST>"
Default fields that are returned:
{ "version": "1.0", "provider_name": "Threads", "provider_url": "https://www.threads.net/", "type": "rich", "width": 658, "html": "<blockquote class=\"text-post-media\" data-text-post-perma...", }
The url
query string parameter accepts the following URL format:
https://www.threads.net/@{username}/post/{media-shortcode}/
The embed HTML contains a reference to the Threads embed.js JavaScript library. When the library loads, it scans the page for the post HTML and generates the fully rendered post.
The embedded post is responsive and will adapt to the size of its container. This means that the height will vary depending on the container width and the length of the post content. You can set the maximum width by including the maxwidth
query string parameter in your request.
When you submit your app for review, in the Please provide a URL where we can test Oembed Read form field, use the Threads oEmbed endpoint to get the embed HTML for any public post on our official Threads profile. Then, add the returned embed HTML to where you will be displaying oEmbed content and enter that page's URL in the form field.
Once you have been approved for the Threads oEmbed Read feature, you may embed your own posts using their respective URLs.