The API is based on the query language GraphQL. This language is used by Facebook for its APIs, so it is the best way to mimic Graph API. You can get more info by the following links:
Relay Cursor Connections Specification
It is a set of communication protocols and methods that allows you to form queries to get information on Facebook profiles. Also, it allows you to search for Facebook posts using keywords. Search results can be filtered by location or time period.
The data could be a ground for social media listening, influencer monitoring, customer experience analytics, social media KPIs evaluation, sentiment analysis, competitor benchmarking, brand monitoring, etc.
To learn more, please check our developer documentation and contact us.
We use Graph API style for requests. API accepts only GET requests. The access token is provided by us. Facebook API request takes the following form:
https://api.singularex.com/facebook/
<node-type>/<node-ID>
?fields=<graph-request>
&access_token=<your_access_token>
https://api.singularex.com/facebook/
search/<keywords>
?<search-filters>
&fields=<graph-request>
&access_token=<your_access_token>
https://api.singularex.com/facebook/
profile/<profile-ID>
?fields=<graph-request>
&access_token=<your_access_token>
https://api.singularex.com/facebook/
post/<post-ID>
?fields=<graph-request>
&access_token=<your_access_token>
https://api.singularex.com/facebook/
comment/<comment-ID>
?fields=<graph-request>
&access_token=<your_access_token>
https://api.singularex.com/facebook/
reply/<reply-ID>
?fields=<graph-request>
&access_token=<your_access_token>
Certain parameters are required while others are optional. As is standard in URLs, all parameters are separated using the ampersand (&) character.
To enable loading for comments and replies add &load_comments=1 to your query string*.
*Please note that loading a large number of comments may slow down the return response.https://api.singularex.com/facebook/
profile/<profile-ID>
?fields=<graph-request>
&access_token=<your_access_token>
{
profile: FacebookProfile {
id: ID
username: String
full_name: String
profile_type: String
profile_thumb_url: String # the biggest available pic
profile_thumb_big_url: String # 50px
profile_thumb_medium_url: String # 32px
profile_thumb_small_url: String # 25px
address: String
latitude: Real
longitude: Real
phone: String
external_url: String
like_count: Int
follower_count: Int
friend_count: Int
member_count: Int
last_update: Int # UNIX timestamp
is_being_updated: Boolean
posts: FacebookPostConnection {
page_info: PageInfo {
has_next_page: Boolean
has_previous_page: Boolean
start_cursor: String
end_cursor: String
}
edges: Edges {
node: FacebookPost {
...
# Same fields as in the facebook.post
...
}
}
}
}
}
https://api.singularex.com/facebook/
profile/176221562420244
?fields=id,full_name,profile_type,last_update
&access_token=<your_access_token>
{
"error": {},
"data": {
"id": "176221562420244",
"full_name": "George W. Bush",
"profile_type": "page",
"last_update": 1559311418
},
"status": "ok"
}
All filters must be sent as separate GET-params in request URL, for example:
&from_date=2019-06-20&to_date=2019-06-25 or
&from_timestamp=1540000000&to_timestamp=1550000000
To enable loading for comments and replies add &load_comments=1 to your query string*.
*Please note that loading a large number of comments may slow down the return response.https://api.singularex.com/facebook/
post/<post-ID>
?fields=<graph-request>
&access_token=<your_access_token>
{
post: FacebookPost {
id: ID
post_type: String
created_time: Datetime # ISO 8601 format
timestamp: Int # UNIX timestamp
text: String
tagged_user_text: [ID]
tags: [String]
link: String
link_description: String
attached_post_id: ID
attached_media_id: [ID]
attached_media_preview_url: [String]
attached_media_preview_content: [String]
image_url: String
image_content: String
video_preview_url: String
reaction_count: Int
reaction_like_count: Int
reaction_love_count: Int
reaction_haha_count: Int
reaction_wow_count: Int
reaction_sad_count: Int
reaction_angry_count: Int
share_count: Int
video_view_count: Int
last_update: Int # UNIX timestamp
is_being_updated: Boolean
owner: FacebookNodeOwner {
...
# Same fields as in the in reply.owner
...
}
comments: FacebookCommentConnection {
page_info: PageInfo {
has_next_page: Boolean
has_previous_page: Boolean
start_cursor: String
end_cursor: String
}
edges: Edges {
node: FacebookComment {
...
# Same fields as in the facebook.comment
...
}
}
}
}
}
https://api.singularex.com/facebook/
post/2764325700276471
?fields=id,post_type,created_time,text,timestamp,tagged_user_text,tags,
reaction_count,reaction_like_count,reaction_love_count,reaction_haha_count,
reaction_wow_count,reaction_sad_count,reaction_angry_count,share_count,
comments.first(3){edges{node{id,timestamp,created_time}}}
&load_comments=1
&access_token=<your_access_token>
{
"error": {},
"data": {
"id": "2764325700276471",
"post_type": "image",
"created_time": "2019-05-27T17:14:30",
"text": "Enjoyed a great ride honoring the fallen this morning with fellow grateful citizens, veterans, and first responders.",
"timestamp": 1558977270,
"tagged_user_text": [],
"tags": [],
"reaction_count": 34000,
"reaction_like_count": 34000,
"reaction_love_count": 4300,
"reaction_haha_count": 0,
"reaction_wow_count": 66,
"reaction_sad_count": 0,
"reaction_angry_count": 0,
"share_count": 1000,
"comments": {
"edges": [
{
"node": {
"id": "2764462670262774",
"timestamp": 1558915200,
"last_update": 1559318406,
"is_being_updated": false,
"created_time": "2019-05-27T00:00:00"
}
},
{
"node": {
"id": "2764427323599642",
"timestamp": 1558915200,
"last_update": 1559318406,
"is_being_updated": false,
"created_time": "2019-05-27T00:00:00"
}
},
{
"node": {
"id": "2764331096942598",
"timestamp": 1558915200,
"last_update": 1559318406,
"is_being_updated": false,
"created_time": "2019-05-27T00:00:00"
}
}
]
}
},
"status": "ok"
}
To enable loading for comments and replies add &load_comments=1 to your query string*.
*Please note that loading a large number of comments may slow down the return response.https://api.singularex.com/facebook/
search/<keywords>
?<search-filters>
&fields=<graph-request>
&access_token=<your_access_token>
{
search: FacebookSearch {
id: ID
request: String
location_id: ID
author_id: ID
from_date: Datetime # ISO 8601 format
to_date: Datetime # ISO 8601 format
post_count: Int
last_update: Int # UNIX timestamp
is_being_updated: Boolean
posts: FacebookPostConnection {
page_info: PageInfo {
has_next_page: Boolean
has_previous_page: Boolean
start_cursor: String
end_cursor: String
}
edges: Edges {
node: FacebookPost {
...
# Same fields as in the facebook.post
...
}
}
}
}
}
https://api.singularex.com/facebook/
search/skoda
?fields=id,request,post_count,last_update,is_being_updated,
posts.first(1){edges{node{id,created_time,text,owner{id,full_name}}}}
&location_id=109524955741121
&access_token=<your_access_token>
{
"error": {},
"data": {
"id": "skoda/109524955741121/null/null/null/null",
"request": "skoda",
"post_count": 100,
"last_update": 1559308781,
"is_being_updated": false,
"posts": {
"edges": [
{
"node": {
"id": "428788844338759",
"timestamp": 1559300403,
"last_update": 1559308936,
"is_being_updated": false,
"created_time": "2019-05-31T11:00:03",
"text": "Design That Moves!! The ŠKODA RAPID is a masterpiece in design. It stays loyal to the brand’s timeless design ideas while simultaneously incorporating avant-garde elements. For details ☎️ : 7902455555 Visit us at: www.malayalammotorsskoda.co.in #Skoda #Rapid #malayalamSKODA #SkodaDealers",
"owner": {
"id": "195128237704822",
"full_name": "Malayalamskoda"
}
}
}
]
}
},
"status": "ok"
}
https://api.singularex.com/facebook/
comment/<comment-ID>
?fields=<graph-request>
&access_token=<your_access_token>
For correct operation of endpoints /comment and /reply, primarily make a request to download posts containing these comments and replies. You can do this with the endpoints described above (/profile, /post & /search). Please note that to enable the loading of comments and replies you need add &load_comments=1 to your query string*.
{
comment: FacebookComment {
id: ID
parent_id: ID
created_time: Datetime # ISO 8601 format
timestamp: Int # UNIX timestamp
text: String
reaction_count: Int
owner_username: String
owner_full_name: String
last_update: Int # UNIX timestamp
is_being_updated: Boolean
replies: FacebookCommentReplyConnection {
page_info: PageInfo {
has_next_page: Boolean
has_previous_page: Boolean
start_cursor: String
end_cursor: String
}
edges: Edges {
node: FacebookCommentReply {
...
# Same fields as in the in facebook.reply
...
}
}
}
}
}
https://api.singularex.com/facebook/
comment/2764331133609261
?fields=id,parent_id,created_time,timestamp,text,
reaction_count,owner_username,owner_full_name,
replies{edges{node{id,timestamp,created_time}}}
&access_token=<your_access_token>
{
"error": {},
"data": {
"id": "2764331133609261",
"parent_id": "2764325700276471",
"created_time": "2019-05-27T00:00:00",
"timestamp": 1558915200,
"text": "You never know what ya got, til it's gone. We miss ya Mr. President",
"reaction_count": 17,
"owner_username": "ken.boyer.5",
"owner_full_name": "Ken Boyer",
"replies": {
"edges": [
{
"node": {
"id": "2764697680239273",
"timestamp": 1558915200,
"last_update": 1559318406,
"is_being_updated": false,
"created_time": "2019-05-27T00:00:00"
}
},
{
"node": {
"id": "2764595820249459",
"timestamp": 1558915200,
"last_update": 1559318406,
"is_being_updated": false,
"created_time": "2019-05-27T00:00:00"
}
}
]
}
},
"status": "ok"
}
https://api.singularex.com/facebook/
reply/<reply-ID>
?fields=<graph-request>
&access_token=<your_access_token>
{
reply: FacebookCommentReply {
id: ID
parent_id: ID
created_time: Datetime # ISO 8601 format
timestamp: Int # UNIX timestamp
text: String
tags: [String]
reaction_count: Int
owner_username: String
owner_full_name: String
last_update: Int # UNIX timestamp
is_being_updated: Boolean
}
}
https://api.singularex.com/facebook/
reply/2764595820249459
?fields=id,parent_id,created_time,timestamp,text,tags,reaction_count,
owner_username,owner_full_name,last_update,is_being_updated
&access_token=<your_access_token>
For correct operation of endpoints /comment and /reply, primarily make a request to download posts containing these comments and replies. You can do this with the endpoints described above (/profile, /post & /search). Please note that to enable the loading of comments and replies you need add &load_comments=1 to your query string*.
{
"error": {},
"data": {
"id": "2764595820249459",
"parent_id": "2764331133609261",
"created_time": "2019-05-27T00:00:00",
"timestamp": 1558915200,
"text": "Ken Boyer. That was George Bush Sr. This is Jr.",
"tags": [],
"reaction_count": 0,
"owner_username": "shareen.lasher",
"owner_full_name": "Shareen Banagan",
"last_update": 1559318406,
"is_being_updated": false
},
"status": "ok"
}
To get next pages use page_info’s fields has_next_page, has_previous_page, start_cursor, end_cursor. You can get more info by following the link: Relay Cursor Connections Specification
The has_next_page and has_previous_page values are false in the case when your request displays all available posts. The following endpoints should only be used with restrictions such as posts.first(5) or posts.last(10).
For example, to get the next 5 posts, use the value end_cursor in the endpoint such as posts.first(5).after(“end_cursor”). The end_cursor value is taken from the previous request such as posts.first(5).
To get the previous 5 posts, use the value start_cursor in the endpoint such as posts.last(5).before(“start_cursor”). The start_cursor value is taken from the previous request such as posts.last(5).
https://api.singularex.com/facebook/
search/mather
?search_type=latest
&fields=id,posts.first(2){
page_info{has_next_page,start_cursor,end_cursor},
edges{node{id}}}
&access_token=<your_access_token>
{
"error": {},
"data": {
"id": "mather/null/null/null/null/latest",
"posts": {
"page_info": {
"has_next_page": true,
"start_cursor": "YXJyYXljb25uZWN0aW9uOjA=",
"end_cursor": "YXJyYXljb25uZWN0aW9uOjE="
},
"edges": [
{
"node": {
"id": "2533998059964353",
"timestamp": 1560429297,
"last_update": 1560429529,
"is_being_updated": false
}
},
{
"node": {
"id": "2939623566110507",
"timestamp": 1560429234,
"last_update": 1560429533,
"is_being_updated": false
}
}
]
}
},
"status": "ok"
}
https://api.singularex.com/facebook/
search/mather
?search_type=latest
&fields=id,posts.first(2).after("YXJyYXljb25uZWN0aW9uOjE="){
page_info{has_next_page,start_cursor,end_cursor},
edges{node{id}}}
&access_token=<your_access_token>
{
"error": {},
"data": {
"id": "mather/null/null/null/null/latest",
"posts": {
"page_info": {
"has_next_page": true,
"start_cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"end_cursor": "YXJyYXljb25uZWN0aW9uOjM="
},
"edges": [
{
"node": {
"id": "724039951400055",
"timestamp": 1560429083,
"last_update": 1560429530,
"is_being_updated": false
}
},
{
"node": {
"id": "1580365332095220",
"timestamp": 1560428633,
"last_update": 1560429528,
"is_being_updated": false
}
}
]
}
},
"status": "ok"
}
Responses are encoded in JSON format and have 3 fields: status, data, and error.
https://api.singularex.com/facebook/
search/london
?fields=post_count
&access_token=<your_access_token>
{
"error": {},
"data": {
"post_count": 103
},
"status": "ok"
}
RequestAccepted (HTTP response: 202 Accepted)
Cannot find the requested node in a cache. Starting the parsing process. Repeat request later.
{
"error": {
"message": "Some nodes you requested are being loaded now: 12345. Try again later",
"type": "RequestAccepted"
},
"data": {},
"status": "accepted"
}
InvalidRequestError (HTTP response: 400 Bad Request)
The graph request is invalid. Repeat request later
{
"error": {
"message": "Cannot query field \"id_\" on type \"Media\". Did you mean \"id\"?",
"type": "InvalidRequestError"
},
"data": {},
"status": "InvalidRequestError"
}
AuthenticationError (HTTP response: 403 Forbidden)
The access token examination has failed. The access token is not provided or invalid.
{
"error": {
"message": "Invalid access token",
"type": "AuthenticationError"
},
"data": {},
"status": "AuthenticationError"
}
NodeNotExistsError (HTTP response: 404 Not Found)
A page for the requested node does not exist or cannot be loaded.
{
"error": {
"message": "Some nodes you requested cannot be loaded: 1690",
"type": "NodeNotExistsError"
},
"data": {},
"status": "NodeNotExistsError"
}
InternalServerError (HTTP response: 500 Internal Server Error)
Something was wrong on our side.
{
"error": {
"message": "Internal server error",
"type": "InternalServerError"
},
"data": {},
"status": "InternalServerError"
}