Skip to main content

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.


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

filingTypesV3 returns a single JSON value (a blob). Request it without sub-selections:

query Query {
filingTypesV3
}
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.

note

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
}
}
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.