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:
| Setting | Value |
|---|---|
| URL | https://api.99digital.co.il/instagram/page/createPost |
| Method | JSON via POST |
| Header | Your API key for the service (the apiKey header) |
Body:
| Parameter | Description / Example | Mandatory | Example |
|---|---|---|---|
| from | The ID you received for the connection | yes | 463745743546345 |
| mediaType | Can 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 story | no | image |
| links | Array 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 possible | yes | ["https://example.com/image.jpg","https://example.com/image2.jpg"] |
| caption | A 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' mediaType | no | Here is my video title |
| shareToFeed | int. Relevant for reels only. 1 - show in the main feed grid. 0 - show in the Reels tab only | no | 1 |
| altText | A text that describes the image, for people who use screen readers. Relevant for the 'image' mediaType only. Up to 1,000 characters | no | A bouquet of red roses on a wooden table |
| coverUrl | A public HTTPS link to an image for the reel's cover. Relevant for reels only | no | https://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:
| Parameter | Description |
|---|---|
| status | OK or FAIL |
| mediaType | The mediaType you chose (or the one taken from "links"; video comes back as reel) |
| caption | The caption text you provided (left out when you sent none, and for a story) |
| timestamp | Time stamp of the message |
| from | Your ID for the service |
| url | For a single URL mediaType, this will show the URL provided |
| items | Total items provided (relevant for the carousel mediaType, instead of url) |
| mediaId | The published media ID. This is relevant for Toggle Comments (toggleComments), Delete Post (deletePost), Create Comment (createComment), sendMediaShare and All Comments (getComments) |
reason:
| Value | Information |
|---|---|
| 1 | Not FAIL. The status is OK |
| 2 | Your "from" account does not exist (for example, its onboarding is not finished yet) or is missing, or JSON syntax error |
| 3 | Wrong apiKey (the apiKey header is missing or wrong) |
| 5 | Missing or invalid content: 'links' is missing or empty, or one of the links (or 'coverUrl') is not https:// |
| 6 | Wrong 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) |
| 7 | The connection is not active (it was disabled) |
| 8 | Wrong mediaType, the wrong number of links for the mediaType, a caption longer than 2,200 characters, or an 'altText' longer than 1,000 characters |
| 10 | You must do the onboarding again, the connection has expired |
| 11 | A permission is missing: the connection does not have Meta's permission for this action |
| 12 | Rate limit error. Too many requests. Please wait a few minutes and try again |
| 15 | The 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 |
| 16 | You reached Instagram's daily publishing limit (100 posts in 24 hours). Try again later |
| 17 | Meta is still processing the video. Nothing was published: send the same request again in a minute |
| 18 | General 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,.webmor.aviis 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
- 200
The request was processed. Both a successful and a failed request answer with HTTP 200 — check status, and reason when it is FAIL.