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:
id
first_name
last_name
middle_name
name
name_format
picture
short_name
Field | Description |
---|---|
id numeric string | The app user's App-Scoped User ID. This ID is unique to the app and cannot be used by other apps. |
about string | 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. |
birthday string | The person's birthday. This is a fixed format string, like |
education | Returns no data as of April 4, 2018. |
email string | 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_name string | The person's first name |
gender string | The gender selected by this person, |
hometown | The person's hometown |
inspirational_people | The person's inspirational people |
installed bool | Is the app making the request installed |
interested_in list<string> | Returns no data as of April 4, 2018. |
is_guest_user bool | if the current user is a guest user. should always return false. |
languages | Facebook Pages representing the languages this person knows |
last_name string | The person's last name |
link string | 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_status bool | Display megaphone for local news bookmark Deprecated |
local_news_subscription_status bool | Daily local news notification Deprecated |
locale string | The person's locale CoreDeprecated |
location | The person's current location as entered by them on their profile. This field requires the |
meeting_for list<string> | What the person is interested in meeting for |
middle_name string | The person's middle name |
name string | The person's full name |
name_format string | The person's name formatted to correctly handle Chinese, Japanese, or Korean ordering |
political string | Returns no data as of April 4, 2018. |
quotes string | The person's favorite quotes |
relationship_status string | Returns no data as of April 4, 2018. |
religion string | 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_video bool | Whether the user can add a Donate Button to their Live Videos |
third_party_id string | 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 |
timezone float (min: -24) (max: 24) | The person's current timezone offset from UTC CoreDeprecated |
token_for_business string | 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_time datetime | Updated time Deprecated |
verified bool | Indicates whether the account has been verified. This is distinct from the
Deprecated |
video_upload_limits | Video upload limits |
website string | 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. |
200 | Permissions error |
190 | Invalid OAuth 2.0 Access Token |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
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 |
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}
.Parameter | Description |
---|---|
emoji_color_pref int64 | emoji color preference. |
firstname string | This person's first name |
lastname string | This person's last name |
local_news_megaphone_dismiss_status enum {YES, NO} | Dismisses local news megaphone |
local_news_subscription_status enum {STATUS_ON, STATUS_OFF} | Preference for setting local news notifications |
name string | Used for test accounts only. Name for this account |
password string | 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 |
/{user_id}/game_items
.Parameter | Description |
---|---|
action enum {MARK, CONSUME, DROP} | Action to trigger on an inventory item Required |
app_id application ID | Overrides the application from the user access token. Must be another app within the business |
drop_table_id game_drop_table ID | What loot drop table to trigger for the DROP action |
ext_id string | External id assigned by the game for the item |
item_id game_item ID | What item id to target for the MARK and CONSUME actions |
quantity int64 | 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 |
---|---|
namespace string | If extern_id provided and namespace specified, will match under specified namespace and update the mapping if necessary and pass permission check |
payload Object | Payload representing users to add |
session Object | 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 |
105 | The number of parameters exceeded the maximum for this operation |
190 | Invalid OAuth 2.0 Access Token |
294 | Managing advertisements requires an access token with the extended permission for ads_management |
Delete a test user
/{user_id}
.success
: bool, Error | Description |
---|---|
100 | Invalid parameter |
200 | Permissions error |
2903 | Cannot delete this test account |
2904 | Cannot delete the OG Test User |
240 | Desktop applications cannot call this function for other users |
/{custom_audience_id}/users
.Parameter | Description |
---|---|
namespace string | If extern_id provided and namespace specified, will match under specified namespace and update the mapping if necessary and pass permission check |
payload Object | Payload representing users to delete |
session Object | 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 |
---|---|
user UID | 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 |
---|---|
asid user/page ID | App Scoped User ID to unblock |
psid UID | Page Scoped User ID to unblock |
uid UID | Deprecated. Same as |
user UID | List of User or Page IDs to unblock. This or |
success
: bool, Error | Description |
---|---|
100 | Invalid parameter |
200 | Permissions error |
/{user_id}/businesses
.Parameter | Description |
---|---|
business numeric 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. |