Users
Instagram profiles in Unipile's UserProfile, the account's own profile, followers and following, follow and unfollow, follow requests, and editing the bio and picture.
Early access. Tell us what you're building and we'll set you up. Contact us
A person is named by their provider_id (Instagram's user id, a number), their
username, @username or profile link. Instagram's web opens profiles by
username, so a number works only for a person one of the account's reads has
already shown (a profile, a comment, a like, a follower or a conversation). Any
other number answers 400 errors/invalid_parameters: pass the username.
A Profile#
curl -sS "https://api.lempile.com/api/v1/users/sam.example?account_id=$ACCOUNT_ID" \
-H "X-API-KEY: $LEMPILE_API_KEY"{
"object": "UserProfile",
"provider": "INSTAGRAM",
"provider_id": "48210937561",
"provider_messaging_id": "104857600000001",
"public_identifier": "sam.example",
"full_name": "Sam Example",
"profile_picture_url": "https://…",
"profile_picture_url_large": "https://…",
"biography": "Ceramics, Lyon.",
"category": "Artist",
"followers_count": 1840,
"mutual_followers_count": 3,
"following_count": 312,
"posts_count": 96,
"profile_type": "PROFESSIONNAL",
"is_verified": false,
"is_private": false,
"external_links": ["https://sam.example.com"],
"relationship_status": {
"following": false,
"followed_by": true,
"has_sent_invitation": false,
"has_received_invitation": false
}
}profile_typeisPERSONNAL,BUSINESSorPROFESSIONNAL(a creator account), spelled as Unipile spells them.relationship_statusis the account's side:following(the account follows them),followed_by(they follow the account),has_sent_invitation(the account asked to follow a private account),has_received_invitation(they asked to follow the account).provider_messaging_idis what Unipile'sPOST /chatsasks for inattendees_ids.business(category, address, phone, email) when the account shows them.- Each read opens the profile in the account's browser. Instagram doesn't tell people who viewed their profile.
The Account's Own Profile#
GET /users/me?account_id= answers the same fields with
"object": "AccountOwnerProfile".
Followers And Following#
curl -sS "https://api.lempile.com/api/v1/users/followers?account_id=$ACCOUNT_ID&user_id=sam.example&limit=25" \
-H "X-API-KEY: $LEMPILE_API_KEY"{
"object": "UserFollowersList",
"items": [
{
"object": "UserFollower",
"id": "50112233445",
"messaging_id": "",
"username": "lou.sample",
"name": "Lou Sample",
"profile_picture_url": "https://…",
"is_private": false,
"is_verified": false
}
],
"cursor": "<cursor>"
}- Without
user_id, the account's own followers. - 25 a page at most, as on Unipile: a
limitfrom 26 to 250 gets 25, more than 250 answers400. Instagram can give fewer, and for a verified account it gives a small fixed sample and no next page. messaging_idis always""(Unipile no longer fills it for Instagram).- A private account's followers can only be read when the account follows it.
GET /users/following?account_id=&user_id= answers whom someone follows, with
the same items. limit is 25 by default and goes up to 1,000, as on Unipile
(more answers 400); one page holds 100 at most, and cursor reads on.
Follow And Unfollow#
curl -sS -X POST "https://api.lempile.com/api/v1/users/invite" \
-H "X-API-KEY: $LEMPILE_API_KEY" \
-H "Idempotency-Key: follow-sam-1" \
-H "Content-Type: application/json" \
-d '{ "account_id": "'"$ACCOUNT_ID"'", "provider_id": "sam.example" }'{ "object": "UserInvitationSent", "invitation_id": "48210937561" }Idempotency-Keyis required, for unfollows too.provider_idis the person'sprovider_idor username. Theirprovider_messaging_iddoesn't work here (as on Unipile).- Following a private account sends a follow request: they decide.
invitation_idis the person'sprovider_id.
DELETE /users/invite/sent/{provider_id}?account_id= unfollows, or takes back a
follow request not yet accepted:
{ "object": "InvitationCanceled" }Follows and unfollows: 2 minutes apart, 20 a day per account.
Follow Requests#
A private account receives follow requests.
GET /users/invite/received?account_id= lists them (InvitationList, with
limit, 10 by default and 100 at most, and cursor). Each request's id is
the person's provider_id.
curl -sS -X POST "https://api.lempile.com/api/v1/users/invite/received/48210937561" \
-H "X-API-KEY: $LEMPILE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "provider": "INSTAGRAM", "account_id": "'"$ACCOUNT_ID"'", "action": "accept" }'{ "object": "UserInvitationHandled", "status": "ACCEPTED" }action is accept or decline.
Edit The Profile#
PATCH /users/me/edit (multipart/form-data) changes the account's bio and
picture, through Instagram's own Edit profile page:
| Field | |
|---|---|
type |
INSTAGRAM. |
account_id |
Required. |
summary |
The bio, 150 characters at most. |
picture |
A JPEG or PNG file, 8 MB at most. One that isn't square is cropped to a centred square, as Instagram's own uploader does. |
{ "object": "ProfileEdited" }Send summary, picture or both: only the bio and the picture change here,
as on Unipile. LinkedIn's fields (headline, location, experience…)
answer 400.
Was this page helpful?