Schedule Data Feed Uploads

Enable More Frequent Data Feed Fetches

When you enable the Automatically upload new versions option for your scheduled feed, your data feed file is uploaded whenever we detect the file has changed.

We use the following HTTP headers to detect whether the file has changed:

  • If your server provides an ETag header in the HTTP response, we send the If-None-Match header in the next HTTP request with the entity tag from the ETag header.
  • If your server provides a Last-Modified header in the HTTP response, we send the If-Modified-Since header in the next HTTP request with the timestamp from the Last-Modified header.

If your server returns the following HTTP status codes:

  • 304 Not Modified — We consider the file to be unchanged since the last feed file fetch.
  • 200 OK — The feed file will be uploaded.

Example - ETag header

When we download your feed file, your server provides the ETag header with the feed file hash in the HTTP response:

ETag: "9fc22f3c8e9ab7ff8b7ebd0b3e34cb42bb2f9b22"

In the next HTTP request, we provide the If-None-Match header with the same entity tag:

If-None-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"

If your server returns the following HTTP status codes:

  • 304 Not Modified — We consider the file to be unchanged since the last feed file fetch.
  • 200 OK — The feed file will be uploaded.

Example - Last-Modified header

When we download your feed file, your server will provide the Last-Modified header with the timestamp of the last feed file change in the HTTP response:

Last-Modified: Thu, 15 Aug 2019 18:24:03 GMT

In the next HTTP request, we provide the If-Modified-Since header with the same timestamp:

If-Modified-Since: Thu, 15 Aug 2019 18:24:03 GMT

If your server returns the following HTTP status codes:

  • 304 Not Modified — We consider the file to be unchanged since the last feed file fetch.
  • 200 OK — The feed file will be uploaded.

Schedule Data Feed Fetches

Scheduled feeds don't support uploads more frequently than once per hour. If you need to update inventory faster, we recommend to use the Direct Upload API.

If you're using our API to create and manage your feeds, you need to send us an API request with details for the update schedule you want to create:

curl \
  -F 'name=Test Feed' \
  -F 'update_schedule={ 
    "interval": "HOURLY", 
    "url": "http:\/\/www.example.com\/sample_feed_updates.tsv",
    "hour": 22
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<API_VERSION>/<CATALOG_ID>/product_feeds

We fetch item feeds from your system on a schedule you define. There are two types of schedules you can define:

  • update_schedule — The uploads create new items or update existing ones with the information provided in the data feed file.
  • schedule — The uploads result in a complete refresh operation on your data feed. We delete items not present in the file, update existing ones, and create new ones. You can use either of the schedules, or both, depending on your needs.

For example: update_schedule with frequency HOURLY and a replace schedule with frequency DAILY.

We recommend setting up an update_schedule with only changed data in the data feed file for faster processing of feed. This is particularly better for holiday sales and faster price and availability updates. It's also recommended to mark items as "out of stock" rather than deleting from the feed so that we can retarget the user with similar available items.

curl \
  -F 'name=Test Feed' \
  -F 'schedule={ 
    "interval": "DAILY", 
    "url": "http:\/\/www.example.com\/sample_feed.tsv"
  }' \
  -F 'update_schedule={ 
    "interval": "HOURLY", 
    "url": "http:\/\/www.example.com\/sample_feed_updates.tsv",
    "hour": 22
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<API_VERSION>/<CATALOG_ID>/product_feeds

Response:

{ "id" : {FEED_ID} }

See Data Feed Reference, Data Feed Schedule Reference.

Perform One-Time Direct Upload

Along with scheduled feed fetches, you can manually perform one-time uploads.

Example — Feed files hosted on a public location

curl \
  -F "url=http://www.example.com/sample_feed.xml" \
  -F "access_token={ACCESS_TOKEN}" \
  https://graph.facebook.com/{API_VERSION}/{FEED_ID}/uploads

Example — Uploading feed files directly from the local machine. The path to the file needs to be changed according to your use case.

curl \
  -F "file=@catalog.csv;type=text/csv" \
  -F "access_token={ACCESS_TOKEN}" \
  https://graph.facebook.com/{API_VERSION}/{FEED_ID}/uploads

Optionally, you can set update_only to true. We create new items and update existing ones, but don't delete items from the feed. You only need to provide id to update existing items. This reduces time to fetch and process your file.

For example, to update only price and custom labels for 100 items in a feed, use direct upload. Provide a file with only id, price and custom_label_0 for those items and update_only set to true. We support all listed file formats; the most common ones are TSV and CSV. See Supported Feed Formats for more information.

See Feed Format per Use Case, Reference.

Learn More