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.
Document Search
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
}
}
}
- Python
- JavaScript
- cURL
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']}")
const query = `
query SearchDocuments($filter: SearchFilter!, $limit: Int!, $sorting: SearchSorting!) {
search(filter: $filter, limit: $limit, sorting: $sorting) {
documents { id title releasedAt }
}
}
`;
const variables = {
filter: {
keyword: { query: "Apple 10-K" },
date: { preset: "LAST_12_MONTHS" },
},
limit: 5,
sorting: { field: "DATE", direction: "DESC" },
};
const response = await fetch("https://api.alpha-sense.com/gql", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
clientid: process.env.ALPHASENSE_CLIENT_ID,
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query, variables }),
});
const docs = (await response.json()).data.search.documents;
for (const doc of docs) {
console.log(`${doc.id} ${doc.title}`);
}
curl --request POST 'https://api.alpha-sense.com/gql' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header "clientid: $ALPHASENSE_CLIENT_ID" \
--header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"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" }
}
}'
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
}
}
- Python
- JavaScript
- cURL
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']}")
const query = `
query SourceTypes {
filingsTypesV3 { id name }
}
`;
const response = await fetch("https://api.alpha-sense.com/gql", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
clientid: process.env.ALPHASENSE_CLIENT_ID,
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
});
const sources = (await response.json()).data.filingsTypesV3;
for (const source of sources) {
console.log(`${source.id} ${source.name}`);
}
curl --request POST 'https://api.alpha-sense.com/gql' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header "clientid: $ALPHASENSE_CLIENT_ID" \
--header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"query": "query SourceTypes { filingsTypesV3 { id 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
}
}
- Python
- JavaScript
- cURL
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']}")
const query = `
query IndustryCodes {
documentIndustries { code name }
}
`;
const response = await fetch("https://api.alpha-sense.com/gql", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
clientid: process.env.ALPHASENSE_CLIENT_ID,
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
});
const industries = (await response.json()).data.documentIndustries;
for (const ind of industries) {
console.log(`${ind.code} ${ind.name}`);
}
curl --request POST 'https://api.alpha-sense.com/gql' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header "clientid: $ALPHASENSE_CLIENT_ID" \
--header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"query": "query IndustryCodes { documentIndustries { code 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
}
}
- Python
- JavaScript
- cURL
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']}")
const query = `
query CountryCodes {
documentCountryCodes { code name }
}
`;
const response = await fetch("https://api.alpha-sense.com/gql", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
clientid: process.env.ALPHASENSE_CLIENT_ID,
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
});
const countries = (await response.json()).data.documentCountryCodes;
for (const c of countries) {
console.log(`${c.code} ${c.name}`);
}
curl --request POST 'https://api.alpha-sense.com/gql' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header "clientid: $ALPHASENSE_CLIENT_ID" \
--header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"query": "query CountryCodes { documentCountryCodes { code name } }"
}'
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
}
}
- Python
- JavaScript
- cURL
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']})")
const query = `
query CompanyLookup($filter: CompaniesFilter!) {
companies(filter: $filter) { id name ticker }
}
`;
const variables = {
filter: { keyword: "Apple" },
};
const response = await fetch("https://api.alpha-sense.com/gql", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
clientid: process.env.ALPHASENSE_CLIENT_ID,
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query, variables }),
});
const companies = (await response.json()).data.companies;
for (const c of companies) {
console.log(`${c.ticker} ${c.name} (ID: ${c.id})`);
}
curl --request POST 'https://api.alpha-sense.com/gql' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header "clientid: $ALPHASENSE_CLIENT_ID" \
--header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"query": "query CompanyLookup($filter: CompaniesFilter!) { companies(filter: $filter) { id name ticker } }",
"variables": {
"filter": { "keyword": "Apple" }
}
}'
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
}
}
}
- Python
- JavaScript
- cURL
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']}")
const query = `
query UserWatchlists {
user { watchlists { id name } }
}
`;
const response = await fetch("https://api.alpha-sense.com/gql", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
clientid: process.env.ALPHASENSE_CLIENT_ID,
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
});
const watchlists = (await response.json()).data.user.watchlists;
for (const wl of watchlists) {
console.log(`${wl.id} ${wl.name}`);
}
curl --request POST 'https://api.alpha-sense.com/gql' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header "clientid: $ALPHASENSE_CLIENT_ID" \
--header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"query": "query UserWatchlists { user { watchlists { id 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 Value | Range |
|---|---|
LAST_24_HOURS | Past 24 hours |
LAST_7_DAYS | Past 7 days |
LAST_30_DAYS | Past 30 days |
LAST_90_DAYS | Past 90 days |
LAST_6_MONTHS | Past 6 months |
LAST_12_MONTHS | Past 12 months |
LAST_18_MONTHS | Past 18 months |
LAST_2_YEARS | Past 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"
}
}
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-field | Description | Example Value |
|---|---|---|
analystPerspectives | Type of analyst viewpoint | "Investor-Led (Sell-Side)" |
expertPerspectives | Type of expert | "Medical Professional" |
expertTranscriptType | Transcript format | "Company Deep-Dive" |
"expertInsightsFilters": {
"expertPerspectives": ["Medical Professional"],
"expertTranscriptType": ["Company Deep-Dive"]
}
For available values and full type details see the ExpertInsightsFilters reference.
For a complete walkthrough of how to use these values in GenSearch requests, see GenSearch Modes — Search Filters.