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

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

# All Posts

`POST https://api.99digital.co.il/instagram/page/getPosts`

This endpoint allows you to see all the posts in your Instagram page (posts that were created by the API or directly on Instagram).

**Settings**:

| Setting | Value |
| --- | --- |
| URL | `https://api.99digital.co.il/instagram/page/getPosts` |
| 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 |
| limit | How many posts to get (limit pagination), between 1 and 100. Default if not provided: 25 | no | 25 |
| type | Two options: **media** - all posts, reels, videos, carousels. **stories** - live stories. Default if not provided: media | no | media |
| mediaId | If you prefer to get information on one post and not all of them, here is where you put the mediaId. The response then holds that one post in "post" (not a "posts" list, and without "type", "count" and "paging"), and "type", "limit" and "after" are ignored (a "limit" that is not between 1 and 100 still returns reason 8) | no | 5634634_634634563 |
| after | If you are using limit paging, you can provide the "after" value from the previous response to load the next batch | no | U56WDF34FA4TER3DA..... |

**Response**:

```json
{
  "status": "OK",
  "from": "463745743546345",
  "type": "media",
  "count": 25,
  "posts": [{
    "id": "119324881085321_122093459712345",
    "caption": "Hello fans!",
    "media_type": "CAROUSEL_ALBUM",
    "media_product_type": "FEED",
    "media_url": "https://www.scontent.com/...",
    "permalink": "https://instagram.com/p/...",
    "created_time": 1783596120,
    "children": { "data": [
      { "id": "17998877665544332", "media_type": "IMAGE", "media_url": "https://www.scontent.com/..." },
      { "id": "17998877665544333", "media_type": "VIDEO", "media_url": "https://www.scontent.com/...", "thumbnail_url": "https://www.scontent.com/..." }
    ] },
    "like_count": 10,
    "comments_count": 3,
    "is_comment_enabled": true
  }],
  "paging": { "after": "QVFIU...", "hasNext": true },
  "reason": 1
}
```

**Response-Explain**:

| Parameter | Description |
| --- | --- |
| status | OK or FAIL |
| type | The type you asked for: media or stories |
| count | Total posts in this batch |
| from | Your ID for the service |

**posts** and **paging**:

| Value | Information |
| --- | --- |
| id | This is the postId (the mediaId of the post) |
| caption | The body of the post |
| media_type | IMAGE / VIDEO / CAROUSEL_ALBUM |
| media_product_type | FEED / REELS / STORY |
| media_url | Link to the media |
| permalink | Link directly to the post |
| thumbnail_url | Thumbnail image link (only for videos) |
| created_time | The post create time. UNIX UTC timestamp (int seconds) |
| like_count | The total likes of the post |
| comments_count | The total amount of comments this post has (int). For getting the actual comments, use the [All Comments](https://docs.99digital.co.il/facebook-api/instagram-pages/all-comments) (getComments) API endpoint |
| is_comment_enabled | true or false: whether comments are enabled on the post |
| children | List of media URLs for carousel items (media_type = CAROUSEL_ALBUM): each item in "data" has its id, media_type, media_url, and thumbnail_url for a video |
| paging | Key that contains two values: "after", which represents the parameter to send if you wish to get the next batch, and "hasNext", which is true if you have more data to load, or false if this is the last data |

**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) |
| 4 | The mediaId you sent is not a valid media ID |
| 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 | "limit" is not a number between 1 and 100, or "type" is not media or stories |
| 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 |
| 13 | The postId (mediaId) is invalid or wrong: the post was not found, or it is not accessible |
| 15 | The content you posted was rejected by Meta, or bad media / format / size, or an invalid parameter. It could also indicate a policy violation inside the content |
| 18 | General error, try again |

## Stories

For the "stories" type from the table above, only those will return in the response: `id`, `media_type`, `media_url`, `permalink` and `created_time`.

**Remarks**:

