Facebook profile photos API
Photos from a page's Photos tab (type "image"): id, caption, image URL and size.
GET /v1/facebook/profile/photos
GET /v1/facebook/profile/photos
Photos from a page's Photos tab (type "image"): id, caption, image URL and size. The cursor carries both of ScrapeCreators' paging values (next_page_id and cursor).
- Cost: 1 credit
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
url | URL | yes | Profile or page URL. Accepted hosts: facebook.com, fb.com, fb.watch. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
1curl -G "https://api.socialscrape.dev/v1/facebook/profile/photos" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "url=https://www.facebook.com/NASA" \4 --data-urlencode "cursor=eyJrIjoicGhvdG9zIiwiY29sIjoiWVhCd1gyTnZiR3hsWTNScGIyNDZjR1ppYVdRd00yNUtURUo0ZGs1U01WZzVTRTVFUkZseFp6aERNamN5UVdKWmRFcHJlbUpuZW5OMFEzbE9hR1pFVldOR05rNUtlRTQwVFdoSFIyNWpkRmszV1dsNE5VUmFiMFJRV1RoclJIbFdibEZpVEcxaE9UVm5jVGRTUms0NFRtUnMiLCJhZnRlciI6IkFRSFR4Tl81dXUtMGFtdDR5NzRYM0hQbGVncy1CSVI4X21MVUxRQnk3dFM3OXQtLWVBb2d1dnZXMGRhU0ZnMElXd1FZUHRUMHVVeHN5cWRmeVFXSktwM2ZudyIsInUiOiJodHRwczovL3d3dy5mYWNlYm9vay5jb20vTkFTQSJ9"1import os2import requests34params = {5 "url": "https://www.facebook.com/NASA",6 "cursor": "eyJrIjoicGhvdG9zIiwiY29sIjoiWVhCd1gyTnZiR3hsWTNScGIyNDZjR1ppYVdRd00yNUtURUo0ZGs1U01WZzVTRTVFUkZseFp6aERNamN5UVdKWmRFcHJlbUpuZW5OMFEzbE9hR1pFVldOR05rNUtlRTQwVFdoSFIyNWpkRmszV1dsNE5VUmFiMFJRV1RoclJIbFdibEZpVEcxaE9UVm5jVGRTUms0NFRtUnMiLCJhZnRlciI6IkFRSFR4Tl81dXUtMGFtdDR5NzRYM0hQbGVncy1CSVI4X21MVUxRQnk3dFM3OXQtLWVBb2d1dnZXMGRhU0ZnMElXd1FZUHRUMHVVeHN5cWRmeVFXSktwM2ZudyIsInUiOiJodHRwczovL3d3dy5mYWNlYm9vay5jb20vTkFTQSJ9",7}8res = requests.get(9 "https://api.socialscrape.dev/v1/facebook/profile/photos",10 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},11 params=params,12)13body = res.json()1415if body["ok"]:16 print(body["data"])17else:18 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/facebook/profile/photos");2url.search = new URLSearchParams({3 "url": "https://www.facebook.com/NASA",4 "cursor": "eyJrIjoicGhvdG9zIiwiY29sIjoiWVhCd1gyTnZiR3hsWTNScGIyNDZjR1ppYVdRd00yNUtURUo0ZGs1U01WZzVTRTVFUkZseFp6aERNamN5UVdKWmRFcHJlbUpuZW5OMFEzbE9hR1pFVldOR05rNUtlRTQwVFdoSFIyNWpkRmszV1dsNE5VUmFiMFJRV1RoclJIbFdibEZpVEcxaE9UVm5jVGRTUms0NFRtUnMiLCJhZnRlciI6IkFRSFR4Tl81dXUtMGFtdDR5NzRYM0hQbGVncy1CSVI4X21MVUxRQnk3dFM3OXQtLWVBb2d1dnZXMGRhU0ZnMElXd1FZUHRUMHVVeHN5cWRmeVFXSktwM2ZudyIsInUiOiJodHRwczovL3d3dy5mYWNlYm9vay5jb20vTkFTQSJ9"5}).toString();6const res = await fetch(url, {7 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },8});9const body = await res.json();1011if (body.ok) {12 console.log(body.data);13} else {14 console.error(body.error.code, body.error.message);15}1{2 "nodes": [3 {4 "name": "SocialScrape Facebook profile photos",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/facebook/profile/photos",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "url",19 "value": "https://www.facebook.com/NASA"20 },21 {22 "name": "cursor",23 "value": "eyJrIjoicGhvdG9zIiwiY29sIjoiWVhCd1gyTnZiR3hsWTNScGIyNDZjR1ppYVdRd00yNUtURUo0ZGs1U01WZzVTRTVFUkZseFp6aERNamN5UVdKWmRFcHJlbUpuZW5OMFEzbE9hR1pFVldOR05rNUtlRTQwVFdoSFIyNWpkRmszV1dsNE5VUmFiMFJRV1RoclJIbFdibEZpVEcxaE9UVm5jVGRTUms0NFRtUnMiLCJhZnRlciI6IkFRSFR4Tl81dXUtMGFtdDR5NzRYM0hQbGVncy1CSVI4X21MVUxRQnk3dFM3OXQtLWVBb2d1dnZXMGRhU0ZnMElXd1FZUHRUMHVVeHN5cWRmeVFXSktwM2ZudyIsInUiOiJodHRwczovL3d3dy5mYWNlYm9vay5jb20vTkFTQSJ9"24 }25 ]26 },27 "sendHeaders": true,28 "headerParameters": {29 "parameters": [30 {31 "name": "x-api-key",32 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"33 }34 ]35 }36 }37 }38 ],39 "connections": {}40}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_d901d6509f944c63019eab32",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "post",13 "platform": "facebook",14 "id": "1662377855257584",15 "url": "https://www.facebook.com/photo.php?fbid=1662377855257584&set=pb.100044561550831.-2207520000&type=3",16 "type": "image",17 "author": null,18 "title": null,19 "text": null,20 "published_at": null,21 "duration_seconds": null,22 "language": null,23 "hashtags": null,24 "mentions": null,25 "stats": {26 "views": null,27 "likes": null,28 "comments": null,29 "shares": null,30 "saves": null,31 "dislikes": null32 },33 "media": {34 "thumbnail_url": "https://scontent-ord5-2.xx.fbcdn.net/v/t39.99422-6/859947285_1150825193952429_7405308645209914641_n.png?stp=c228.0.1145.1145a_dst-jpg_tt6&cstp=mx1145x1145&ctp=s206x206&_nc_cat=104&ccb=1-7&_nc_sid=714c7a&_nc_ohc=upapdFU9i_EQ7kNvwHSJyVu&_nc_o...",35 "video_url": null,36 "audio_url": null,37 "image_urls": [38 "https://scontent-ord5-2.xx.fbcdn.net/v/t39.99422-6/859947285_1150825193952429_7405308645209914641_n.png?stp=c228.0.1145.1145a_dst-jpg_tt6&cstp=mx1145x1145&ctp=s206x206&_nc_cat=104&ccb=1-7&_nc_sid=714c7a&_nc_ohc=upapdFU9i_EQ7kNvwHSJyVu&_nc_o..."39 ],40 "width": 1600,41 "height": 114542 },43 "song": null,44 "location": null,45 "is_pinned": null,46 "is_sponsored": null,47 "extra": {48 "accessibility_caption": "Secretary Marco Rubio and Uzbekistan Foreign Minister Bakhtiyor Saidov smile at the camera against a background of American and Uzbekistan flags. They are both wearing suits and ties. They appear to be shaking hands while also holding up a...",49 "node_id": "YXBwX2l0ZW06MTAwMDQ0NTYxNTUwODMxOjIzMDUyNzI3MzI6NTo6MTY2MjM3Nzg1NTI1NzU4NA==",50 "source": "logged_out_public_view"51 }52 },53 {54 "object": "post",55 "platform": "facebook",56 "id": "1658876725607697",57 "url": "https://www.facebook.com/photo.php?fbid=1658876725607697&set=pb.100044561550831.-2207520000&type=3",58 "type": "image",59 "author": null,60 "title": null,61 "text": null,62 "published_at": null,63 "duration_seconds": null,64 "language": null,65 "hashtags": null,66 "mentions": null,67 "stats": {68 "views": null,69 "likes": null,70 "comments": null,71 "shares": null,72 "saves": null,73 "dislikes": null74 },75 "media": {76 "thumbnail_url": "https://scontent-ord5-1.xx.fbcdn.net/v/t39.99422-6/855339932_1777262476839819_3793054615548579050_n.png?stp=c0.119.1086.1086a_dst-jpg_tt6&cstp=mx1086x1086&ctp=s206x206&_nc_cat=106&ccb=1-7&_nc_sid=714c7a&_nc_ohc=3G0SXarMeMQQ7kNvwEcDfez&_nc_o...",77 "video_url": null,78 "audio_url": null,79 "image_urls": [80 "https://scontent-ord5-1.xx.fbcdn.net/v/t39.99422-6/855339932_1777262476839819_3793054615548579050_n.png?stp=c0.119.1086.1086a_dst-jpg_tt6&cstp=mx1086x1086&ctp=s206x206&_nc_cat=106&ccb=1-7&_nc_sid=714c7a&_nc_ohc=3G0SXarMeMQQ7kNvwEcDfez&_nc_o..."81 ],82 "width": 1086,83 "height": 144884 },85 "song": null,86 "location": null,87 "is_pinned": null,88 "is_sponsored": null,89 "extra": {90 "accessibility_caption": "The exhaust plumes from a SpaceX Falcon rocket are lit up by the Sun, creating a shape that looks like a jellyfish. The plumes are blue and red. There is a fuzzy, faint form below that would make the jellyfish's \"legs\".",91 "node_id": "YXBwX2l0ZW06MTAwMDQ0NTYxNTUwODMxOjIzMDUyNzI3MzI6NTo6MTY1ODg3NjcyNTYwNzY5Nw==",92 "source": "logged_out_public_view"93 }94 }95 ],96 "cursor": "eyJrIjoicGhvdG9zIiwiY29sIjoiWVhCd1gyTnZiR3hsWTNScGIyNDZjR1ppYVdRd00yNUtURUo0ZGs1U01WZzVTRTVFUkZseFp6aERNamN5UVdKWmRFcHJlbUpuZW5OMFEzbE9hR1pFVldOR05rNUtlRTQwVFdoSFIyNWpkRmszV1dsNE5VUmFiMFJRV1RoclJIbFdibEZpVEcxaE9UVm5jVGRTUms0NFRtUnMiLCJhZnRl...",97 "has_more": true,98 "parent": null99 },100 "cursor": "eyJrIjoicGhvdG9zIiwiY29sIjoiWVhCd1gyTnZiR3hsWTNScGIyNDZjR1ppYVdRd00yNUtURUo0ZGs1U01WZzVTRTVFUkZseFp6aERNamN5UVdKWmRFcHJlbUpuZW5OMFEzbE9hR1pFVldOR05rNUtlRTQwVFdoSFIyNWpkRmszV1dsNE5VUmFiMFJRV1RoclJIbFdibEZpVEcxaE9UVm5jVGRTUms0NFRtUnMiLCJhZnRl...",101 "has_more": true102}Response#
A list of Post objects in data.items, with data.cursor and data.has_more.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
unsupported_url | 400 | no | The URL is not one this endpoint accepts (wrong platform or form). |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
Every request can also fail with the account and platform errors listed on the Errors page.
Related endpoints#
- Facebook Ad Library search (
GET /v1/facebook/ad-library/search) - Facebook Ad Library search (POST body) (
POST /v1/facebook/ad-library/search) - Facebook Ad Library ads by page (
GET /v1/facebook/ad-library/company/ads) - Facebook Ad Library ads by page (POST body) (
POST /v1/facebook/ad-library/company/ads) - Facebook Ad Library ad details (
GET /v1/facebook/ad-library/ad) - Facebook Ad Library ad transcript (
GET /v1/facebook/ad-library/ad/transcript) - Facebook Ad Library advertiser search (
GET /v1/facebook/ad-library/search/companies) - Facebook profile or page (
GET /v1/facebook/profile)