curl --request POST \
--url https://bee.theswarm.com/v3/companies/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"query": {
"match": {
"company_info.industry": {
"query": "Financial Services"
}
}
},
"limit": 100,
"pagination_token": "<string>",
"stable_pagination": false
}
'import requests
url = "https://bee.theswarm.com/v3/companies/search"
payload = {
"query": { "match": { "company_info.industry": { "query": "Financial Services" } } },
"limit": 100,
"pagination_token": "<string>",
"stable_pagination": False
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: {match: {'company_info.industry': {query: 'Financial Services'}}},
limit: 100,
pagination_token: '<string>',
stable_pagination: false
})
};
fetch('https://bee.theswarm.com/v3/companies/search', 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://bee.theswarm.com/v3/companies/search",
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' => [
'match' => [
'company_info.industry' => [
'query' => 'Financial Services'
]
]
],
'limit' => 100,
'pagination_token' => '<string>',
'stable_pagination' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://bee.theswarm.com/v3/companies/search"
payload := strings.NewReader("{\n \"query\": {\n \"match\": {\n \"company_info.industry\": {\n \"query\": \"Financial Services\"\n }\n }\n },\n \"limit\": 100,\n \"pagination_token\": \"<string>\",\n \"stable_pagination\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-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://bee.theswarm.com/v3/companies/search")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": {\n \"match\": {\n \"company_info.industry\": {\n \"query\": \"Financial Services\"\n }\n }\n },\n \"limit\": 100,\n \"pagination_token\": \"<string>\",\n \"stable_pagination\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://bee.theswarm.com/v3/companies/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": {\n \"match\": {\n \"company_info.industry\": {\n \"query\": \"Financial Services\"\n }\n }\n },\n \"limit\": 100,\n \"pagination_token\": \"<string>\",\n \"stable_pagination\": false\n}"
response = http.request(request)
puts response.read_body{
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"total_count": 123,
"pagination_token": "<string>"
}{
"code": 123,
"errors": [
"<string>"
]
}Search Companies
Search the company database using OpenSearch DSL queries. Returns a list of company IDs that can be passed to the Fetch Company endpoint.
curl --request POST \
--url https://bee.theswarm.com/v3/companies/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"query": {
"match": {
"company_info.industry": {
"query": "Financial Services"
}
}
},
"limit": 100,
"pagination_token": "<string>",
"stable_pagination": false
}
'import requests
url = "https://bee.theswarm.com/v3/companies/search"
payload = {
"query": { "match": { "company_info.industry": { "query": "Financial Services" } } },
"limit": 100,
"pagination_token": "<string>",
"stable_pagination": False
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: {match: {'company_info.industry': {query: 'Financial Services'}}},
limit: 100,
pagination_token: '<string>',
stable_pagination: false
})
};
fetch('https://bee.theswarm.com/v3/companies/search', 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://bee.theswarm.com/v3/companies/search",
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' => [
'match' => [
'company_info.industry' => [
'query' => 'Financial Services'
]
]
],
'limit' => 100,
'pagination_token' => '<string>',
'stable_pagination' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://bee.theswarm.com/v3/companies/search"
payload := strings.NewReader("{\n \"query\": {\n \"match\": {\n \"company_info.industry\": {\n \"query\": \"Financial Services\"\n }\n }\n },\n \"limit\": 100,\n \"pagination_token\": \"<string>\",\n \"stable_pagination\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-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://bee.theswarm.com/v3/companies/search")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": {\n \"match\": {\n \"company_info.industry\": {\n \"query\": \"Financial Services\"\n }\n }\n },\n \"limit\": 100,\n \"pagination_token\": \"<string>\",\n \"stable_pagination\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://bee.theswarm.com/v3/companies/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": {\n \"match\": {\n \"company_info.industry\": {\n \"query\": \"Financial Services\"\n }\n }\n },\n \"limit\": 100,\n \"pagination_token\": \"<string>\",\n \"stable_pagination\": false\n}"
response = http.request(request)
puts response.read_body{
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"total_count": 123,
"pagination_token": "<string>"
}{
"code": 123,
"errors": [
"<string>"
]
}"query" with your OpenSearch DSL query and set the x-api-key header.
Search returns up to 1000 results per page. Pagination works the same as the Search Profiles endpoint.
{
"ids": [
"09d9c510-c9f6-4c6e-9e62-fe5fedbeda87"
],
"total_count": 1,
"pagination_token": "eyJzZWFyY2hfYWZ0ZXIiOlt7ImZpZWxkIjoiX3Njb3JlIiwidmFsdWUiOjF9LHsiZmllbGQiOiJwcm9maWxlX2luZm8uaWQiLCJ2YWx1ZSI6IjAwMDE2MTU4LWYyY2EtNDYzZC05YWEzLTIyOWZkMzk0ZWQ0MSJ9XX0="
}
Partner teams
Partners can execute a request in the context of a child team by passing the child teamβs ID in thex-authenticate-team header:
x-authenticate-team: <child_team_id>
- With the header β the search runs in the context of the child team.
- Without the header β the search runs in the context of the team that owns the API key (default).
child_team_id is returned when you create a child team.
curl -X POST https://bee.theswarm.com/v3/companies/search \
-H "x-api-key: YOUR_API_KEY" \
-H "x-authenticate-team: child-team-id-123" \
-H "Content-Type: application/json" \
-d '{
"query": {
"match": {
"company_info.industry": { "query": "Software" }
}
},
"limit": 10
}'
paginationToken and totalCount. See the Migrating to v3 guide.Authorizations
Headers
Partner accounts only. When present, the request is executed in the context of the specified child team (use the team_id returned by Create Team). When omitted, the request runs as the team that owns the API key.
Body
Search query in the ElasticSearch Query DSL format. Find mapping here
{
"match": {
"company_info.industry": { "query": "Financial Services" }
}
}
Limit the number of results. If you want to use stable_pagination this parameter must be set to 1000
0 <= x <= 1000Pagination token received in the previous response
When set to true, ensures that pagination results remain consistent, even if the underlying data changes during retrieval. This is useful for retrieving large result sets reliably across multiple requests
Was this page helpful?

