Modes and Inputs
GenSearch is AlphaSense's AI-powered research tool that lets you ask natural language questions and receive comprehensive, source-backed answers drawn from AlphaSense's extensive content library. GenSearch operates through a GraphQL API and offers four distinct modes, each designed for a different depth of analysis and response time. You initiate a query with a mutation, then poll for results until the response is complete.
Mode Comparison
| Mode | Credits | Response Time | Best For |
|---|---|---|---|
fast | 10 credits | ~30s | Quick answers, real-time queries, simple lookups |
auto | 10 credits | ~30-90s | Recommended default — automatically balances speed and depth |
thinkLonger | 25 credits | ~60-90s | Deeper analysis, nuanced questions, multi-factor comparisons |
deepResearch | 100 credits | ~12-15min | Comprehensive research reports, detailed competitive analysis, investment memos |
Authentication
All GenSearch requests require authentication. First obtain a bearer token, then include it alongside your API key and client ID in every request.
- Python
- JavaScript
- cURL
import os
import requests
auth_response = requests.post( "https://api.alpha-sense.com/auth", headers={ "x-api-key":
os.environ["ALPHASENSE_API_KEY"], "Content-Type": "application/x-www-form-urlencoded", }, data={
"grant_type": "password", "username": os.environ["ALPHASENSE_EMAIL"], "password":
os.environ["ALPHASENSE_PASSWORD"], "client_id": os.environ["ALPHASENSE_CLIENT_ID"], "client_secret":
os.environ["ALPHASENSE_CLIENT_SECRET"], }, )
token = auth_response.json()["access_token"]
const authResponse = await fetch("https://api.alpha-sense.com/auth", {
method: "POST",
headers: {
"x-api-key": process.env.ALPHASENSE_API_KEY,
"Content-Type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
grant_type: "password",
username: process.env.ALPHASENSE_EMAIL,
password: process.env.ALPHASENSE_PASSWORD,
client_id: process.env.ALPHASENSE_CLIENT_ID,
client_secret: process.env.ALPHASENSE_CLIENT_SECRET,
}),
});
const { access_token: token } = await authResponse.json();
curl --request POST 'https://api.alpha-sense.com/auth' \
--header "x-api-key: $ALPHASENSE_API_KEY" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode "username=$ALPHASENSE_EMAIL" \
--data-urlencode "password=$ALPHASENSE_PASSWORD" \
--data-urlencode "client_id=$ALPHASENSE_CLIENT_ID" \
--data-urlencode "client_secret=$ALPHASENSE_CLIENT_SECRET"
GenSearchInput Schema
Before building a request, here is the full shape of the input object accepted by every GenSearch
mode. Only prompt is required — everything else is optional.
variables = {
"input": {
# Optional: continue an existing conversation (follow-up question)
# Omit or set to None for a new conversation
"conversationId": None,
# Required: your search query
"prompt": "Your search question here",
# Optional: focus on specific documents (AskInDoc)
# Cannot be combined with "filters" — use one or the other
"documents": [
{"id": "document-id-here"}
],
# Optional: narrow your search results
"filters": {
"sources": {"ids": ["source-id"]},
"industries": ["401020"],
"expertInsightsFilters": {
"analystPerspectives": ["Investor-Led (Sell-Side)"],
"expertPerspectives": ["Medical Professional"],
"expertTranscriptType": ["Company Deep-Dive"]
},
"documentAuthors": ["Author Name"],
"date": {
"customRange": {"from": "2025-01-01", "to": "2025-06-30"},
# OR use a preset instead:
# "preset": "LAST_90_DAYS"
},
"countries": ["US", "CA"],
"companies": {
"include": ["AAPL", "MSFT"],
# OR use a watchlist instead:
# "watchlists": ["watchlist-id"]
}
},
# Optional: include web search results
"useWebSearch": True
}
}
You can use documents (AskInDoc) or filters, but not both in the same request.
Key rules:
conversationIdis optional — omit it or passNonefor a new conversation; pass theidreturned by a previous GenSearch mutation to ask a follow-up question in the same threadpromptis the only required field- Within
filters, combine as many fields as you want — they use AND logic (every filter narrows the results further) - For
date, use eithercustomRangeorpreset, not both companies.includeandcompanies.watchlistscannot be combined — use one or the otheruseWebSearchlives at theinputlevel, not insidefilters