Represents a Facebook user.
Get fields and edges on a User.
GET /v10.0/{person-id}/ HTTP/1.1
Host: graph.facebook.com/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{person-id}/',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result *//* make the API call */
FB.api(
"/{person-id}/",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{person-id}/",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{person-id}/"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];curl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v10.0/{person-id}/The public_profile permission allows apps to read the following fields:
idfirst_namelast_namemiddle_namenamename_formatpictureshort_name| Field | Description |
|---|---|
idnumeric string | The app user's App-Scoped User ID. This ID is unique to the app and cannot be used by other apps. |
aboutstring | Returns no data as of April 4, 2018. |
age_range | The age segment for this person expressed as a minimum and maximum age. For example, more than 18, less than 21. |
birthdaystring | The person's birthday. This is a fixed format string, like |
education | Returns no data as of April 4, 2018. |
emailstring | The User's primary email address listed on their profile. This field will not be returned if no valid email address is available. |
favorite_athletes | Athletes the User likes. |
favorite_teams | Sports teams the User likes. |
first_namestring | The person's first name |
genderstring | The gender selected by this person, |
hometown | The person's hometown |
inspirational_people | The person's inspirational people |
installedbool | Is the app making the request installed |
interested_inlist<string> | Returns no data as of April 4, 2018. |
is_guest_userbool | if the current user is a guest user. should always return false. |
languages | Facebook Pages representing the languages this person knows |
last_namestring | The person's last name |
linkstring | A link to the person's Timeline. The link will only resolve if the person clicking the link is logged into Facebook and is a friend of the person whose profile is being viewed. |
local_news_megaphone_dismiss_statusbool | Display megaphone for local news bookmark Deprecated |
local_news_subscription_statusbool | Daily local news notification Deprecated |
localestring | The person's locale CoreDeprecated |
location | The person's current location as entered by them on their profile. This field requires the |
meeting_forlist<string> | What the person is interested in meeting for |
middle_namestring | The person's middle name |
namestring | The person's full name |
name_formatstring | The person's name formatted to correctly handle Chinese, Japanese, or Korean ordering |
politicalstring | Returns no data as of April 4, 2018. |
quotesstring | The person's favorite quotes |
relationship_statusstring | Returns no data as of April 4, 2018. |
religionstring | Returns no data as of April 4, 2018. |
datetime | The time that the shared login needs to be upgraded to Business Manager by |
significant_other | The person's significant other |
sports | Sports played by the person |
supports_donate_button_in_live_videobool | Whether the user can add a Donate Button to their Live Videos |
third_party_idstring | A string containing an anonymous, unique identifier for the User, for use with third-parties. Deprecated for versions 3.0+. Apps using older versions of the API can get this field until January 8, 2019. Apps installed by the User on or after May 1st, 2018, cannot get this field. Deprecated |
timezonefloat (min: -24) (max: 24) | The person's current timezone offset from UTC CoreDeprecated |
token_for_businessstring | A token that is the same across a business's apps. Access to this token requires that the person be logged into your app or have a role on your app. This token will change if the business owning the app changes |
updated_timedatetime | Updated time Deprecated |
verifiedbool | Indicates whether the account has been verified. This is distinct from the
Deprecated |
video_upload_limits | Video upload limits |
websitestring | Returns no data as of April 4, 2018. |
| Edge | Description |
|---|---|
Pages the User has a role on. | |
Ad studies that this User's can view. | |
The advertising accounts the User can access. | |
The photo albums this person has created | |
App requests | |
This person's pending requests from an app | |
Ad accounts that are assigned to this business scoped user | |
Business asset groups that are assign to this business scoped user | |
Pages that are assigned to this business scoped user | |
Product catalogs that are assigned to this business scoped user | |
Business users corresponding to the user | |
Businesses associated with the user | |
Facebook Messenger conversation | |
The person's cover photo Deprecated | |
custom_labels | |
The posts and links published by this person or others on their profile | |
Businesses can claim ownership of multiple apps using Business Manager. This edge returns the list of IDs that this user has in any of those other apps | |
Businesses can claim ownership of multiple apps using Business Manager. This edge returns the list of IDs that this user has in any of those other apps | |
Businesses can claim ownership of apps and pages using Business Manager. This edge returns the list of IDs that this user has in any of the pages owned by this business | |
All the Pages this person has liked | |
Live encoders owned by this person | |
Live videos from this person | |
Music this person likes | |
Payment subscriptions | |
The permissions that the person has granted this app | |
The advertising accounts to which this person has personal access | |
Photos the person is tagged in or has uploaded | |
The person's profile picture | |
A list of rich media documents belonging to Pages that the user has advertiser permissions on | |
Videos the person is tagged in or uploaded |
| Error | Description |
|---|---|
| 100 | Invalid parameter |
| 80006 | There have been too many messenger api calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
| 190 | Invalid OAuth 2.0 Access Token |
| 368 | The action attempted has been deemed abusive or is otherwise disallowed |
| 200 | Permissions error |
| 459 | The session is invalid because the user has been checkpointed |
| 613 | Calls to this api have exceeded the rate limit. |
| 80004 | There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
| 210 | User not visible |
| 3018 | The start date of the time range cannot be beyond 37 months from the current date |
/{user_id}.| Parameter | Description |
|---|---|
emoji_color_prefint64 | emoji color preference. |
firstnamestring | This person's first name |
lastnamestring | This person's last name |
local_news_megaphone_dismiss_statusenum {YES, NO} | Dismisses local news megaphone |
local_news_subscription_statusenum {STATUS_ON, STATUS_OFF} | Preference for setting local news notifications |
namestring | Used for test accounts only. Name for this account |
passwordstring | Used for test accounts only. Password for this account |
success: bool, | Error | Description |
|---|---|
| 100 | Invalid parameter |
| 200 | Permissions error |
| 240 | Desktop applications cannot call this function for other users |
| 459 | The session is invalid because the user has been checkpointed |
| 210 | User not visible |
| 452 | Session key invalid. This could be because the session key has an incorrect format, or because the user has revoked this session |
/{user_id}/game_items.| Parameter | Description |
|---|---|
actionenum {MARK, CONSUME, DROP} | Action to trigger on an inventory item Required |
app_idapplication ID | Overrides the application from the user access token. Must be another app within the business |
drop_table_idgame_drop_table ID | What loot drop table to trigger for the DROP action |
ext_idstring | External id assigned by the game for the item |
item_idgame_item ID | What item id to target for the MARK and CONSUME actions |
quantityint64 | SELF_EXPLANATORY |
id: unsigned integer, count: unsigned integer, created: timestamp, item_def: string, status: enum, updated: timestamp, ext_id: string, | Error | Description |
|---|---|
| 100 | Invalid parameter |
/{custom_audience_id}/users.POST /v10.0/<CUSTOM_AUDIENCE_ID>/users HTTP/1.1
Host: graph.facebook.com
payload=%7B%22schema%22%3A%5B%22EMAIL%22%2C%22LOOKALIKE_VALUE%22%5D%2C%22data%22%3A%5B%5B%229b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254%22%2C44.5%5D%2C%5B%228cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee%22%2C140%5D%2C%5B%224eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a%22%2C0%5D%2C%5B%2298df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56%22%2C0.9%5D%5D%7D/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/<CUSTOM_AUDIENCE_ID>/users',
array (
'payload' => '{"schema":["EMAIL","LOOKALIKE_VALUE"],"data":[["9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254",44.5],["8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee",140],["4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a",0],["98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56",0.9]]}',
),
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result *//* make the API call */
FB.api(
"/<CUSTOM_AUDIENCE_ID>/users",
"POST",
{
"payload": "{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);Bundle params = new Bundle();
params.putString("payload", "{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/<CUSTOM_AUDIENCE_ID>/users",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
@"payload": @"{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/<CUSTOM_AUDIENCE_ID>/users"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];curl -X POST \
-F 'payload={
"schema": [
"EMAIL",
"LOOKALIKE_VALUE"
],
"data": [
[
"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254",
44.5
],
[
"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee",
140
],
[
"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a",
0
],
[
"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56",
0.9
]
]
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v10.0/<CUSTOM_AUDIENCE_ID>/users| Parameter | Description |
|---|---|
namespacestring | If extern_id provided and namespace specified, will match under specified namespace and update the mapping if necessary and pass permission check |
payloadObject | Payload representing users to add |
sessionObject | Information about the session. Sessions are used when you have a lot of users to upload. For example, if you have 1 million users to upload, you need to split them into at least 100 requests because each request can only take 10k users. Specify the session info so that you can track if the session has finished or not. |
audience_id: numeric string, session_id: numeric string, num_received: int32, num_invalid_entries: int32, invalid_entry_samples: Map {| Error | Description |
|---|---|
| 200 | Permissions error |
| 2650 | Failed to update the custom audience |
| 100 | Invalid parameter |
| 368 | The action attempted has been deemed abusive or is otherwise disallowed |
| 294 | Managing advertisements requires an access token with the extended permission for ads_management |
| 105 | The number of parameters exceeded the maximum for this operation |
| 190 | Invalid OAuth 2.0 Access Token |
Delete a test user
/{user_id}.success: bool, | Error | Description |
|---|---|
| 100 | Invalid parameter |
| 2903 | Cannot delete this test account |
| 200 | Permissions error |
| 2904 | Cannot delete the OG Test User |
| 240 | Desktop applications cannot call this function for other users |
/{custom_audience_id}/users.| Parameter | Description |
|---|---|
namespacestring | If extern_id provided and namespace specified, will match under specified namespace and update the mapping if necessary and pass permission check |
payloadObject | Payload representing users to delete |
sessionObject | Information about the session. Sessions are used when you have a lot of users to upload. For example, if you have 1 million users to upload, you need to split them into at least 100 requests because each request can only take 10k users. Specify the session info so that you can track if the session has finished or not. |
audience_id: numeric string, session_id: numeric string, num_received: int32, num_invalid_entries: int32, invalid_entry_samples: Map {| Error | Description |
|---|---|
| 80003 | There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
| 200 | Permissions error |
| 100 | Invalid parameter |
| 2650 | Failed to update the custom audience |
| 368 | The action attempted has been deemed abusive or is otherwise disallowed |
/act_{ad_account_id}/assigned_users.| Parameter | Description |
|---|---|
userUID | Business user id or system user id Required |
success: bool, | Error | Description |
|---|---|
| 3919 | There was an unexpected technical issue. Please try again. |
| 100 | Invalid parameter |
/{page_id}/blocked.| Parameter | Description |
|---|---|
asiduser/page ID | App Scoped User ID to unblock |
psidUID | Page Scoped User ID to unblock |
uidUID | Deprecated. Same as |
userUID | List of User or Page IDs to unblock. This or |
success: bool, | Error | Description |
|---|---|
| 100 | Invalid parameter |
/{user_id}/businesses.| Parameter | Description |
|---|---|
businessnumeric string or integer | SELF_EXPLANATORY |
success: bool, | Error | Description |
|---|---|
| 3914 | It looks like you're trying to remove the last admin from this Business Manager. At least one admin is required in Business Manager. |