Datastore API
The Netlas Datastore API offers access to a broad range of network-related datasets, published on the Netlas Datastore.
At this moment, the Netlas SDK doesn’t support datastore access. Therefore, all examples below use direct access to the Netlas web-app API.
Listing Datasets
Anyone can list available datasets by making a GET request to the /datastore/products/
endpoint. This endpoint does not require authentication.
import requests
# Accessing API endpoint
response = requests.get('https://app.netlas.io/api/datastore/products/')
data = response.json()
# Sorting data by 'priority'
sorted_data = sorted(data, key=lambda x: (x['data_category']['priority'], x['priority']))
for product in sorted_data:
print(f"{product['id']}\t{product['datasets'][0]['added_dt'][:10]}\t{product['pretty_name']}")
Downloading Datasets
The payment mechanism is solely implemented within the web application; therefore, downloading a dataset via the API is only feasible if it is available to you at no additional cost.
Several datasets are provided free of charge to all Netlas users and can be readily downloaded via the API.
Furthermore, users subscribed to the Corporate and Enterprise pricing plans have access to all datasets without any extra fees. For these users, all datasets are available for download through the API.
#!/bin/bash
# Define the API key and Dataset ID
api_key="YOUR_API_KEY"
dataset_id=28
url="https://app.netlas.io/api/datastore/get_dataset_link/${dataset_id}/"
# Make the GET request and format the JSON response
curl -s -H "X-API-Key: ${api_key}" "${url}" | jq '.'
[
{
"pretty_name": "Known PTR records (rDNS)",
"name": "known_ptr_records",
"links": [
{
"ext": "json",
"link": "https://app.netlas.io/storage/known_ptr_records/known_ptr_records.json.zip?md5=MD5Value&expires=1716979209"
},
{
"ext": "csv",
"link": "https://app.netlas.io/storage/known_ptr_records/known_ptr_records.csv.zip?md5=MD5Value&expires=1716979209"
}
]
}
]
import requests
import json
# Define the API key and Dataset ID
api_key = 'YOUR_API_KEY'
dataset_id = 28
url = f'https://app.netlas.io/api/datastore/get_dataset_link/{dataset_id}/'
headers = { 'X-API-Key': api_key }
# Make the GET request and format the JSON response
response = requests.get(url, headers=headers)
data = response.json()
print(json.dumps(data, indent=4))
[
{
"pretty_name": "Known PTR records (rDNS)",
"name": "known_ptr_records",
"links": [
{
"ext": "json",
"link": "https://app.netlas.io/storage/known_ptr_records/known_ptr_records.json.zip?md5=MD5Value&expires=1716979209"
},
{
"ext": "csv",
"link": "https://app.netlas.io/storage/known_ptr_records/known_ptr_records.csv.zip?md5=MD5Value&expires=1716979209"
}
]
}
]
Most datasets are available in JSON and CSV formats. Dictionaries are supplied in TXT format. Endpoint returns links to all available formats at once.
If you request a bundle, there will be more than one dataset in the JSON list.