Skip to main content

Create Post

POST 

/instagram/page/createPost

This endpoint allows you to create a post on your Instagram page.

  • Here you have one endpoint for all media types.
  • All media must be public HTTPS URLs (Meta will try to download them), maximum of 8 MB for an image.
  • Images must be JPEG only (Meta's rule). An image in another format (for example PNG or WebP) can be rejected with reason 15.

Settings:

SettingValue
URLhttps://api.99digital.co.il/instagram/page/createPost
MethodJSON via POST
HeaderYour API key for the service (the apiKey header)

Body:

ParameterDescription / ExampleMandatoryExample
fromThe ID you received for the connectionyes463745743546345
mediaTypeCan be any of the following: image - for creating a post with only an image. reel - for creating a reel. video - for creating a video (Instagram publishes every single video as a reel, so it is the same as reel, and the response's mediaType is reel). story - for creating a story. carousel - for creating carousel images/videos. If you leave it out, it is taken from "links": two links or more make a carousel, one video link (mp4/mov/webm/avi) a reel, and any other link an image. A story is created only when you set mediaType to storynoimage
linksArray of public HTTPS links, depending on the "mediaType" you provided. image - provide 1 link only (JPEG). reel - provide 1 video link only (mp4/mov/webm/avi), up to 90 seconds. video - provide 1 video link only (mp4/mov/webm/avi). story - 1 link of either an image or a video (a story lives 24 hours). carousel - minimum 2 links, maximum 10. An image and video combination is possibleyes["https://example.com/image.jpg","https://example.com/image2.jpg"]
captionA string text that comes with the image/reel/video/carousel. Up to 2,200 characters, up to 30 #hashtags, up to 20 @mentions. No Markdown, no HTML. Does not work for the 'story' mediaTypenoHere is my video title
shareToFeedint. Relevant for reels only. 1 - show in the main feed grid. 0 - show in the Reels tab onlyno1
altTextA text that describes the image, for people who use screen readers. Relevant for the 'image' mediaType only. Up to 1,000 charactersnoA bouquet of red roses on a wooden table
coverUrlA public HTTPS link to an image for the reel's cover. Relevant for reels onlynohttps://example.com/cover.jpg

Response:

{
"status": "OK",
"mediaType": "image",
"caption": "your message",
"timestamp": 1600115719,
"from": "463745743546345",
"mediaId": "52342352345",
"url": "https://example.com/image.jpg",
"reason": 1
}

Response-Explain:

ParameterDescription
statusOK or FAIL
mediaTypeThe mediaType you chose (or the one taken from "links"; video comes back as reel)
captionThe caption text you provided (left out when you sent none, and for a story)
timestampTime stamp of the message
fromYour ID for the service
urlFor a single URL mediaType, this will show the URL provided
itemsTotal items provided (relevant for the carousel mediaType, instead of url)
mediaIdThe published media ID. This is relevant for Toggle Comments (toggleComments), Delete Post (deletePost), Create Comment (createComment), sendMediaShare and All Comments (getComments)

reason:

ValueInformation
1Not FAIL. The status is OK
2Your "from" account does not exist (for example, its onboarding is not finished yet) or is missing, or JSON syntax error
3Wrong apiKey (the apiKey header is missing or wrong)
5Missing or invalid content: 'links' is missing or empty, or one of the links (or 'coverUrl') is not https://
6Wrong connection type. Your keys/ID are correct, but you are using the wrong endpoint (for example: your onboarding was for Facebook Messenger, but you are using this Instagram endpoint)
7The connection is not active (it was disabled)
8Wrong mediaType, the wrong number of links for the mediaType, a caption longer than 2,200 characters, or an 'altText' longer than 1,000 characters
10You must do the onboarding again, the connection has expired
11A permission is missing: the connection does not have Meta's permission for this action
12Rate limit error. Too many requests. Please wait a few minutes and try again
15The content you posted was rejected by Meta, or bad media / format / size (for example, an image that is not JPEG, or a video Meta could not process). It could also indicate a policy violation inside the content. Don't retry the same file
16You reached Instagram's daily publishing limit (100 posts in 24 hours). Try again later
17Meta is still processing the video. Nothing was published: send the same request again in a minute
18General error / wrong information / unknown error. Please check all the payload again and try again

Remarks:

  • In a story or a carousel, a link that ends with .mp4, .mov, .webm or .avi is published as a video, and any other link as an image.
  • The response comes once the post is published. A video is processed by Meta first, so a reel, a video story or a carousel with videos can take a minute or more: set your HTTP timeout accordingly. If Meta is still processing the video after about 90 seconds, you get reason 17: nothing was published, so send the same request again in a minute.
  • Every post you publish here is also announced right away to your webhook, as an Instagram Post event with the same mediaId (Instagram itself sends no notification for new posts). Set your webhook URL with Set Webhook.

Request​

Responses​

The request was processed. Both a successful and a failed request answer with HTTP 200 — check status, and reason when it is FAIL.