Skip to main content

Other APIs

These GraphQL queries help you look up the IDs, codes, and enum values required by GenSearch filters. Each section below shows the query, which GenSearch field it maps to, and a code example.

All requests use the same authentication and endpoint as GenSearch. See Authentication for setup details.


Find document IDs to use with the GenSearch documents field for AskInDoc queries.

GenSearch field: input.documents[].id

query SearchDocuments($filter: SearchFilter!, $limit: Int!, $sorting: SearchSorting!) {
search(filter: $filter, limit: $limit, sorting: $sorting) {
documents {
id
title
releasedAt
}
}
}
import os
import requests

API_KEY = os.environ["ALPHASENSE_API_KEY"]
CLIENT_ID = os.environ["ALPHASENSE_CLIENT_ID"]
ENDPOINT = "https://api.alpha-sense.com/gql"

# token = ... (see Authentication guide)

query = """
query SearchDocuments($filter: SearchFilter!, $limit: Int!, $sorting: SearchSorting!) {
search(filter: $filter, limit: $limit, sorting: $sorting) {
documents { id title releasedAt }
}
}
"""

variables = {
"filter": {
"keyword": {"query": "Apple 10-K"},
"date": {"preset": "LAST_12_MONTHS"},
},
"limit": 5,
"sorting": {"field": "DATE", "direction": "DESC"},
}

response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query, "variables": variables},
)

docs = response.json()["data"]["search"]["documents"]
for doc in docs:
print(f"{doc['id']} {doc['title']}")

For full query options see the Search API reference.


Source Types

Look up source type IDs (broker research, SEC filings, earnings transcripts, etc.) for the GenSearch filters.sources.ids field.

GenSearch field: input.filters.sources.ids

query SourceTypes {
filingsTypesV3 {
id
name
}
}
query = """
query SourceTypes {
filingsTypesV3 { id name }
}
"""

response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query},
)

for source in response.json()["data"]["filingsTypesV3"]:
print(f"{source['id']} {source['name']}")

For full type details see the filingsTypesV3 reference.


Industry Codes (GICS)

Look up GICS (Global Industry Classification Standard) codes for the GenSearch filters.industries field.

GenSearch field: input.filters.industries

query IndustryCodes {
documentIndustries {
code
name
}
}
query = """
query IndustryCodes {
documentIndustries { code name }
}
"""

response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query},
)

for industry in response.json()["data"]["documentIndustries"]:
print(f"{industry['code']} {industry['name']}")

For full type details see the documentIndustries reference.


Country Codes

Look up ISO 3166-1 alpha-2 country codes for the GenSearch filters.countries field.

GenSearch field: input.filters.countries

query CountryCodes {
documentCountryCodes {
code
name
}
}
query = """
query CountryCodes {
documentCountryCodes { code name }
}
"""

response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query},
)

for country in response.json()["data"]["documentCountryCodes"]:
print(f"{country['code']} {country['name']}")
note

Use "US*" in the GenSearch countries filter to target US non-domicile entities.

For full type details see the documentCountryCodes reference.


Company Lookup

Resolve company tickers and identifiers for the GenSearch filters.companies.include field.

GenSearch field: input.filters.companies.include

query CompanyLookup($filter: CompaniesFilter!) {
companies(filter: $filter) {
id
name
ticker
}
}
query = """
query CompanyLookup($filter: CompaniesFilter!) {
companies(filter: $filter) { id name ticker }
}
"""

variables = {
"filter": {"keyword": "Apple"}
}

response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query, "variables": variables},
)

for company in response.json()["data"]["companies"]:
print(f"{company['ticker']} {company['name']} (ID: {company['id']})")

For full query options see the companies reference.


User Watchlists

Retrieve your saved watchlist IDs for the GenSearch filters.companies.watchlists field.

GenSearch field: input.filters.companies.watchlists

query UserWatchlists {
user {
watchlists {
id
name
}
}
}
query = """
query UserWatchlists {
user { watchlists { id name } }
}
"""

response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query},
)

for wl in response.json()["data"]["user"]["watchlists"]:
print(f"{wl['id']} {wl['name']}")

For full type details see the user reference.


Date Presets

The GenSearch filters.date.preset field accepts the following enum values. No lookup query is needed — use these values directly.

GenSearch field: input.filters.date.preset

Preset ValueRange
LAST_24_HOURSPast 24 hours
LAST_7_DAYSPast 7 days
LAST_30_DAYSPast 30 days
LAST_90_DAYSPast 90 days
LAST_6_MONTHSPast 6 months
LAST_12_MONTHSPast 12 months
LAST_18_MONTHSPast 18 months
LAST_2_YEARSPast 2 years

Alternatively, use filters.date.customRange with from and to in YYYY-MM-DD format:

"date": {
"customRange": {
"from": "2025-01-01",
"to": "2025-06-30"
}
}
warning

Use either preset or customRange, not both at the same time.

For the full enum definition see the SearchDatePreset reference.


Expert Insights Filters

Filter within AlphaSense Expert Insights content using three sub-fields. These accept string values — use the values listed in the reference linked below.

GenSearch field: input.filters.expertInsightsFilters

Sub-fieldDescriptionExample Value
analystPerspectivesType of analyst viewpoint"Investor-Led (Sell-Side)"
expertPerspectivesType of expert"Medical Professional"
expertTranscriptTypeTranscript format"Company Deep-Dive"
"expertInsightsFilters": {
"expertPerspectives": ["Medical Professional"],
"expertTranscriptType": ["Company Deep-Dive"]
}

For available values and full type details see the ExpertInsightsFilters reference.


tip

For a complete walkthrough of how to use these values in GenSearch requests, see GenSearch Modes — Search Filters.