curl --request POST \
--url https://api.datalegion.ai/company/discover \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "AI companies with 100+ employees founded after 2015",
"limit": 10
}
'import requests
url = "https://api.datalegion.ai/company/discover"
payload = {
"query": "AI companies with 100+ employees founded after 2015",
"limit": 10
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'AI companies with 100+ employees founded after 2015', limit: 10})
};
fetch('https://api.datalegion.ai/company/discover', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalegion.ai/company/discover",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'AI companies with 100+ employees founded after 2015',
'limit' => 10
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datalegion.ai/company/discover"
payload := strings.NewReader("{\n \"query\": \"AI companies with 100+ employees founded after 2015\",\n \"limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datalegion.ai/company/discover")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"AI companies with 100+ employees founded after 2015\",\n \"limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalegion.ai/company/discover")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"AI companies with 100+ employees founded after 2015\",\n \"limit\": 10\n}"
response = http.request(request)
puts response.read_body{
"matches": [
{
"company": {
"legion_id": "e9f2a4b6-8c3d-4e7f-a1b2-5d6e8f9a0c3b",
"name": {
"cleaned": "openai inc",
"display": "OpenAI",
"raw": [
"OpenAI, Inc."
]
},
"domain": "openai.com",
"industry": "technology, information and internet",
"type": "private",
"size": "1001-5000",
"founded": 2015,
"linkedin_url": "https://www.linkedin.com/company/openai",
"linkedin_id": "17876832",
"legion_employee_count": 3200,
"legion_average_tenure": 18.6,
"legion_employee_growth_rate": {
"1m": 0.028,
"3m": 0.085,
"6m": 0.18,
"12m": 0.42
},
"last_seen": "2026-01",
"num_sources": 4
}
}
],
"total": 562,
"generated_query": "SELECT * FROM companies WHERE industry ILIKE '%ai%' AND type = 'private' AND founded >= 2010"
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Company Discovery (Beta)
Company Discovery API endpoint: find companies using natural language queries across 71M+ company profiles.
curl --request POST \
--url https://api.datalegion.ai/company/discover \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "AI companies with 100+ employees founded after 2015",
"limit": 10
}
'import requests
url = "https://api.datalegion.ai/company/discover"
payload = {
"query": "AI companies with 100+ employees founded after 2015",
"limit": 10
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'AI companies with 100+ employees founded after 2015', limit: 10})
};
fetch('https://api.datalegion.ai/company/discover', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalegion.ai/company/discover",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'AI companies with 100+ employees founded after 2015',
'limit' => 10
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datalegion.ai/company/discover"
payload := strings.NewReader("{\n \"query\": \"AI companies with 100+ employees founded after 2015\",\n \"limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datalegion.ai/company/discover")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"AI companies with 100+ employees founded after 2015\",\n \"limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalegion.ai/company/discover")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"AI companies with 100+ employees founded after 2015\",\n \"limit\": 10\n}"
response = http.request(request)
puts response.read_body{
"matches": [
{
"company": {
"legion_id": "e9f2a4b6-8c3d-4e7f-a1b2-5d6e8f9a0c3b",
"name": {
"cleaned": "openai inc",
"display": "OpenAI",
"raw": [
"OpenAI, Inc."
]
},
"domain": "openai.com",
"industry": "technology, information and internet",
"type": "private",
"size": "1001-5000",
"founded": 2015,
"linkedin_url": "https://www.linkedin.com/company/openai",
"linkedin_id": "17876832",
"legion_employee_count": 3200,
"legion_average_tenure": 18.6,
"legion_employee_growth_rate": {
"1m": 0.028,
"3m": 0.085,
"6m": 0.18,
"12m": 0.42
},
"last_seen": "2026-01",
"num_sources": 4
}
}
],
"total": 562,
"generated_query": "SELECT * FROM companies WHERE industry ILIKE '%ai%' AND type = 'private' AND founded >= 2010"
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}How It Works
Describe what companies you’re looking for in plain English. The API translates your description into a SQL query and returns matching companies. The generated SQL query is returned in thegenerated_query field of the response body so you can see exactly how your description was interpreted.
Example Queries
AI startups in San Francisco with over 50 employees
public companies in the healthcare industry
fast-growing tech companies hiring aggressively
enterprise SaaS companies founded after 2015
companies with high employee turnover in the last year
Pagination
To page through results beyond the first 100, setoffset to the number of rows to skip. Maximum offset is 10,000. Ordering is deterministic within a build, so paged requests don’t overlap or skip rows; builds run on a periodic cadence, so paginate within a single client session, not across days.
{
"query": "AI startups in San Francisco with over 50 employees",
"limit": 100,
"offset": 100
}
Authorizations
Body
Request model for natural language company discovery.
Natural language description of companies you're looking for
3 - 10001 <= x <= 100Number of results to skip for pagination (0-10000). Stable within a build; ordering may change across builds.
0 <= x <= 10000If true, format text fields in title case (names, company names, locations). Raw fields, IDs, URLs, codes, and confidence fields are excluded.
Comma-separated list of fields to include in response. If omitted, all fields are returned.
Comma-separated list of fields to exclude from response. Applied after include_fields filter.
If true, pretty-print JSON response with indentation.
Response
Success - companies found matching natural language query.
Company discover response with generated query.
List of matches sorted by confidence (descending). Capped at the request's limit.
Show child attributes
Show child attributes
For /company/search and /company/discover, the total number of rows matching the query's WHERE clause across the database (not just this page). For /company/enrich, the number of matches found for the input identifier. On search/discover, if the exact count exceeds its time budget (broad, low-selectivity queries) it falls back to the query planner's row estimate, and if that is unavailable, to the size of the returned page; the response header Total-Count-Status reports which (exact, estimate, or page).
SQL query generated from the natural language input
Was this page helpful?