Graph API Version

Album Photos

Represents a collection of Photos on an Album.

Reading

GET /{album-id}/photos

Returns a list of Photos on an Album.

Requirements

Requirements depend on the type of node that the Album is on.

RequirementUser nodesPage nodesGroup nodes

Access Tokens

Any

Any

User

Features

None

Page Public Content Access if you lack the manage_pages permission and the Page is published

None

Permissions

user_photos

Unpublished Pages:
manage_pages


Published Pages:
manage_pages if you lack the Page Public Content Access feature

None

Group Roles

Not applicable

Not applicable

Admin

Request Syntax

Graph API Explorer
GET /v5.0/{album-id}/photos 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(
    '/{album-id}/photos',
    '{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(
    "/{album-id}/photos",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{album-id}/photos",
    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:@"/{album-id}/photos"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Response

A JSON-formatted object containing a list of Photo IDs.

{
  "data": [
    {
      "id": "{id}"
    },
    ...
  ],
  "paging": {
    "cursors": {
      "before": "{before}",
      "after": "{after}"
    }
  }
}

Creating

POST /{album-id}/photos

Create a Photo on an Album.

Requirements

For Albums on a Group — a User access token with publish_to_groups permission.

Request Syntax

POST /v5.0/{album-id}/photos HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{album-id}/photos',
    array (),
    '{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(
    "/{album-id}/photos",
    "POST",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{album-id}/photos",
    null,
    HttpMethod.POST,
    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:@"/{album-id}/photos"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Body Parameters

Name Description Type

message

The description of the photo, used as the accompanying status message in any feed story.

string

no_story

If set to true, this will suppress the feed story that is automatically generated on a person's profile when they upload a photo using your app.

boolean

place

Page ID of a place associated with the Photo.

string

source
Required*

The image file, encoded as form data.


Either this or url field is required, but both should not be used together.

multipart/form-data

url
Required*

The URL of a photo that is already uploaded to the internet.


Either this or source is required, but both should not be used together.

string

* Either source or url is required, but both should not be used together.

Response

If successful, you will receive a response with the following information. In addition, this endpoint supports read-after-write and can immediately return any fields returned by read operations.

Name Description Type

id

The newly created photo ID

string

post_id

The ID of the post story about the uploaded photo.

string

Updating

This operation is not supported.

Deleting

This operation is not supported. To delete a photo, use the DELETE /{photo-id} endpoint instead.