List user posts

Learn how to get the posts of an Instagram user with Unipile API.

To get a list of posts, use the List all User's Posts endpoint, specifying the ID of the user whose posts you want to retrieve.

To retrieve your own posts, set me as user_id.


const { data } = await usersApi.getPostsList({
  path: {
    account_id: "acc_123456789",
    user_id: "user_id",
  },
});
posts = users_api.get_posts_list("user_id", "acc_123456789")
curl --request GET \
     --url https://api.unipile.com/v2/account_id/users/user_id/posts \
     --header 'accept: application/json'

To get a single post, use the Get a Post endpoint, specifying the ID of the post you are looking for.

const { data } = await postsApi.getPost({
  path: {
    account_id: "acc_123456789",
    post_id: "post_id",
  },
});
post = posts_api.get_post("post_id", "acc_123456789")
curl --request GET \
     --url https://api.unipile.com/v2/account_id/posts/post_id \
     --header 'accept: application/json'

Retrieve user activity

Use List all User's Comments or List all User's Reactions with a provider user ID to retrieve the activity exposed for that user. Follow each method's pagination parameters to retrieve subsequent pages. These endpoints start from a user; List all Post's Comments and List all Post's Reactions start from a post instead. Visibility remains subject to the connected account's access.

const { data } = await postsApi.getUserCommentsList({
  path: {
    account_id: "acc_123456789",
    user_id: "user_id",
  },
  query: {
    limit: 20,
  },
});
data = posts_api.get_user_comments_list(
    account_id='acc_123456789',
    user_id='user_id',
    limit=20,
)
curl --request GET \
  --url "https://api.unipile.com/v2/acc_123456789/users/user_id/comments?limit=20" \
  --header 'X-API-KEY: YOUR_API_KEY'

Retrieve reactions by a user

const { data } = await postsApi.getUserReactionsList({
  path: {
    account_id: "acc_123456789",
    user_id: "user_id",
  },
  query: {
    limit: 20,
  },
});
data = posts_api.get_user_reactions_list(
    account_id='acc_123456789',
    user_id='user_id',
    limit=20,
)
curl --request GET \
  --url "https://api.unipile.com/v2/acc_123456789/users/user_id/reactions?limit=20" \
  --header 'X-API-KEY: YOUR_API_KEY'

Did this page help you?