Downloads & automation
Flat Data is updated daily. Download your packages from your BigDataCloud account, or fetch them from a script or scheduled job with your API key.
Access
To download a package, your account needs an active subscription that includes it. Subscribe to Compact, Network or Complete from your account, or to Compact and Network together as a bundle; each package comes under the Flat Data Standard Licence. To see what you have, open Database downloads in your account. Your API key is under Credentials; any server key works, except Location keys.
Download from your account
- Sign in at bigdatacloud.com/account.
- From your account dashboard, open Database downloads.
- Find the package (Compact, Network or Complete) and choose CSV or MMDB.
- Download the current release.
- Unzip the archive. Each package page lists its files.
Automated download
For scripts and scheduled jobs, request the package with your API key in the URL as key, just like an API call. We reply with a short-lived link to the ZIP, CSV by default or MMDB with format=mmdb, and curl -L follows it and saves the file in one command. Prefer not to put your key in URLs? Send it in the x-bdc-key header and download in two steps instead (below).
Request format
GET https://www.bigdatacloud.com/download?package={compact|network|complete}&format={csv|mmdb}&key={YOUR_API_KEY}| Parameter | Values | Notes |
|---|---|---|
package | compact,network,complete | Required. If you have Compact and Network together, download each one with its own request. |
format | csv,mmdb | Optional. Defaults to csv. |
key | Your API key | Required, unless you send the key in the x-bdc-key header. |
Authentication
Pass your API key as the key query parameter, exactly as you do for the API: &key=YOUR_API_KEY. We hide your key in our request logs. Prefer not to put the key in URLs? Send it in the x-bdc-key HTTP header instead (x-bdc-key: YOUR_API_KEY) and use the two-step download below. If both are present, the header is used.
Examples
CSV:
curl -fL -o bigdatacloud-compact-csv.zip "https://www.bigdatacloud.com/download?package=compact&format=csv&key=YOUR_API_KEY"-L follows the link and saves bigdatacloud-compact-csv.zip.
MMDB:
curl -fL -o bigdatacloud-complete-mmdb.zip "https://www.bigdatacloud.com/download?package=complete&format=mmdb&key=YOUR_API_KEY"This saves bigdatacloud-complete-mmdb.zip. See What each request returns for the files in each ZIP.
Prefer not to put the key in URLs?
Send the key in the x-bdc-key header and download in two steps: read the link from the Location header, then fetch it without your key.
CSV:
URL=$(curl -s -D - -o /dev/null -H 'x-bdc-key: YOUR_API_KEY' \
"https://www.bigdatacloud.com/download?package=compact&format=csv" \
| awk 'tolower($1)=="location:" { sub(/\r$/, "", $2); print $2 }')
curl -fo bigdatacloud-compact-csv.zip "${URL:?no download link: check the key and package}"The first command gets the download link; the second saves the ZIP without sending your key.
Don't add -L to this command: curl would send your key on with the download.
MMDB:
URL=$(curl -s -D - -o /dev/null -H 'x-bdc-key: YOUR_API_KEY' \
"https://www.bigdatacloud.com/download?package=complete&format=mmdb" \
| awk 'tolower($1)=="location:" { sub(/\r$/, "", $2); print $2 }')
curl -fo bigdatacloud-complete-mmdb.zip "${URL:?no download link: check the key and package}"What each request returns
Scheduled download
A daily job that fetches the current MMDB release, unzips it to a new folder and switches over when the download succeeds.
#!/bin/sh
# fetch-bigdatacloud.sh — run daily from cron, e.g. 30 3 * * * /opt/bdc/fetch-bigdatacloud.sh
set -eu
PACKAGE=compact
FORMAT=mmdb
DEST=/opt/bdc
NEW="$DEST/$PACKAGE-$FORMAT.$(date +%Y%m%d)"
mkdir -p "$DEST"
STAGE=$(mktemp -d "$DEST/$PACKAGE-$FORMAT.XXXXXX")
OLD=""
cleanup() {
if [ -n "$STAGE" ]; then
rm -rf "$STAGE"
fi
# A swap that stops before the new folder is in place puts the previous release back.
# Once the new folder is in place, drop the aside copy. Either way, no .old folder remains.
if [ -n "$OLD" ]; then
if [ -d "$NEW" ]; then
rm -rf "$OLD"
else
mv "$OLD" "$NEW"
fi
fi
}
trap cleanup EXIT
curl -fL -o "$STAGE/download.zip" \
"https://www.bigdatacloud.com/download?package=$PACKAGE&format=$FORMAT&key=$BDC_API_KEY"
unzip -q "$STAGE/download.zip" -d "$STAGE"
rm "$STAGE/download.zip"
# Only after the unzip succeeded: move today's folder aside, put the new release in its place, then point "current" at it
if [ -d "$NEW" ]; then
OLD="$NEW.old.$$"
mv "$NEW" "$OLD"
fi
mv "$STAGE" "$NEW"
STAGE=""
ln -sfn "$NEW" "$DEST/$PACKAGE-$FORMAT.current"
if [ -n "$OLD" ]; then
rm -rf "$OLD"
fi
OLD=""
trap - EXIT
# Remove releases more than 7 days old. The name is exactly eight digits, so an aside folder is not matched.
find "$DEST" -maxdepth 1 -name "$PACKAGE-$FORMAT.2[0-9][0-9][0-9][0-9][0-9][0-9][0-9]" ! -path "$NEW" -mtime +7 -exec rm -rf {} +Prefer not to put the key in URLs? Replace the curl -fL line with the header two-step. It still writes into the fresh temporary directory, so a second run the same day does not prompt:
URL=$(curl -s -D - -o /dev/null -H "x-bdc-key: $BDC_API_KEY" \
"https://www.bigdatacloud.com/download?package=$PACKAGE&format=$FORMAT" \
| awk 'tolower($1)=="location:" { sub(/\r$/, "", $2); print $2 }')
curl -fo "$STAGE/download.zip" "${URL:?no download link: check the key and package}"Readers that keep an MMDB file open need to reopen it to pick up the new release.
Updates
Each package is updated daily, and both formats come from the same release. Each ZIP's Manifest.csv gives the build time (Build Complete, GMT), the data timestamps and the row totals, then one row per other file in that ZIP, including NOTICE.txt where present, with its byte count. Updates are included in your subscription; refresh daily or on any schedule that suits you.
Need an earlier release? Contact support.
Check a download
To confirm a ZIP arrived complete and unchanged, compute its SHA-256 checksum and compare it with the expected one. We send the expected SHA-256 with every download, as lowercase hex in the X-Checksum-SHA256 response header. Save the headers while you download:
curl -fL -D headers.txt -o bigdatacloud-compact-csv.zip \
"https://www.bigdatacloud.com/download?package=compact&format=csv&key=YOUR_API_KEY"
grep -i x-checksum-sha256 headers.txtUsing the x-bdc-key header instead? Save the headers in the first step, then download the link from them:
curl -s -D headers.txt -o /dev/null -H 'x-bdc-key: YOUR_API_KEY' \
"https://www.bigdatacloud.com/download?package=compact&format=csv"
URL=$(awk 'tolower($1)=="location:" { sub(/\r$/, "", $2); print $2 }' headers.txt)
curl -fo bigdatacloud-compact-csv.zip "${URL:?no download link: check the key and package}"
grep -i x-checksum-sha256 headers.txtLinux, compute and compare in one step (paste the expected value; two spaces before the file name):
echo "<expected> bigdatacloud-compact-csv.zip" | sha256sum -c -It prints bigdatacloud-compact-csv.zip: OK when they match. To print the checksum only: sha256sum bigdatacloud-compact-csv.zip.
macOS:
echo "<expected> bigdatacloud-compact-csv.zip" | shasum -a 256 -c -It prints bigdatacloud-compact-csv.zip: OK when they match.
Windows PowerShell:
(Get-FileHash .\bigdatacloud-compact-csv.zip -Algorithm SHA256).Hash -eq '<expected>'It prints True when they match.
To read the expected value in PowerShell 7 while downloading, without sending your key on with the download:
$r = Invoke-WebRequest -Headers @{ 'x-bdc-key' = 'YOUR_API_KEY' } -MaximumRedirection 0 -SkipHttpErrorCheck `
-Uri "https://www.bigdatacloud.com/download?package=compact&format=csv"
$r.Headers['X-Checksum-SHA256']
Invoke-WebRequest -Uri ([string]$r.Headers['Location']) -OutFile bigdatacloud-compact-csv.zipIf the two values don't match, download the file again before you use it.
File formats
File conventions are the same for every package: see CSV conventions and MMDB conventions. Each package page lists its files and fields.
Questions about access or downloads? Contact support.