Downloading Files Using Earthdata Download (EDL) Tokens

Users wishing to download via a browser simply need to log in and click links within the LAADS Archive. Scripted downloads will need to use Earthdata Download (EDL) tokens in order to be properly authorized.

EDL tokens are alphanumeric string values that identify who you are. Tokens get passed in the Authorization header of each HTTP GET request. See code samples below.

Requesting a Token

NOTE: EDL Tokens will expire after a set duration (currently 60 days) and a new token will need to be regenerated at that time.

  1. Login to the Earthdata Profiles Web Site.
  2. Select "Generate Token" from the top menu (right side). This will take you to the "Generate Bearer Token" page.
  3. If there is a table displayed, select the blue "Show Token" button.
  4. If there is no table, select the green "Generate Token" button near the bottom of the page, then the blue "Show Token" button.
  5. Copy the token from this table and store it somewhere safe and secure.
  6. If you lose your token or when your token expires, repeat the steps above to generate a replacement.

Or follow the steps in this tutorial to generate your own Earthdata token to access LAADS DAAC data.

How to use a Token

This example uses the curl command to make a request for the file on our web server at the URL https://ladsweb.modaps.eosdis.nasa.gov/PATH_TO_MY_FILE. Note that for curl to work correctly with Earthdata tokens, you must also tell it to follow redirects using the -L option and to forward session cookies from LAADSWeb to the Earthdata authorization site using the -b option.

curl -v -L -b session -H 'Authorization: Bearer MY_TOKEN' -C - 'https://ladsweb.modaps.eosdis.nasa.gov/PATH_TO_MY_FILE' > result

The example above passes your token via the Authorization HTTP header while utilizing the Bearer schema. When finished, the resulting download will be written to a file called “result” in whatever directory (folder) that you run the command.

The token located in the header is how LAADS identifies users. If the token is invalid, missing, or an -h is used instead of -H, the curl command will not work. The -v parameter tells curl to be verbose so extra information about the request and response will be printed out. If this extra information is not needed the -v parameter can be omitted, or use the --fail -sS options instead of the -v option to avoid all output on errors. This can help scripts run faster.

Curl is available for all current operating systems, including Linux, MacOS, and Microsoft Windows.

Note

  1. All characters in the command are important, including dashes, colons, and quotation marks
  2. Copy your token in place of the string MY_TOKEN
  3. Copy the path to the file you need in place of the string PATH_TO_MY_FILE
  4. Most LAADS DAAC file paths look like

    archive/allData/ARCHIVE SET/PRODUCT/YEAR/DAY_OF_YEAR/FILENAME

    An example of an existing file is below.

    https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/61/MOD02QKM/2007/018/MOD02QKM.A2007018.0055.061.2017245230407.hdf

    This path should return a MODIS Terra quarter kilometer (250 m) top of atmosphere reflectance product for year 2007, day-of-year 018 (i.e. January 18), from collection 61.

Last updated: November 9, 2021