Search Companies
On this page
Search for one or more companies based on name, tax ID, website, or other fields.
Search for one or more companies based on name, tax ID, website, or other fields.
The company GraphQL API is accessible at /company
This endpoint will return a list of companies matching the query and in case queried props are visible to the querier, it will be possible to query by:
- ID
- Legal name (with name field)
- Brand name (with name field)
- Profile name (with name field)
- TaxID
- Telephone number
- Webpage (social media or other)
Each result will return a list of companies. It is possible to pass a combination of queryable props.
query (
$id: ID
$name: String
$taxId: String
$email: String
$telephoneNumber: String
$webpage: String
$limit: Int
$metadata: JSON
) {
companies (
id: $id
name: $name
taxId: $taxId
email: $email
telephoneNumber: $telephoneNumber
webpage: $webpage
limit: $limit
metadata: $metadata
) {
id
legalName
brandName
profileName
taxId
yearFounded
aboutUs
metadata
verified
logoUrl
verticalType {
id
displayName
description
}
organizationType {
id
displayName
}
addresses {
city
country
state
street
types
zipCode
}
emails {
email
}
telephoneNumbers {
number
}
socialNetworks {
type
url
}
webpages {
type
url
}
specialties {
description
title
}
subscriptionTopics {
id
name
}
subscriptionSettings {
enable_email
enable_sms
enable_voice
}
}
}
Example Code
Python
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
# Please note that this basic example won't work if you have an asyncio event loop running.
# In some python environments (as with Jupyter which uses IPython) an asyncio event loop is created for you.
# In that case you should use instead https://gql.readthedocs.io/en/latest/async/async_usage.html#async-usage
def search_companies(bearer_token, query_name=None, tax_id=None, email=None, phone_number=None, webpage=None, limit_count=10):
transport = AIOHTTPTransport(
url="https://api.staging.v2.tnid.com/company",
headers={"Authorization": f"Bearer {bearer_token}"}
)
client = Client(transport=transport, fetch_schema_from_transport=True)
query = gql(
"""
query (
$name: String
$taxId: String
$email: String
$telephoneNumber: String
$webpage: String
$limit: Int
) {
companies (
name: $name
taxId: $taxId
email: $email
telephoneNumber: $telephoneNumber
webpage: $webpage
limit: $limit
) {
id
legalName
brandName
profileName
taxId
}
}
"""
)
params = {"name": query_name, "taxId": tax_id, "email": email, "telephoneNumber": phone_number,
"webpage": webpage, "limit": limit_count}
try:
response = client.execute(query, params)
print(f"Response OK when searching companies: {response}")
return response
except Exception as e:
print(f"Exception when searching companies: {e}")
# Example usage:
token = "your_company_token"
search_companies(token, "ACME")