Black Friday Sale
Language:

Everything about Facebook API: how to get and use it

Do you want to know how to get and integrate Facebook content into your website or app? We’ve made a research and compiled a detailed Facebook API tutorial to give answers to the questions asked by many.
Try Free Widget in Demo
Share:
Share on Facebook
Share on X
Share on LinkedIn
Share on WhatsApp
Copy Link
Everything about Facebook API: how to get and use it

What is Facebook API?

Facebook API is a bundle of solutions used as a primary way to get data in and out of the platform. It enables developers and app users to access the functionality of this network: user information, photos and videos, messages and more.

BONUS: Create your Facebook Feed widget in a couple of minutes!

How to get Facebook API key.

If you want to get access to the Facebook API key, you should register or sign up with your existing Facebook account on the developers portal and approve your identity. This will take just some simple following steps:

  • Step 1. Log in or create an account

    Go to the Facebook portal for developers and click “Log in”. You can log in with your existing Facebook account or create a new one

    Sign up on Facebook Dveloper API
  • Step 2. Get started

    When you find yourself inside the service, press “Get started” in the right upper corner of the main page

    Get started with Facebook Dveloper API
  • Step 3. Verify your account

    To start working with the developers tools, you have to approve your account. Press “Next” in the popup that shows up

    Facebook Dveloper form

    You can verify your account using your phone number or credit card. To make it via a phone number, pick your country in the drop-down menu, enter your phone with the country code and click “Send as Text”. Enter the acquired code into the field and click “Verify”

    Verify Facebook Dveloper account
  • After the successful approval of your account you will be proposed to read some documentation or continue to create your first app. We strongly recommend getting acquainted with the docs first.
  • Step 4. Create your app

    Then the service will offer you to create your first app. All the Facebook APIs and Apps stats are tracked in the Developers Dashboard, and it can’t be accessed without creating an app.

    Create your Facebook Dveloper application
  • Step 5. Add the Apps or Generate Access Tokens for your own needs

    The easiest and most convenient way to use Facebook APIs is to add the Apps right in the Dashboard. Simply choose the one that corresponds to your needs.

    Facebook applications

    Go to Tools – Graph API Explorer to generate Access Tokens for various kinds of API that you would like to use in your app. Choose the app and kind of token you need in the drop down menus in the left part of the screen. Then click “Generate Access Token”. You’re going to have to approve the access of the app to your page.

    Facebook Graph API
  • With this kind of API you will be able to display your business account or page content on a website or app.

How to use Facebook API Examples

The main product is the Graph API, that serves as a base for all other kinds of Facebook APIs, They are in essence extensions of Graph API, and all of the Facebook products interact with it in some way.

What use can you make of the Facebook developers console and the products provided there? There are plenty of ways to upgrade your website or app using the content and some of the functionalities of this social platform. 

You can display various kinds of social media content – posts, pictures, videos – on your website or app to engage and entertain the users. 

But keep in mind that when the Graph API is implemented to be used by other users, they will also have to approve first in a popup. Only after a user authorizes, the application will get an access token from this user and will be able to use his or her information from Facebook profile. 

Facebook API limits

Remember that every API type always has limitations. Graph API queries made within the app access token are counted against that application rate limit. Each app’s call count is the amount of requests it can make during a one hour window and is calculated as follows:
Calls within one hour = 200 * Number of App Users

Facebook API Integration

The platform provides several ready made solutions for non-developers on the basis of its Graph API. All the Facebook apps and API are in essence a set or collection of Graph API nodes. This means, you still have to complete Steps 1-3 described above to create an account and get access to the dashboard. Below we describe the most commonly used Facebook standard API applications.

Facebook Feed API Types

Facebook Page API

This type of API allows access to a page’s settings, content, and metrics. It enables you to create and display posts, comments from a page, page owned content and more. The full details can be found in the Pages API Documentation. Don’t forget you need a token from an app user who owns or can perform a required task on the page.

Facebook Video API

There are two types provided by Facebook – Video API and Live Video API. Both of these post videos on a page, group or event administered by an app user. Video API is intended on publishing short and long videos on a single or multiple pages and groups. Live Video API, in its turn, is used for scheduling a live broadcast, streaming a video at a user profile, group, or event and also interacting with the watching audience. And of course you need pages, groups, or events access tokens or a combination of them depending on where you want to place your video or live stream.

Facebook API Events

This kind of API is also presented as the Graph API functionality, but is only available for Facebook Marketing Partners. It also requires an access token from the admin of Event or a Group that created this Event.

Facebook News Feed API

