On Messenger, send a GET to https://graph.facebook.com/v26.0/PSID?fields=first_name,last_name,profile_pic with a Page access token. It only returns data once your app has Advanced Access, App Review approval and the Business Asset User Profile Access feature. The person must also have messaged your Page, tapped Get Started or accepted your message request. On Instagram, send a GET to the person’s IGSID with fields=name,username,profile_pic. It works only after the person has consented by messaging you or tapping an ice breaker or menu item. On both channels the picture URL expires, so store it with the time you fetched it.
Messenger User Profile API
The request takes the PSID from sender.id in your webhook (User Profile API, accessed 2026-11-04). Meta’s sample has no version in the path, so v26.0 is added here.
curl -X GET "https://graph.facebook.com/v26.0/PSID?fields=first_name,last_name,profile_pic&access_token=PAGE_ACCESS_TOKEN"
This is Meta’s sample response, with the trailing comma after gender removed so it parses. The last three fields only come back when you request them and hold the matching permissions.
{
"first_name": "Peter",
"last_name": "Chang",
"profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/v/t1.0-1/p200x200/13055603_10105219398495383_8237637584159975445_n.jpg?oh=1d241d4b6d4dac50eaf9bb73288ea192&oe=57AF5C03&__gda__=1470213755_ab17c8c8e3a0a447fed3f272fa2179ce",
"locale": "en_US",
"timezone": -7,
"gender": "male"
}
Meta’s page opens with the gate for every field: “Requires Advanced Access and App Review approval.” The person must also have made the information public and opted in to your Page.
| Field | What it is | Extra requirement |
|---|---|---|
id, name, first_name, last_name |
The person’s identifiers and name | Business Asset User Profile Access feature |
profile_pic |
“URL to the Profile picture. The URL will expire.” | Business Asset User Profile Access feature |
locale |
The person’s locale | pages_user_locale |
timezone |
Offset from GMT | pages_user_timezone |
gender |
Gender | pages_user_gender |
Meta lists the three extra permissions without a deprecation note, but whether App Review still grants them in 2026 isn’t confirmed. Build without locale, timezone and gender, and treat them as a bonus if you get them. To request profile access for a Page, Meta points to Page Settings, then Advanced Messaging, then “Info About People”.
Which entry points grant access
Access follows how the conversation started. Your app can read the profile once the person taps Get Started on the welcome screen or a Send to Messenger button. A message from the person to your Page grants it too, and so does accepting a message request from your Page.
Two entry points don’t grant access on their own: the Checkbox Plugin and Click to Messenger ads. For those, “the app will be granted permission to access the person’s profile after the person replied to the initial message.” Inside a Messenger Extensions webview, askPermission() requests the user_profile permission. The Get Started setup is in the persistent menu and Get Started post.
When the call returns nothing
A call without access returns an empty object. Treat {} as “no profile yet”, and show a neutral label such as “Messenger user” until access is granted. Accounts created with a phone number return error 2018218, “No profile available for this user.” Some PSIDs can’t be used at all, such as those tied to Instant Games Pages.
Instagram user profile
Instagram has the same call under both login setups. The IGSID is sender.id in the webhook. On Instagram Login, call graph.instagram.com with an Instagram User access token (Instagram Login user profile, accessed 2026-11-04). Meta’s samples on both pages break the URL across lines inside the quotes, which leaves spaces in the URL. It’s on one line here.
curl -X GET "https://graph.instagram.com/v26.0/IGSID?fields=name,username,profile_pic,follower_count,is_user_follow_business,is_business_follow_user&access_token=INSTAGRAM_ACCESS_TOKEN"
On Facebook Login, the same fields go to https://graph.facebook.com/v26.0/IGSID with a Page access token (Instagram Messaging user profile, accessed 2026-11-04). Both pages print the same response, which lacks a comma after 1234 and ends with a trailing comma. Both are fixed here.
{
"name": "Peter Chang",
"username": "peter_chang_live",
"profile_pic": "https://fbcdn-profile-...",
"follower_count": 1234,
"is_user_follow_business": false,
"is_business_follow_user": true
}
| Field | What it is |
|---|---|
name |
Display name, can be null |
username |
Instagram username |
profile_pic |
Picture URL, can be null. “The URL expires after a few days.” |
follower_count |
Integer |
is_user_follow_business |
Whether the person follows your account |
is_business_follow_user |
Whether your account follows the person |
is_verified_user |
Boolean, in the field table but not in Meta’s sample |
Meta marks only name and profile_pic as nullable, so fall back to username when you display a sender.
Consent comes from the conversation
“User consent is required to access user profile.” Meta sets consent only when the person sends your account a message, or taps an ice breaker or persistent menu item. Ice breakers are set up in Instagram DM quick replies and templates.
A comment on your post doesn’t count. Comments alone don’t set consent, so wait for their first DM. Answering commenters by DM is covered in Instagram comment private replies. You also can’t read the profile of someone who blocked your account.
Permissions per setup
On Instagram Login you need instagram_business_basic and instagram_business_manage_messages, plus a token from someone who can manage messages. Use Advanced Access for accounts you don’t own, and Standard Access covers your own. Subscribe to messages, messaging_optins, messaging_postbacks and messaging_referral. Token setup is in the Instagram Login setup.
On Facebook Login the list is instagram_basic, instagram_manage_messages, pages_manage_metadata, pages_read_engagement and pages_show_list. The Page token must come from a person who can perform the MODERATE task on the Page.
Caching names and expired picture URLs
Meta gives no caching rule, no retention rule for profile data and no exact expiry time. Messenger says “The URL will expire”. Instagram says it “expires after a few days”. The pattern below is our engineering advice, not a Meta requirement. Store the name and username keyed by PSID or IGSID. Store profile_pic with the time you fetched it, and refetch when the image fails to load or your copy has aged.
This helper runs on Python 3.9 or later with the standard library. It wraps both calls with an in-memory cache. The 24-hour refresh is our choice, not a figure from Meta.
import json
import os
import time
import urllib.error
import urllib.parse
import urllib.request
CHANNELS = {
"messenger": ("https://graph.facebook.com/v26.0", "first_name,last_name,profile_pic", "PAGE_ACCESS_TOKEN"),
"instagram": ("https://graph.instagram.com/v26.0", "name,username,profile_pic", "INSTAGRAM_ACCESS_TOKEN"),
}
REFRESH_SECONDS = 24 * 3600 # our choice; Meta documents no expiry time
cache = {}
def fetch(channel, user_id):
base, fields, token_env = CHANNELS[channel]
query = urllib.parse.urlencode({"fields": fields, "access_token": os.environ[token_env]})
try:
with urllib.request.urlopen(f"{base}/{user_id}?{query}", timeout=10) as resp:
return json.load(resp)
except urllib.error.HTTPError as err:
error = json.load(err).get("error", {})
if 2018218 in (error.get("code"), error.get("error_subcode")):
return {} # Messenger: no profile available for this user
raise
def profile(channel, user_id, picture_failed=False):
key = (channel, user_id)
hit = cache.get(key)
if hit and not picture_failed and time.time() - hit["fetched_at"] < REFRESH_SECONDS:
return hit
data = fetch(channel, user_id)
if not data:
return data # no access yet: don't cache, ask again after the next message
data["fetched_at"] = time.time()
cache[key] = data
return data
if __name__ == "__main__":
import sys
print(profile(sys.argv[1], sys.argv[2]))
Run it as PAGE_ACCESS_TOKEN=... python profile.py messenger PSID. Meta’s page gives the number 2018218 without saying whether it arrives as code or error_subcode, so the check looks at both. An empty dict means no access yet, so the caller should retry after the person’s next message rather than on a timer.
Call profile(..., picture_failed=True) when your front end reports a broken image. For a stored copy of the conversation itself, see the Conversations API for message history.
Z-API Omni team