- A field without a value is left out of the post: for example `caption` on
  a post without a caption, `thumbnail_url` on anything but a video, and
  `children` on anything but a carousel.

## 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`. |
| `type` | string | No | What to list. Two options: `media` or `stories`. Default if not provided: `media`. Ignored when you send `mediaId`. One of: `media` — All posts, reels, videos and carousels; `stories` — Live stories — the stories that are live right now. Default: `media`. |
| `limit` | integer | No | How many posts to get (limit pagination), between 1 and 100. Default if not provided: 25. Default: `25`. Minimum: 1. Maximum: 100. Example: `25`. |
| `after` | string | No | If you are using limit paging, you can provide the `after` value from the previous response (`paging.after`) to load the next batch. Example: `QVFIUmF4YWJjZGVmZ2hpams`. |
| `mediaId` | string | No | If you prefer to get information on one post and not all of them, here is where you put the mediaId. The response then holds that one post in `post` (not a `posts` list, and without `type`, `count` and `paging`), and `type`, `limit` and `after` are ignored (a `limit` that is not between 1 and 100 still returns reason 8). Example: `17895695668004550`. |

### Example: All posts

The last 25 posts — images, reels, videos and carousels.

```json
{
  "from": "463745743546345",
  "type": "media",
  "limit": 25
}
```

### Example: Next batch

The next 25 posts, with the `paging.after` value of the previous response.

```json
{
  "from": "463745743546345",
  "type": "media",
  "limit": 25,
  "after": "QVFIUmF4YWJjZGVmZ2hpams"
}
```

### Example: Stories

The stories that are live right now.

```json
{
  "from": "463745743546345",
  "type": "stories"
}
```

### Example: One post

The details of one post, by its `mediaId`.

```json
{
  "from": "463745743546345",
  "mediaId": "17895695668004550"
}
```