You have two options of getting access to and using Facebook news feed. The described Graph API gives an opportunity to access a separate User Feed of status updates and get posts API and links published by the user or other person on the profile. You can read more about it here.

There’s also a Public Feed API, which makes it possible to display the content marked as ‘Public’ on the third-party service or website. But this kind of API key is granted only to approved media publishers, so you have to apply first.

You don’t need Facebook Group API to display its content on your website. Use Facebook Feed widget! With it you have full control over the content you need.

Facebook Community API

Facebook Comment API

Access to the comments on Facebook can be obtained through Graph API. As the comments can be left under various types of content, you have to get access to an object to work with the comments on it.

Facebook Reviews API

This part of Graph API represents objects that contain a recommendation. The default fields include date, star rating, review text, user information, and ‘positive’ or ‘negative’ badge.

If you wish to have more control over the reviews displayed, you can adjust the Review Plugin according to your preferences.

Facebook Tools APIs

Facebook Login API

Facebook API login example can be seen on many web-services that require registration. This provides users a fast and secure way to log into a website or an app. This API collects users’ access tokens to get their profile information, which is possible only after user approval. If you want to use this kind of API you have to get your app reviewed and approved by the Facebook administration.

Facebook Places API

Places Graph is a separate Facebook solution available for Android and iOS platforms only. With it your app can get the information about users current location. It also enables search for and discovery of places, location sharing, and geo tagging. Places API also requires getting access tokens from users. To integrate and start working with places API, you have to get Facebook SDK for your app first.

Facebook Payments API

The payment API includes the details of a payment made in a certain app. These payments are created in Facebook payments and proceeded on the basis of the platform. This type of API also requires an access token for an app that creates a payment.

Facebook Messenger API

Messenger API is an app which enables you to organize a conversation channel on your website by the means of Facebook Messenger. The Messenger API solution also allows a developer to build guided conversation with users. This way the messenger can answer a user automatically using Send API (also called Facebook Bot API), which sends webhooks to the url of the server, where the messenger is hosted.

Stay connected with your clients and website audiencewith a free and easy to install Messenger Button!

Facebook marketing API Types

Facebook Ads API

Marketing API is a bunch of Graph API endpoints that help to optimize advertising on Facebook. Facebook Ads API enables users to create and manage ad campaigns, sets of ads, and separate ad units.

Facebook Marketplace API

Currently there are only Vehicles and Real Estate categories on Facebook Marketplace. To access this section of Facebook platform, you have to create a developer account and verify your business. This solution offers to use Lead API together with developer webhooks for better performance. For it you have to create your app as was described earlier in this article and submit it for Review to get it approved by Facebook.

Facebook Analytics API

This solution helps to track and optimize the behaviour and journey of your customers from mobile, web, bots, offline, and other resources. To implement it you have to integrate Facebook SDK into your app or website. You can learn more in the Analytics Help Centre.

Facebook Business Manager API

This kind of API helps to manage multiple Pages, ads accounts and applications in one place. In Business Manager you can connect business assets and permissions for permission management, running campaigns on behalf of a company, creating advertising accounts and buying ads.

Latest API Changes

Facebook API changes include versioned changes – the ones that are introduced with the release of a new API version. There are also non-versioned changes that are introduced outside the normal releases. To upgrade to a higher Facebook API version there is a special API Upgrade Tool.

The latest version is v8.0 freshly released in August of 2020. It now features: 

  • app types – Business, Gaming, and None
  • getting Likes for Live Videos
  • Product Template in Messenger for Shops to send products as messages

The previous version v7.0 released in May 2020 will be available until August 2022.

Facebook API Status and Errors

The current Platform statue is healthy since October 1 2020. But the requests made sometimes result in various Facebook API error responses with the respective error codes. For example, Facebook API error 400 – Bad request – means that a query is no longer suppoted and you need a new access token to be generated. Here are some other:

CodeName
102API Session
1API Unknown
2API Service
3API Method
4API Too Many Calls
17API User Too Many Calls
10API Permission denied
190Access Token has expired
200-299API Permission (Multiple values depending on permission)
341Application limit reached
368Temporarily blocked for policies violations
506Duplicate post
1609005Error Posting Link


Facebook Api Documentation

The documentation of all the kinds of Facebook developer APIs can be found in the Docs section of Facebook developers portal. The full list of Graph API root nodes can be found in the Facebook API Reference section. Each API documentation includes a short tutorial on the permissions required, and also how to use and implement it. It can be found in the ‘Getting Started’ and ‘Guides’ sections of each specific documentation.

Black Friday Sale
50% OFF
The Biggest Sale of the Year. Don't Miss Out!
Grab The Deal