This set of endpoints provide programmatic access to the downloadable files generated by a DYI (download your information) export job. DYI export jobs are initiated on the Download Workplace Data tab within the Admin Panel on Workplace.
This API is only available to developers using Custom Integrations. See the guide on Custom Integrations to learn more about setting up permissions and getting access tokens to call Workplace APIs.
Each DYI export job has a unique job ID, which is used as the endpoint path on Graph API for fetching information about that job. The export job endpoint payload contains references to DYI jobs that ran as part of that export job.
There will be one Company DYI job per export, and one User DYI job per user included in that export. For each DYI job you can retrieve the status and download file URLs for that job.
The object hierarchy for the Export Job API looks like this:
The DYI Export Job API endpoints require the Read Workplace company data exports permission.
/community/work_dyi_jobsFetch a list of IDs for export jobs that exist within the current community.
/{work_dyi_job_id}Fetch information about a single export job. The endpoint exposes a number of fields which you can use to inspect the progress status for the job, and edges for fetching the files generated for the export job.
| Field Name | Description | Data Type |
|---|---|---|
| The export job ID |
|
| The termination reason for any jobs that were aborted | |
| The Company data DYI job for this export | |
| The creation time for this export |
|
| The data types being fetched for this export | |
| The output format for DYI files included in this export | |
| The end time for the time range that this export should cover |
|
| The completion status for this export |
|
| The export quality for any media included in this export | |
| The end time for the time range that this export should cover |
|
| The total number of successfully completed jobs for this export |
|
The abort_reason field returns an enumerated value indicating why an export job was aborted.
The list of possible return values for this field may change, but below are some example values:
TARGET_NOT_VISIBLECANCELLED_BY_USERARCHIVE_TOO_BIGThe data_types field returns a list of enumerated values, each of which describes a type of data included in the export.
The list of possible return values for this field may change, but below are some examples of data type values that can be returned:
WORKPLACE_COMPANY_METADATA_GROUPSWORKPLACE_COMPANY_METADATA_USER_PROFILEWORKPLACE_COMPANY_METADATA_COMPANY_INFOSAVED_ITEMS_YOUR_ACTIVITYMESSENGER_V2POSTS_YOUR_ACTIVITYEVENTS_YOUR_ACTIVITYCOMMENTS_REACTIONS_YOUR_ACTIVITYREPORTED_PROBLEMS_YOUR_ACTIVITYGROUPS_YOUR_ACTIVITYWORKPLACE_SURVEYSWORKPLACE_KNOWLEDGE_LIBRARYWORKPLACE_NOTESPOLLS_YOUR_ACTIVITYPROFILE_PERSONAL_INFOFRIENDS_V2SEARCH_LOGGED_INFOSECURITY_AND_LOGIN_INFORMATION_VThe dyi_format field returns an enumerated value from the following list of possible values:
JSONHTMLNONEHTML_AND_JSONCSVThe media_quality field returns an enumerated value from the following list of possible values:
VERY_LOWLOWMEDIUMHIGHVERY_HIGH| Edge name | Description | Type |
|---|---|---|
| A list of files that can be downloaded for the current DYI job | List of DYI job objects |
/{dyi_job_id}Get information about the company or user job represented by dyi_job_id, as returned in the DYI job object on the company_job field or the list of DYI Job objects on the /user_dyi_jobs edge for a given export job ID.
Each DYI job object has a number of fields providing metadata about the job and a list of files that can be downloaded for that job.
| Field Name | Description | Data Type |
|---|---|---|
| The DYI job ID |
|
| The termination reason for any jobs that were aborted | |
| The creation time for this job |
|
| The data types being fetched for this job | |
| The end time for the time range that this job will cover |
|
| The completion state for the current job |
|
| The export quality for any media included in this export | |
| The start time for the time range that this job will cover |
|
| Edge name | Description | Type |
|---|---|---|
| A list of files that can be downloaded for the current DYI job | List of DYI File objects |
/{dyi_job_id}/filesGet a list of files that are available for download for the current DYI job specified in dyi_job_id.
Each item in the list is an object containing the fields id, download_url and file_size. The download_url URL can be used to directly download each file,
GET https://graph.workplace.com/{id}/files?fields=id,download_url,file_size
Below is an example of traversing the DYI Export Job API endpoints using a Python script, to generate a list of all files available for download.
This example code simply illustrates how to call the API. No caching, rate limiting, timeout recovery or pagination of results has been implemented. You should use it only as a guide to help you implement your own robust file download solution.
import requests
# Set your access token
access_token = "YOUR_ACCESS_TOKEN"
# Set the API endpoints
work_dyi_export_jobs_endpoint = f"https://graph.facebook.com/community/work_dyi_jobs?access_token={access_token}"
export_job_endpoint = lambda id: f"https://graph.facebook.com/{id}?fields=id,is_completed,company_job&access_token={access_token}"
user_dyi_jobs_endpoint = lambda id: f"https://graph.facebook.com/{id}/user_dyi_jobs?access_token={access_token}"
dyi_job_files_endpoint = lambda id: f"https://graph.facebook.com/{id}/files?access_token={access_token}"
# Fetch all DYI export jobs for the community
response = requests.get(work_dyi_export_jobs_endpoint)
work_dyi_jobs = response.json()
# Iterate through all DYI export jobs
for export_job in work_dyi_jobs["data"]:
# Only process completed jobs
if export_job["is_completed"] != True:
print(f"Skipping job {export_job['id']} because it is not completed")
continue
# Fetch the job details
response = requests.get(export_job_endpoint(export_job["id"]))
export_job_details = response.json()
# Fetch the company DYI job for the current export job
company_dyi_job = export_job_details["company_job"]
# Fetch the files for the company DYI job
response = requests.get(dyi_job_files_endpoint(company_dyi_job["id"]))
files = response.json()
# Iterate through all files
for file in files["data"]:
# Print the results (replace with your desired logic)
print(f"Export ID: {export_job['id']}, Job ID: {company_dyi_job['id']}, Job Type: Company, File ID: {file['id']}, File Size: {file['file_size']}, Download URL: {file['download_url']}")
# Fetch the user DYI jobs for the current job
response = requests.get(user_dyi_jobs_endpoint(export_job['id']))
user_dyi_jobs = response.json()
# Iterate through all user DYI jobs
for user_dyi_job in user_dyi_jobs["data"]:
# Fetch the files for the user DYI job
response = requests.get(dyi_job_files_endpoint(user_dyi_job["id"]))
files = response.json()
# Iterate through all files
for file in files["data"]:
# Print the results (replace with your desired logic)
print(f"Export ID: {export_job['id']}, Job ID: {user_dyi_job['id']}, Job Type: User, File ID: {file['id']}, File Size: {file['file_size']}, Download URL: {file['download_url']}")