## 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 request succeeded, and the posts of this batch are in `posts`. One of: `OK`. |
| `from` | string | (one of: OK) Your ID for the service. Example: `463745743546345`. |
| `type` | string | (one of: OK) The type you asked for — `media` or `stories`. One of: `media` — All posts, reels, videos and carousels; `stories` — Live stories. |
| `count` | integer | (one of: OK) Total posts in this batch. Example: `25`. |
| `posts` | array of object | (one of: OK) The posts of this batch. Empty when there are none. |
| `posts[].id` | string | (one of: OK) This is the postId (the mediaId of the post). Use it with [All Comments](https://docs.99digital.co.il/facebook-api/instagram-pages/all-comments), [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/create-comment), [Toggle Comments](https://docs.99digital.co.il/facebook-api/instagram-pages/toggle-comments) and [Delete Post](https://docs.99digital.co.il/facebook-api/instagram-pages/delete-post). Example: `17895695668004550`. |
| `posts[].caption` | string | (one of: OK) The body of the post. |
| `posts[].media_type` | string | (one of: OK) The kind of media — IMAGE / VIDEO / CAROUSEL_ALBUM. One of: `IMAGE` — An image; `VIDEO` — A video (a reel, or a video story); `CAROUSEL_ALBUM` — A carousel — its items are in `children`. |
| `posts[].media_product_type` | string | (one of: OK) Where the post appears — FEED / REELS / STORY. One of: `FEED` — A regular post in the feed; `REELS` — A reel; `STORY` — A story. |
| `posts[].media_url` | string | (one of: OK) Link to the media. |
| `posts[].permalink` | string | (one of: OK) Link directly to the post. |
| `posts[].thumbnail_url` | string | (one of: OK) Thumbnail image link (only for videos). |
| `posts[].created_time` | integer | (one of: OK) The post create time. UNIX UTC timestamp (int seconds). Example: `1783596120`. |
| `posts[].like_count` | integer | (one of: OK) The total likes of the post. |
| `posts[].comments_count` | integer | (one of: OK) The total amount of comments this post has (int). For getting the actual comments, use the [All Comments](https://docs.99digital.co.il/facebook-api/instagram-pages/all-comments) (getComments) API endpoint. |
| `posts[].is_comment_enabled` | boolean | (one of: OK) `true` or `false`: whether comments are enabled on the post. |
| `posts[].children` | object | (one of: OK) List of media URLs for carousel items (`media_type` = CAROUSEL_ALBUM): each item in `data` has its own `id`, `media_type`, `media_url`, and `thumbnail_url` for a video. |
| `posts[].children.data` | array of object | (one of: OK) The carousel items, in their order in the carousel. |
| `posts[].children.data[].id` | string | (one of: OK) The media ID of the carousel item. |
| `posts[].children.data[].media_type` | string | (one of: OK) The kind of the carousel item. One of: `IMAGE` — The item is an image; `VIDEO` — The item is a video (with its `thumbnail_url`). |
| `posts[].children.data[].media_url` | string | (one of: OK) Link to the media of the carousel item. |
| `posts[].children.data[].thumbnail_url` | string | (one of: OK) Thumbnail image link (only for videos). |
| `paging` | object | (one of: OK) Key that contains two values: `after`, which represents the parameter to send if you wish to get the next batch, and `hasNext`, which is true if you have more data to load, or false if this is the last data. |
| `paging.after` | string | (one of: OK) The parameter to send (as `after`) if you wish to get the next batch. Empty when there is nothing after this batch. |
| `paging.hasNext` | boolean | (one of: OK) `true` if you have more data to load, or `false` if this is the last data. |
| `reason` | integer | (one of: OK) 1 — not FAIL, the status is OK. One of: `1`. |
| `status` | string | (one of: OK — one post) OK or FAIL. `OK` — the request succeeded, and the post is in `post`. One of: `OK`. |
| `from` | string | (one of: OK — one post) Your ID for the service. Example: `463745743546345`. |
| `post` | object | (one of: OK — one post) The post, with the same fields as an item of `posts`. |
| `post.id` | string | (one of: OK — one post) This is the postId (the mediaId of the post). Example: `17895695668004550`. |
| `post.caption` | string | (one of: OK — one post) The body of the post. |
| `post.media_type` | string | (one of: OK — one post) The kind of media — IMAGE / VIDEO / CAROUSEL_ALBUM. One of: `IMAGE` — An image; `VIDEO` — A video (a reel, or a video story); `CAROUSEL_ALBUM` — A carousel — its items are in `children`. |
| `post.media_product_type` | string | (one of: OK — one post) Where the post appears — FEED / REELS / STORY. One of: `FEED` — A regular post in the feed; `REELS` — A reel; `STORY` — A story. |
| `post.media_url` | string | (one of: OK — one post) Link to the media. |
| `post.permalink` | string | (one of: OK — one post) Link directly to the post. |
| `post.thumbnail_url` | string | (one of: OK — one post) Thumbnail image link (only for videos). |
| `post.created_time` | integer | (one of: OK — one post) The post create time. UNIX UTC timestamp (int seconds). Example: `1783596120`. |
| `post.like_count` | integer | (one of: OK — one post) The total likes of the post. |
| `post.comments_count` | integer | (one of: OK — one post) The total amount of comments this post has (int). |
| `post.is_comment_enabled` | boolean | (one of: OK — one post) `true` or `false`: whether comments are enabled on the post. |
| `post.children` | object | (one of: OK — one post) List of media URLs for carousel items (`media_type` = CAROUSEL_ALBUM): each item in `data` has its own `id`, `media_type`, `media_url`, and `thumbnail_url` for a video. |
| `post.children.data` | array of object | (one of: OK — one post) The carousel items, in their order in the carousel. |
| `post.children.data[].id` | string | (one of: OK — one post) The media ID of the carousel item. |
| `post.children.data[].media_type` | string | (one of: OK — one post) The kind of the carousel item. One of: `IMAGE` — The item is an image; `VIDEO` — The item is a video (with its `thumbnail_url`). |
| `post.children.data[].media_url` | string | (one of: OK — one post) Link to the media of the carousel item. |
| `post.children.data[].thumbnail_url` | string | (one of: OK — one post) Thumbnail image link (only for videos). |
| `reason` | integer | (one of: OK — one post) 1 — not FAIL, the status is OK. One of: `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); `4` — The mediaId you sent is not a valid media ID; `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` — "limit" is not a number between 1 and 100, or "type" is not media or stories; `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; `13` — The postId (`mediaId`) is invalid or wrong: the post was not found, or it is not accessible; `15` — The content you posted was rejected by Meta, or bad media / format / size, or an invalid parameter. It could also indicate a policy violation inside the content; `18` — General error, 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

A batch of posts — an image and a carousel — with more to load.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "type": "media",
  "count": 2,
  "posts": [
    {
      "id": "17895695668004550",
      "caption": "Hello fans!",
      "media_type": "IMAGE",
      "media_product_type": "FEED",
      "media_url": "https://scontent.cdninstagram.com/v/example-image.jpg",
      "permalink": "https://www.instagram.com/p/C8xYz12AbCd/",
      "like_count": 10,
      "comments_count": 3,
      "is_comment_enabled": true,
      "created_time": 1783596120
    },
    {
      "id": "17912345678904321",
      "caption": "Swipe to see both colors",
      "media_type": "CAROUSEL_ALBUM",
      "media_product_type": "FEED",
      "media_url": "https://scontent.cdninstagram.com/v/example-first-item.jpg",
      "permalink": "https://www.instagram.com/p/C8wXy34BcDe/",
      "like_count": 42,
      "comments_count": 7,
      "is_comment_enabled": true,
      "children": {
        "data": [
          {
            "id": "17998877665544332",
            "media_type": "IMAGE",
            "media_url": "https://scontent.cdninstagram.com/v/example-first-item.jpg"
          },
          {
            "id": "17998877665544333",
            "media_type": "VIDEO",
            "media_url": "https://scontent.cdninstagram.com/v/example-second-item.mp4",
            "thumbnail_url": "https://scontent.cdninstagram.com/v/example-second-item-thumb.jpg"
          }
        ]
      },
      "created_time": 1783509720
    }
  ],
  "paging": {
    "after": "QVFIUmF4YWJjZGVmZ2hpams",
    "hasNext": true
  },
  "reason": 1
}
```

#### Example: Stories

The stories that are live right now — a smaller set of fields.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "type": "stories",
  "count": 1,
  "posts": [
    {
      "id": "17923456789012345",
      "media_type": "IMAGE",
      "media_url": "https://scontent.cdninstagram.com/v/example-story.jpg",
      "permalink": "https://www.instagram.com/stories/example_shop/3412345678901234567/",
      "created_time": 1783599720
    }
  ],
  "paging": {
    "after": "QVFIUnN0b3JpZXNhYmNkZWY",
    "hasNext": false
  },
  "reason": 1
}
```

#### Example: One post

With `mediaId`, the post comes back in `post`.

```json
{
  "status": "OK",
  "from": "463745743546345",
  "post": {
    "id": "17895695668004550",
    "caption": "Hello fans!",
    "media_type": "VIDEO",
    "media_product_type": "REELS",
    "media_url": "https://scontent.cdninstagram.com/v/example-reel.mp4",
    "permalink": "https://www.instagram.com/reel/C8xYz12AbCd/",
    "thumbnail_url": "https://scontent.cdninstagram.com/v/example-reel-thumb.jpg",
    "like_count": 10,
    "comments_count": 3,
    "is_comment_enabled": true,
    "created_time": 1783596120
  },
  "reason": 1
}
```

#### Example: Reason 3

Wrong apiKey.

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

#### Example: Reason 13

The post was not found, or it is not accessible.

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