# Instagram / Posts

Fetch recent public posts for a profile.

```
GET /api/v1/instagram/posts
```

Auth: `Authorization: Bearer <SOCIFY_KEY>`  
Credits: 1 credit per request

## Parameters

| Name | Required | Description | Example |
|------|----------|-------------|---------|
| `username` | no | Exactly one of username or user_id. Prefer username. | `natgeo` |
| `user_id` | no | Numeric user id (alternative to username). | `787132` |
| `cursor` | no | Pagination cursor from a previous response. |  |

## Example

```bash
curl -s 'https://trysocify.com/api/v1/instagram/posts?username=natgeo' \
  -H "Authorization: Bearer $SOCIFY_KEY"
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `posts` | array | Posts for this page. |
| `posts[].id` | string | Media id. |
| `posts[].code` | string | Shortcode. |
| `posts[].url` | string | Post URL. |
| `posts[].caption` | string | Caption text. |
| `posts[].type` | string | image, video, or carousel. |
| `posts[].created_at` | number | Unix publish timestamp. |
| `posts[].likes` | number | Like count. |
| `posts[].comments` | number | Comment count. |
| `posts[].views` | number | View/play count, when available. |
| `posts[].thumbnail` | string | Thumbnail URL. |
| `posts[].video_url` | string | Video URL, when available. |
| `posts[].author` | object | Author username and id. |
| `cursor` | string | Pass as cursor for the next page. |
## Sample response

Successful lookups wrap the payload in `{ ok, platform, resource, params, data, meta }`. `data` is shown below.

```json
{
  "ok": true,
  "platform": "instagram",
  "resource": "posts",
  "params": {
    "username": "natgeo"
  },
  "data": {
    "cursor": "QVFENkVvdWUzN2ZGbjNGX0RVcU9ZMWxr...",
    "posts": [
      {
        "author": {
          "id": "787132",
          "username": "natgeo"
        },
        "caption": "A lion rests on the savanna.",
        "code": "C-6WRvdS75Q",
        "comments": 4653,
        "created_at": 1724199751,
        "id": "3439159241662512720",
        "likes": 642848,
        "thumbnail": "https://scontent.cdninstagram.com/v/t51.29350-15/example.jpg",
        "type": "image",
        "url": "https://www.instagram.com/p/C-6WRvdS75Q/",
        "video_url": "",
        "views": 0
      }
    ]
  },
  "meta": {
    "credits_charged": 1,
    "latency_ms": 420,
    "platform": "instagram",
    "resource": "posts",
    "path": "/api/v1/instagram/posts"
  }
}
```

## Links

- HTML docs: https://trysocify.com/docs/api/instagram/posts
- SEO page: https://trysocify.com/instagram/posts
- OpenAPI: https://trysocify.com/openapi.json
- Catalog: https://trysocify.com/catalog.json
