<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/facebook-api/instagram-pages/create-post

# Create Post

`POST https://api.99digital.co.il/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**:

```json
{
  "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](https://docs.99digital.co.il/facebook-api/instagram-pages/toggle-comments) (toggleComments), [Delete Post](https://docs.99digital.co.il/facebook-api/instagram-pages/delete-post) (deletePost), [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/create-comment) (createComment), sendMediaShare and [All Comments](https://docs.99digital.co.il/facebook-api/instagram-pages/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`, `.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](https://docs.99digital.co.il/facebook-api/webhooks/instagram-post) event with
  the same `mediaId` (Instagram itself sends no notification for new
  posts). Set your webhook URL with
  [Set Webhook](https://docs.99digital.co.il/facebook-api/webhooks/set-webhook).

## Authentication

`apiKey` in the header — Your API key for the service.

## Request body

Content type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | Yes | The ID you received for the connection. Example: `463745743546345`. |
| `mediaType` | string | No | The kind of post. Can be any of the following: `image`, `reel`, `video`, `story` or `carousel`. 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`. One of: `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 (a story lives 24 hours); `carousel` — For creating carousel images/videos (2 to 10 items). Example: `image`. |
| `links` | array of string | Yes | Array of public HTTPS links (Meta will try to download them), depending on the `mediaType` you provided: - `image` — 1 link only (JPEG). - `reel` — 1 video link only (mp4/mov/webm/avi), up to 90 seconds. - `video` — 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. Images must be JPEG, maximum of 8 MB. Min items: 1. Max items: 10. |
| `caption` | string | No | A string text that comes with the image / reel / video / carousel. Up to 2,200 characters, up to 30 #hashtags and up to 20 @mentions. No Markdown, no HTML. Does not work for the `story` mediaType. Max length: 2200. Example: `Here is my video title`. |
| `shareToFeed` | integer | No | Int. Relevant for reels only. One of: `0` — Show in the Reels tab only; `1` — Show in the main feed grid (as well as in the Reels tab). Example: `1`. |
| `altText` | string | No | A text that describes the image, for people who use screen readers. Relevant for the `image` mediaType only. Up to 1,000 characters. Max length: 1000. Example: `A bouquet of red roses on a wooden table`. |
| `coverUrl` | string | No | A public HTTPS link to an image for the reel's cover. Relevant for reels only. Example: `https://example.com/cover.jpg`. |

### Example: Image

A post with one JPEG image, a caption and an `altText`.

```json
{
  "from": "463745743546345",
  "mediaType": "image",
  "links": [
    "https://example.com/image.jpg"
  ],
  "caption": "Our new collection is here",
  "altText": "A bouquet of red roses on a wooden table"
}
```

### Example: Reel

A reel from one video link, with a cover image, shown in the main feed grid as well.

```json
{
  "from": "463745743546345",
  "mediaType": "reel",
  "links": [
    "https://example.com/video.mp4"
  ],
  "caption": "Here is my video title",
  "coverUrl": "https://example.com/cover.jpg",
  "shareToFeed": 1
}
```

### Example: Video

A video — Instagram publishes it as a reel, exactly like `reel`.

```json
{
  "from": "463745743546345",
  "mediaType": "video",
  "links": [
    "https://example.com/video.mp4"
  ],
  "caption": "Here is my video title"
}
```

### Example: Story

A story from one image or video link. It lives 24 hours, without a caption.

```json
{
  "from": "463745743546345",
  "mediaType": "story",
  "links": [
    "https://example.com/story.jpg"
  ]
}
```

### Example: Carousel

A carousel of 2 to 10 links — here two images and a video.

```json
{
  "from": "463745743546345",
  "mediaType": "carousel",
  "links": [
    "https://example.com/image.jpg",
    "https://example.com/image2.jpg",
    "https://example.com/video.mp4"
  ],
  "caption": "Swipe to see the whole collection"
}
```

## 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.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `status` | string | (one of: OK) OK or FAIL. `OK` — the post was published. Always `OK`. |
| `from` | string | (one of: OK) Your ID for the service. Example: `463745743546345`. |
| `timestamp` | integer | (one of: OK) Time stamp of the message (Unix time, in seconds). Example: `1600115719`. |
| `mediaType` | string | (one of: OK) The mediaType you chose, or the one taken from `links`. `video` comes back as `reel`. One of: `image` — A post with only an image; `reel` — A reel (also for `video`); `story` — A story; `carousel` — A carousel of images/videos. |
| `url` | string | (one of: OK) For a single URL mediaType (`image`, `reel`, `video`, `story`), this will show the URL provided. Not in a carousel's response. Example: `https://example.com/image.jpg`. |
| `items` | integer | (one of: OK) Total items provided (relevant for the `carousel` mediaType) — in a carousel's response only, instead of `url`. Example: `3`. |
| `caption` | string | (one of: OK) The caption text you provided. Left out when you sent none, and for a story (stories publish no caption). |
| `mediaId` | string | (one of: OK) The published media ID. This is relevant for toggleComments, deletePost, createComment, sendMediaShare and getComments. Example: `17895695668004550`. |
| `reason` | integer | (one of: OK) 1 — not FAIL, the status is OK. Always `1`. |
| `status` | string | (one of: FAIL) FAIL — the request was not carried out. `reason` says why. Always `FAIL`. |
| `reason` | integer | (one of: FAIL) The status explanation in case of FAIL. One of: `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. |
| `from` | string | (one of: FAIL) Your ID for the service. Included only when Meta rejected the request (reasons 10 and up). Example: `463745743546345`. |

#### Example: OK

The image was published.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "timestamp": 1600115719,
  "reason": 1,
  "mediaType": "image",
  "url": "https://example.com/image.jpg",
  "mediaId": "17895695668004550",
  "caption": "Our new collection is here"
}
```

#### Example: OK — carousel

A carousel's response has `items` (the number of links) instead of `url`.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "timestamp": 1600115719,
  "reason": 1,
  "mediaType": "carousel",
  "items": 3,
  "mediaId": "17895695668004551",
  "caption": "Swipe to see the whole collection"
}
```

#### Example: Reason 5

'links' is missing or empty, or a link is not https://.

```json
{
  "status": "FAIL",
  "reason": 5
}
```

#### Example: Reason 8

Wrong mediaType, the wrong number of links, or a caption that is too long.

```json
{
  "status": "FAIL",
  "reason": 8
}
```

#### Example: Reason 15

Meta rejected the media — for example, an image that is not JPEG.

```json
{
  "status": "FAIL",
  "reason": 15,
  "from": "463745743546345"
}
```

#### Example: Reason 16

The daily publishing limit (100 posts in 24 hours) is reached.

```json
{
  "status": "FAIL",
  "reason": 16,
  "from": "463745743546345"
}
```

#### Example: Reason 17

The video is still processing at Meta. Nothing was published; send the request again in a minute.

```json
{
  "status": "FAIL",
  "reason": 17,
  "from": "463745743546345"
}
```
