You can fetch information about donations contributed to a Facebook fundraiser by using the get() method with the facebook/fundraisers/<id>/donations/preview path. This document describes the parameters and shows how to perform basic queries using the method.
Note: Only public donations (privacy set to "everyone") are included. The number of results can therefore be different from the actual number of donations contributed to the fundraiser overall.
All of the examples in this document are taken from a Secure Research Environment use case and assume you have already created a Python or R Jupyter notebook and have created a client object. See Getting started to learn more.
See Data dictionary for detailed information about the data fields that are returned.
| Parameter | Type | Description |
|---|---|---|
| String or Integer | Date in YYYY-MM-DD (date only) or UNIX timestamp (translates to a date and time to the second) format. Facebook donations contributed on or after this date or timestamp are returned (used with
|
| String or Integer | Date in YYYY-MM-DD (date only) or UNIX timestamp (translates to a date and time to the second) format. Facebook donations contributed on or before this date or timestamp are returned (used with
|
Fetching information about donations made to a specific Facebook fundraiser requires that you first obtain the Meta Content Library ID for the fundraiser by using the get() method with the search/facebook_fundraisers path. The search results will include the ID field by default (you don't have to specify it in your query). See Guide to Facebook fundraisers data to learn about this method. Meta Content Library IDs are unique IDs, each linked to an entity in Meta Content Library. These IDs cannot be used to search on Meta technologies.
Once you have the fundraiser ID, you can use it in the get(path=<fundraiser_id>/donations) method to fetch the donations information.
The following example would return 10 results per page. You can keep calling query_next_page() and has_next_page() to get the next page of 10 results, until all the query results have been returned.
library(reticulate)
client <- import("metacontentlibraryapi")$MetaContentLibraryAPIClient
client$set_default_version(client$LATEST_VERSION)
# Fetch first 10 donations
response <- client$get(path="<fundraiser-id>/donations/preview")
jsonlite::fromJSON(response$text, flatten=TRUE)
# Fetch next page
if (client$has_next_page(response)) {
response <- client$query_next_page(response)
jsonlite::fromJSON(response$text, flatten=TRUE) # Display second page
}To have the API return donations within a specific time and date range, create a donations fetch call and pass the since and until parameters you want included.
library(reticulate)
client <- import("metacontentlibraryapi")$MetaContentLibraryAPIClient
client$set_default_version(client$LATEST_VERSION)
# Will fetch donations that were created after 2025-04-13,
# but before 1713139200 (epoch timestamp of "2025-04-15 12:00:00 AM")
# Both formats (date and UNIX timestamp) are allowed
response <- client$get(
path="facebook/fundraisers/<id>/donations/preview",
params=list("since"="2025-04-13", "until"="1713139200")
)
jsonlite::fromJSON(response$text, flatten=TRUE) # Display first page