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
}{
"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 Discover API (Beta)
Company Discover API (Beta) endpoint: find companies using natural language queries across 72M+ 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
}{
"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 query into SQL and returns matching companies. We treat the query as yours. A query that asks for nothing to find, that tells the search how to behave instead of what to find, that is written in another script, or that needs a field your contract does not include answers400 and is not billed (see Refused Queries). If your product passes along text from its users or from documents, check it first: the refusal check is not a filter for injected text.
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
A Company’s Name on Its Own
A query that is only a company’s name, such asApple, Goldman Sachs or Home Depot, returns that company: every record with its website domain, largest first. A phrase that names a kind of company, such as Fintech or Renewable Energy, is searched as that kind. To search for companies like a named one, say so: companies like Stripe.
What Cannot Be Filtered On
A query can ask for something the data has no filter for. The API names it instead of answering as if it had applied it:not_filtered | The Query Asks For |
|---|---|
funding | Funding rounds, investors or valuation |
technology_used | The software or technology a company uses |
revenue | Revenue or profit |
business_relationship | A company’s customers, suppliers, partners or investors |
hiring_roles | The roles or people a company is hiring for |
excluded_places | Leaving out a place it cannot name as US cities or states, such as a metro area (“outside the Bay Area”) |
excluded_companies | Leaving out companies it cannot name one by one (“other than the Big Four”) |
400 with error unsupported_filter, and nothing is billed:
{
"error": "unsupported_filter",
"message": "This search cannot filter on funding rounds, investors or valuation. Rephrase the query without it.",
"details": {
"not_filtered": ["funding"]
}
}
profitable companies) answers the same 400, and its message says the query names nothing else to search on.
Refused Queries
These queries answer400 without running a search, and nothing is billed:
error | Meaning |
|---|---|
not_a_search | Asks for no companies to find |
instructions_in_query | Tells the search how to behave, not what to find |
not_in_latin_letters | Holds letters outside the Latin script |
field_not_in_contract | Needs a field your contract does not include, such as employee counts on a plan without them |
{
"error": "not_a_search",
"message": "This query does not ask for companies to find. Say which companies you are looking for, such as an industry, size or location, or name a company."
}
instructions_in_query the message reads: “This query reads as instructions to the search itself. Say only who or what you are looking for, including anything to leave out of the results.”
For not_in_latin_letters the message reads: “Write the query in English, in Latin letters: Discover reads the places, names and other details it filters on in English.” Accented letters are fine (software companies in Montréal); a query in another script (software engineers в Остине) answers not_in_latin_letters.
For field_not_in_contract the message names what to leave out, and details.fields names the field: “Your contract does not include the linkedin_employee_count field, so Discover cannot filter on it. Leave that part out of the query and try again.”
Pagination
Page with a cursor. A page with more results after it carriesnext_cursor; send it back as cursor, without offset, with the same query. Every page belongs to the same search, and paging can go past 10,000 results. On the last page next_cursor is null.
{
"query": "AI startups in San Francisco with over 50 employees",
"limit": 100,
"cursor": "k3Vb9xQp2LmZr7Ta..."
}
offset (up to 10,000) also works, but each request with an offset reads your query again, so pages can overlap or skip records. For anything past the first page, use the cursor.Body
Request model for Company Discover (plain-English search).
Continue from the previous page's next_cursor: the next page of the same search, without asking the model again (it may word the same query differently), and past offset's 10,000-row reach. Send the same query, and no offset, in a POST body (a long cursor won't fit in a GET's URL). A cursor works for the dataset build it came from.
65536Response
Success - companies found matching natural language query.
Company Discover response.
For /company/search and /company/discover, the total number of rows matching the query's WHERE clause across the database (not just this page). On search/discover, if the exact count exceeds its time budget (broad, low-selectivity queries) it falls back to the matches counted before the budget ran out (a lower bound), and if that does not cover this page, to the offset plus the rows returned; the response header Total-Count-Status reports which (exact, estimate, or page).