curl --request GET \
--url https://api.hubapi.com/contacts/v1/search/queryimport requests
url = "https://api.hubapi.com/contacts/v1/search/query"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.hubapi.com/contacts/v1/search/query', 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.hubapi.com/contacts/v1/search/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hubapi.com/contacts/v1/search/query"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hubapi.com/contacts/v1/search/query")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubapi.com/contacts/v1/search/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"{ \"query\": \"testingapis\", \"offset\": 1, \"has-more\": false, \"total\": 1, \"contacts\": [ { \"vid\": 3234574, \"canonical-vid\": 3234574, \"merged-vids\": [ ], \"portal-id\": 62515, \"is-contact\": true, \"properties\": { \"hs_analytics_last_url\": { \"value\": \"\" }, \"lead_source\": { \"value\": \"DiscoverOrg\" }, \"num_unique_conversion_events\": { \"value\": \"0\" }, \"hs_analytics_revenue\": { \"value\": \"0.0\" }, \"createdate\": { \"value\": \"1484026585538\" }, \"hs_analytics_first_referrer\": { \"value\": \"\" }, \"hs_email_optout\": { \"value\": \"true\" }, \"hs_predictivecontactscore\": { \"value\": \"50\" }, \"annualrevenue\": { \"value\": \"181900000\" }, \"hs_analytics_num_page_views\": { \"value\": \"0\" }, \"state\": { \"value\": \"MA\" }, \"zip\": { \"value\": \"02139\" }, \"fortune_rank\": { \"value\": \"\" }, \"hs_predictivecontactscorebucket\": { \"value\": \"bucket_3\" }, \"hubspotscore\": { \"value\": \"0\" }, \"linkedinconnections\": { \"value\": \"0\" }, \"hs_lifecyclestage_subscriber_date\": { \"value\": \"1484026585538\" }, \"hs_analytics_average_page_views\": { \"value\": \"0\" }, \"lastname\": { \"value\": \"Test\" }, \"twitterhandle\": { \"value\": \"ghidinelli\" }, \"phone\": { \"value\": \"555-122-2323\" }, \"num_conversion_events\": { \"value\": \"0\" }, \"currentlyinworkflow\": { \"value\": \"false\" }, \"hs_analytics_num_event_completions\": { \"value\": \"2\" }, \"followercount\": { \"value\": \"582\" }, \"hs_email_optout_2849\": { \"value\": \"\" }, \"associatedcompanyid\": { \"value\": \"184896670\" }, \"firstname\": { \"value\": \"HubSpot\" }, \"city\": { \"value\": \"Cambridge\" }, \"hs_email_optout_354586\": { \"value\": \"\" }, \"hs_social_num_broadcast_clicks\": { \"value\": \"0\" }, \"hs_analytics_last_timestamp\": { \"value\": \"\" }, \"hs_analytics_num_visits\": { \"value\": \"0\" }, \"twitterbio\": { \"value\": \"Racer, entrepreneur, world traveler. Crossfitter, foodie, kitesurfing newbie. If racing is life, I'm building a lifestyle business @MotorsportReg @RaceHeroApp\" }, \"hs_social_linkedin_clicks\": { \"value\": \"0\" }, \"hs_analytics_last_visit_timestamp\": { \"value\": \"\" }, \"hs_social_last_engagement\": { \"value\": \"\" }, \"hs_twitterid\": { \"value\": \"49019793\" }, \"associatedcompanylastupdated\": { \"value\": \"13365279006997343\" }, \"hs_analytics_source\": { \"value\": \"OFFLINE\" }, \"company\": { \"value\": \"HubSpot\" }, \"email\": { \"value\": \"testingapis@hubspot.com\" }, \"linkedinbio\": { \"value\": \"Racecar driver, entrepreneur, world traveler\" }, \"hs_analytics_first_url\": { \"value\": \" }, \"website\": { \"value\": \" }, \"address\": { \"value\": \"25 First Street\" }, \"hs_analytics_first_visit_timestamp\": { \"value\": \"\" }, \"hs_analytics_first_timestamp\": { \"value\": \"1484026585538\" }, \"lastmodifieddate\": { \"value\": \"1484859513090\" }, \"photo\": { \"value\": \" }, \"hs_social_google_plus_clicks\": { \"value\": \"0\" }, \"hs_analytics_last_referrer\": { \"value\": \"\" }, \"kloutscoregeneral\": { \"value\": \"48\" }, \"hs_email_optout_230318\": { \"value\": \"\" }, \"hs_social_facebook_clicks\": { \"value\": \"0\" }, \"twitterprofilephoto\": { \"value\": \" }, \"hs_analytics_source_data_2\": { \"value\": \"\" }, \"hs_social_twitter_clicks\": { \"value\": \"0\" }, \"hs_analytics_source_data_1\": { \"value\": \"API\" }, \"lifecyclestage\": { \"value\": \"subscriber\" }, \"hs_email_sends_since_last_engagement\": { \"value\": \"0\" } }, \"form-submissions\": [ ], \"identity-profiles\": [ { \"vid\": 3234574, \"saved-at-timestamp\": 0, \"deleted-changed-timestamp\": 0, \"identities\": [ { \"type\": \"EMAIL\", \"value\": \"testingapis@hubspot.com\", \"timestamp\": 1484026585538 }, { \"type\": \"LEAD_GUID\", \"value\": \"4b11f8af-50d9-4665-9c43-bb2fc46e3a80\", \"timestamp\": 1484026585610 } ] } ], \"merge-audits\": [ ] } ] }"Search for contacts by email, name, phone number, or company
The search contacts endpoint is used to search for contacts by email, name, phone number, or company. This endpoint returns search results in a paginated format and accepts a query string to search across contact properties.
curl --request GET \
--url https://api.hubapi.com/contacts/v1/search/queryimport requests
url = "https://api.hubapi.com/contacts/v1/search/query"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.hubapi.com/contacts/v1/search/query', 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.hubapi.com/contacts/v1/search/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hubapi.com/contacts/v1/search/query"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hubapi.com/contacts/v1/search/query")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubapi.com/contacts/v1/search/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"{ \"query\": \"testingapis\", \"offset\": 1, \"has-more\": false, \"total\": 1, \"contacts\": [ { \"vid\": 3234574, \"canonical-vid\": 3234574, \"merged-vids\": [ ], \"portal-id\": 62515, \"is-contact\": true, \"properties\": { \"hs_analytics_last_url\": { \"value\": \"\" }, \"lead_source\": { \"value\": \"DiscoverOrg\" }, \"num_unique_conversion_events\": { \"value\": \"0\" }, \"hs_analytics_revenue\": { \"value\": \"0.0\" }, \"createdate\": { \"value\": \"1484026585538\" }, \"hs_analytics_first_referrer\": { \"value\": \"\" }, \"hs_email_optout\": { \"value\": \"true\" }, \"hs_predictivecontactscore\": { \"value\": \"50\" }, \"annualrevenue\": { \"value\": \"181900000\" }, \"hs_analytics_num_page_views\": { \"value\": \"0\" }, \"state\": { \"value\": \"MA\" }, \"zip\": { \"value\": \"02139\" }, \"fortune_rank\": { \"value\": \"\" }, \"hs_predictivecontactscorebucket\": { \"value\": \"bucket_3\" }, \"hubspotscore\": { \"value\": \"0\" }, \"linkedinconnections\": { \"value\": \"0\" }, \"hs_lifecyclestage_subscriber_date\": { \"value\": \"1484026585538\" }, \"hs_analytics_average_page_views\": { \"value\": \"0\" }, \"lastname\": { \"value\": \"Test\" }, \"twitterhandle\": { \"value\": \"ghidinelli\" }, \"phone\": { \"value\": \"555-122-2323\" }, \"num_conversion_events\": { \"value\": \"0\" }, \"currentlyinworkflow\": { \"value\": \"false\" }, \"hs_analytics_num_event_completions\": { \"value\": \"2\" }, \"followercount\": { \"value\": \"582\" }, \"hs_email_optout_2849\": { \"value\": \"\" }, \"associatedcompanyid\": { \"value\": \"184896670\" }, \"firstname\": { \"value\": \"HubSpot\" }, \"city\": { \"value\": \"Cambridge\" }, \"hs_email_optout_354586\": { \"value\": \"\" }, \"hs_social_num_broadcast_clicks\": { \"value\": \"0\" }, \"hs_analytics_last_timestamp\": { \"value\": \"\" }, \"hs_analytics_num_visits\": { \"value\": \"0\" }, \"twitterbio\": { \"value\": \"Racer, entrepreneur, world traveler. Crossfitter, foodie, kitesurfing newbie. If racing is life, I'm building a lifestyle business @MotorsportReg @RaceHeroApp\" }, \"hs_social_linkedin_clicks\": { \"value\": \"0\" }, \"hs_analytics_last_visit_timestamp\": { \"value\": \"\" }, \"hs_social_last_engagement\": { \"value\": \"\" }, \"hs_twitterid\": { \"value\": \"49019793\" }, \"associatedcompanylastupdated\": { \"value\": \"13365279006997343\" }, \"hs_analytics_source\": { \"value\": \"OFFLINE\" }, \"company\": { \"value\": \"HubSpot\" }, \"email\": { \"value\": \"testingapis@hubspot.com\" }, \"linkedinbio\": { \"value\": \"Racecar driver, entrepreneur, world traveler\" }, \"hs_analytics_first_url\": { \"value\": \" }, \"website\": { \"value\": \" }, \"address\": { \"value\": \"25 First Street\" }, \"hs_analytics_first_visit_timestamp\": { \"value\": \"\" }, \"hs_analytics_first_timestamp\": { \"value\": \"1484026585538\" }, \"lastmodifieddate\": { \"value\": \"1484859513090\" }, \"photo\": { \"value\": \" }, \"hs_social_google_plus_clicks\": { \"value\": \"0\" }, \"hs_analytics_last_referrer\": { \"value\": \"\" }, \"kloutscoregeneral\": { \"value\": \"48\" }, \"hs_email_optout_230318\": { \"value\": \"\" }, \"hs_social_facebook_clicks\": { \"value\": \"0\" }, \"twitterprofilephoto\": { \"value\": \" }, \"hs_analytics_source_data_2\": { \"value\": \"\" }, \"hs_social_twitter_clicks\": { \"value\": \"0\" }, \"hs_analytics_source_data_1\": { \"value\": \"API\" }, \"lifecyclestage\": { \"value\": \"subscriber\" }, \"hs_email_sends_since_last_engagement\": { \"value\": \"0\" } }, \"form-submissions\": [ ], \"identity-profiles\": [ { \"vid\": 3234574, \"saved-at-timestamp\": 0, \"deleted-changed-timestamp\": 0, \"identities\": [ { \"type\": \"EMAIL\", \"value\": \"testingapis@hubspot.com\", \"timestamp\": 1484026585538 }, { \"type\": \"LEAD_GUID\", \"value\": \"4b11f8af-50d9-4665-9c43-bb2fc46e3a80\", \"timestamp\": 1484026585610 } ] } ], \"merge-audits\": [ ] } ] }"Scope requirements
Scope requirements
クエリパラメータ
The search term for what you're searching for. You can use all of a word or just parts of a word as well. For example, if you were searching for contacts with "hubspot" in their name or email, searching for "hub" would also return contacts with "hubspot" in their email address.
This parameter lets you specify the amount of contacts to return in your API call. The default for this parameter (if it isn't specified) is 20 contacts. The maximum amount of contacts you can have returned to you via this parameter is 100.
This parameter is used to page through the results. Every call to this endpoint will return an offset value. This value is used in the offset= parameter of the next call to get the next page of contacts.
If you include the "property" parameter, then the properties in the "contact" object in the returned data will only include the property or properties that you request.
This parameter takes in an internal property name (e.g. vid) and sorts contact search results by that field.
This parameter accepts DESC or ASC as values (defaults to DESC) to order results by the property specified in "sort" parameter. As such, this parameter will only work when used in conjunction with "sort".
レスポンス
Successful response - Search results for contacts matching the query
The response is of type object.