JSON Feeds
Get easy access to Instagram feeds. Do what you want with them. No server-side code required.
How it works
Connect an Instagram account through our dashboard, create a feed, and we give you Instagram posts at a unique URL. Like this:
Pop that into your browser or Postman.
We handle API keys, usage limits, and creating and refreshing access tokens. We also offer multiple image sizes served from our CDN alongside useful image metadata like dimensions and prominant colors.
Creating a feed
- First, connect an Instagram account. Use a basic source to pull posts from a single Instagram account. If you want to show a feed of public hashtag posts, connect using an advanced source.
- Click + Add Feed in the Behold dashboard. Choose JSON, and pick a name for your feed. You can change this later.
- Click Create feed, and you’re all set! Click on your new feed to access your feed URL, settings and a preview of the response.
Feed settings
Number of Posts
The number of Instagram posts to fetch. This is capped based on your plan. Free plans can fetch up to 6 posts.
Allowed post types
This setting lets you choose which post types to include in your feed, from among images, videos , reels and albums.
Caption must include
Only posts that contain at least one of the text snippets you add here will be included in your feed. This is case-sensitive and can include spaces.
Caption may not include
Only posts that do not contain any of the text snippets you add here will be included in your feed. This is case-sensitive and can include spaces.
Hashtag feeds can take a few minutes to preload when combined with this setting.
Tip
Since #hashtags and @mentions are part of the post caption, the caption include/exclude settings can be used to limit your feed to posts that contain or do not contain specific hashtags or mentions.
Domain whitelist
This option blocks feed requests that do not originate from one of the whitelisted domains. If you leave this blank, all requests are allowed.
Subdomains are independent and wildcards are not supported. So example.com and www.example.com must be entered separately. The protocol (e.g. https://) is ignored.
localhost is always whitelisted.
Note
The whitelist provides a layer of defense against people just copy/pasting your feed, but there are ways around it. Because no API keys or secrets are exposed, this isn’t a serious security risk, however.
Response format
GET requests to a valid feed URL will return a JSON object containing some metadata, alongside a posts field. Like so:
The posts property contains an array of post objects:
Posts contain the following fields:
id string
The unique id of this Instagram post
timestamp string
The date the post was published in ISO 8601 format.
permalink string
The URL of the post on Instagram
mediaType enum
Can be IMAGE, VIDEO, or CAROUSEL_ALBUM
isReel boolean
Only included in video posts. true for reels. false for regular videos
mediaUrl string
The original image or video source, straight from Instagram.
This image is usually very large and poorly optimized. For this reason the images in the sizes property are generally the correct choice for use in production.
For VIDEO posts, mediaUrl is where you will find the video source.
thumbnailUrl string
The original thumbnail image from Instagram. Only included in VIDEO posts. The images in sizes are generally a better option.
sizes object
This field contains four image size objects: small, medium, large and full. Each size has three fields: height,width and, mediaUrl. For video posts, the images in sizes are either drawn from the thumbnail or extracted from the first frame of the video if no thumbnail is available.
These images have been optimized, converted to webp format, and resized to the following maximum dimensions, with aspect ratio maintained:
- Small: 400px
- Medium: 700px
- Large: 1000px
- Full: 2000px
caption string
The full original post caption
prunedCaption string
The post caption with hashtags removed and trailing separators/whitespace cleaned up.
hashtags array
An array of #hashtags extracted from the post caption
mentions array
An array of @mentions extracted from the post caption
colorPalette object
A range of colors extracted from the post, in R, G, B format. Useful for showing a meaningful placeholder color while the image loads.
children array
An array of child media. Only included in CAROUSEL_ALBUM posts. Each child contains the following fields: id, mediaType, mediaUrl, sizes, and colorPalette.
Children will look something like this:
Extra advanced source fields
likeCount number
The number of likes this post has received. This is only available when using an advanced source.
commentsCount number
The number of comments on this post. This is only available when using an advanced source.
Tip
We don’t currently offer access to the text of comments, but we’re actively working on it. Let us know if you need this feature! support@behold.so
Hashtag feeds
Hashtag feeds will also include a hashtags field, with an array of hashtags that are the source of the feed. Individual posts in a hashtag feed will also have an additional hashtag field, which is the hashtag that caused the post to be included in the feed.
Where’s the alt text?
Unfortunately Instagram provides no official way of retrieving alt text at this time.
In most cases images from Instagram are purely decorative. That means that for accessibility purposes you should usually mark them up with an empty alt tag:
For more information, read the official WAI recommendations for decorative images.
Types
As a convenience we’ve published types for our JSON feeds on NPM: