Graph API Version

User Picture

A User's profile image.

Requirements Change

This endpoint supports both App-Scoped User IDs (ASID) and non-ASIDs. Currently, you can query either type with no additional requirements. However, beginning October 24, 2020, an Access Token will be required for any non-ASID-based queries. If you do not have an ASID and thus must include a token:

We recommend that you only use a Client Access Token if you are unable to use one of the other token types.

Testing

If you are unsure whether your tokens are app-scoped or non-app-scoped and would like to test these changes before they are required on October 24, 2020, include the breaking_change=profile_picture query string parameter in your request. For example:

GET /{unknown-type-id}/picture?breaking_change=profile_picture
GET /{unknown-type-id}/picture?fields=picture&breaking_change=profile_picture

If the endpoint responds with the Facebook app's profile image instead of the User's profile image, your calls will fail starting October 24, 2020 unless you include an Access Token.

Reading

Get a User's profile image.

Notes

  • Supports both App-Scoped User IDs (ASID) and non-ASIDs.
  • By default this edge will return a 302 redirect to the image. To get data about the image, include the redirect=false query string parameter.
  • Profile picture URLs returned by this edge will expire.

Requirements

TypeRequirement

Access Tokens

None.

Permissions

None.

Example

Graph API Explorer
GET /v8.0/{user-id}/picture 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(
    '/{user-id}/picture',
    '{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(
    "/{user-id}/picture",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/picture",
    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:@"/{user-id}/picture"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

ParameterDescription
height
integer

The height of this picture in pixels.

redirect
boolean
Default value: true

By default the picture edge will return a picture instead of a JSON response. If you want the picture edge to return JSON that describes the image set redirect=0 when you make the request.

type
enum{small, normal, album, large, square}

The size of this picture. It can be one of the following values: small, normal, large, square.

width
integer

The width of this picture in pixels.

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A single ProfilePictureSource node.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error
190Invalid OAuth 2.0 Access Token
459The session is invalid because the user has been checkpointed

Creating

You can't perform this operation on this endpoint.

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.