data/businesses
Search and download business data using the Datafiniti API v3.
curl -X GET "https://api.datafiniti.co/v3/data/businesses?q=categories:hotels AND country:US&records=10&format=JSON&download=false&view=businesses_all" \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_CREDENTIALS"
import requests
import json
url = "https://api.datafiniti.co/v3/data/businesses?q=categories:hotels AND country:US&records=10&format=JSON&download=false&view=businesses_all"
headers = {
"Content-Type": "application/json",
"Authorization": "Basic YOUR_CREDENTIALS"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch("https://api.datafiniti.co/v3/data/businesses?q=categories:hotels AND country:US&records=10&format=JSON&download=false&view=businesses_all", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Basic YOUR_CREDENTIALS"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.datafiniti.co/v3/data/businesses?q=categories:hotels AND country:US&records=10&format=JSON&download=false&view=businesses_all", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Basic YOUR_CREDENTIALS")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.datafiniti.co/v3/data/businesses?q=categories:hotels AND country:US&records=10&format=JSON&download=false&view=businesses_all')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Basic YOUR_CREDENTIALS'
response = http.request(request)
puts response.body
{
"num_found": 95378,
"total_cost": 1,
"records": [
{}
]
}
[
{
"id": 6073,
"records": "example_string",
"query": "categories:hotels AND country:US",
"dataType": "businesses",
"dataFormat": "csv",
"accountId": "AAAXXXXXXXXXXXX",
"planId": "free",
"view": "businesses_all_nested",
"async": 1,
"status": "STARTED",
"error": "",
"numDownloaded": 0,
"numFound": 95378,
"numRequested": 95378,
"date_started": "2017-1-11 15:52:42",
"date_completed": "2017-1-11 15:52:43"
}
]
{}
{
"error": "field_name does not exist in business schema"
}
{
"error": "invalid query"
}
{
"error": "view does not exist"
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
/data/businesses
Target server for requests. Edit to use your own host.
Username for basic authentication
Password for basic authentication
Search query using Datafiniti query syntax. Supports boolean operators (AND, OR), exact match with quotes, wildcards (*), negation (-), range queries, and nested field queries. Example: categories:hotels AND country:US
Number of records to return. For preview (download=false): 0-10, defaults to 10. For download (download=true): 1 to total matching records. If omitted during download, all matching records will be downloaded.
Output format for the data. JSON returns data as JSON objects. CSV returns data in CSV format.
Set to true to initiate a bulk download. When false (default), returns up to 10 preview records immediately. When true, returns a 303 redirect to the /requests endpoint to monitor download progress.
The view determines which fields are returned in the response and the order they appear. Different views are available for each data type. Examples for businesses: businesses_all, businesses_all_nested. Examples for products: products_all, products_basicFields, products_pricesFlat. Examples for properties: properties_all, properties_all_nested.
Request Preview
Response
Response will appear here after sending the request
Authentication
Basic authentication credentials. V3 uses Basic Authentication with your API token as the username and no password. In URL form: https://YOUR_API_TOKEN:@api.datafiniti.co/v3/... In cURL: --user YOUR_API_TOKEN: (note the trailing colon). Get your token from the Datafiniti Web Portal at https://portal.datafiniti.co.
Query Parameters
Search query using Datafiniti query syntax. Supports boolean operators (AND, OR), exact match with quotes, wildcards (*), negation (-), range queries, and nested field queries. Example: categories:hotels AND country:US
Number of records to return. For preview (download=false): 0-10, defaults to 10. For download (download=true): 1 to total matching records. If omitted during download, all matching records will be downloaded.
Output format for the data. JSON returns data as JSON objects. CSV returns data in CSV format.
JSONCSVSet to true to initiate a bulk download. When false (default), returns up to 10 preview records immediately. When true, returns a 303 redirect to the /requests endpoint to monitor download progress.
The view determines which fields are returned in the response and the order they appear. Different views are available for each data type. Examples for businesses: businesses_all, businesses_all_nested. Examples for products: products_all, products_basicFields, products_pricesFlat. Examples for properties: properties_all, properties_all_nested.
Responses
Total number of records in Datafiniti matching the query
Number of credits consumed by this request
Array of matching records. The fields present depend on the data type and view used.
The data endpoint lets you run preview searches and initiate downloads for business data.
If you set download=false (or don't set it), the API call will return a list of matching businesses for your query (up to 10 records). If you set download=true, it will return a request object that can be used to monitor the status of the download via the /requests endpoint.