Other APIs
These GraphQL queries and external references help you look up the IDs, codes, and enum values required by GenSearch filters. Each section below explains which GenSearch field it maps to and either shows a query with a code example or points you to an authoritative source.
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
filingTypesV3 returns a single JSON value (a blob). Request it without sub-selections:
query Query {
filingTypesV3
}
- Python
import json
query = """
query Query {
filingTypesV3
}
"""
response = requests.post(
ENDPOINT,
headers={
"x-api-key": API_KEY,
"clientid": CLIENT_ID,
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={"query": query},
)
filing_types = response.json()["data"]["filingTypesV3"]
filing_types_str = response.json()["data"]["filingTypesV3"]
filing_types = json.loads(filing_types_str)
print(json.dumps(filing_types, indent=2))
</TabItem>
<TabItem value="javascript" label="JavaScript">
```javascript
const query = `
query Query {
filingTypesV3
}
`
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 filingTypes = (await response.json()).data.filingTypesV3
const filingTypesStr = (await response.json()).data.filingTypesV3
const filingTypes = JSON.parse(filingTypesStr)
console.log(JSON.stringify(filingTypes, null, 2))
</TabItem>
<TabItem value="curl" label="cURL">
```bash
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 Query { filingTypesV3 }"
}'
For full type details see the
filingTypesV3 reference.
Industry Codes (GICS)
GICS (Global Industry Classification Standard) codes are used with the GenSearch filters.industries
field.
GenSearch field: input.filters.industries
There is no GraphQL lookup for industry codes in this API. For the official GICS structure, definitions, and how codes are organized, see the MSCI index resources page: The Global Industry Classification Standard (GICS).
Country Codes
GenSearch filters.countries expects uppercase ISO 3166-1 alpha-2 codes (for example US, GB,
CA).
GenSearch field: input.filters.countries
There is no GraphQL lookup for country codes in this API. For the full list of two-letter codes, see Wikipedia — ISO 3166-1 alpha-2.
Use "US*" in the GenSearch countries filter to target US non-domicile entities.
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.