Once you learn the basics, optimize your API calls:
- API Rate Limiting - Different rate limits on the API and how to deal with them"
- Async Requests - How to use asynchronous requests for creating ads.
- Batch Requests - Batch your API calls for greater efficiency",
- Storing and retrieving objects - Campaign, ad set, and ad objects limit the number of each object allowed in an ad account. Manage objects around those limits.
- Error codes - Common error codes the API returns.
- eTags - Optimize your calls to only fetch data when it changed",
- Validation - Validation that occurs amongst the ad objects and parameters.
Keep these in mind as you work with Marketing API.
Paging Response Data
For paging response data, see the Graph API Pagination.
Storing User Information
You should store user IDs, session keys, and the ads account ID so it is easy to programmatically access them and keep them together. This is important because any calls made with an account ID belonging to one user and the session key for another user will fail with a permissions error.
Changes in Suggested Bids
Run frequent reports on your campaigns, as suggested bids change dynamically in response to bidding by competitors using similar targeting. Bid suggestions get updated within a few hours, depending upon the bidding of competitors.
Use Batch Requests
Make multiple requests to the API with a single call, see:
You can also query for multiple objects by ID as follows:
To query for a specific field:
Check Data Changes using ETags
Quickly check if the response to a request has changed since you last made it, see:
Set Object Archive and Delete Status
All ad objects have 2 types of delete states: archived and deleted. You can query objects in both archived and deleted state using the object id. However, deleted objects will not be returned if you request it from another object's edge.
You can have up to 5000 archived objects at any time. You should move ad objects from archived states to deleted states if you no longer need to retrieve them via edges. To learn how states work and for sample calls see Storing Ad Objects.
People make mistakes and try to create ads that are not accepted, Error Codes provide reasons an API call failed. You should share some form of the error to the user to allow them to fix their ads.
Facebook Marketing Developer Community Group
Sandbox mode is a testing environment that helps developers to create an ad account that is enabled for read and write Marketing API calls. However it doesn't actually deliver ads. See Sandbox Mode for Developers
You can also try API calls with Graph API Explorer. You can try any API call you would like to make to the Marketing API, see blog post. Select your app in
App grant your app
ads_read permission in
extended permissions when you create an access token. Use
ads_read if you only need Ads Insights API access for reporting information. Use
ads_management to read and update ads in an account.
Build an application that delivers valuable functionality beyond what Facebook offers through its own products, through good usage of Facebook's APIs.
Validate the need
Ensure the need can be readily associated with one of your organization's strategic goals or objectives. Provide an estimated return on investment (ROI) or added value, along with how ROI will be measured.
Businesses and agencies should work with existing marketing partners. Partnering instead of building is often a better alternative for a variety of reasons, such as the cost versus benefit of building.
Explain the business problems your application solves, your target audience and the market size for this solution. Facebook needs this information to understand your value.
Ability to support
It can take 6 to 9 months to develop on the platform in addition to the cost of hiring and developing talent. Assess your technical capabilities scope needed resources to determine if development on the API makes sense.
Consider your in-house skills for media buying such as your understanding of Facebook media, optimization, bidding, budgeting, creative skills and data analysis.
Understand and adhere to the Ads API policies; Facebook has the right to audit your activity anytime:
- Facebook's Platform Policies
- Facebook's Promotion Policies
- Facebook’s Data Use Policy
- Facebook’s Statement of Rights and Responsibilities
- Facebook's Advertising Guidelines
Be ready to adapt quickly to changes. Most changes are versioned and change windows are 90 days, ongoing.
In Statement of Rights and Responsibilities, you are financially and operationally responsible for your application, its contents, and your use of Facebook Platform and the Ads API. You should manage your app's stability and potential bugs.
Apps must meet basic criteria:
Demonstrate value beyond Facebook's core solutions, such as Facebook Ads Manager.
Focus on business objectives, such as increase in sales. Facebook business objectives can be found here.