To display a stock on a watchlist, you need its quoted price. To chart how that price has changed, you need a series of prices and timestamps. The Yahoo! Finance API from SerpApi can return both in a single ticker lookup. In this guide, you'll make that request with cURL, read the results in Python or JavaScript, and export the price history to CSV.

What data can you retrieve with the Yahoo! Finance API?
For a ticker lookup, start with two top-level fields: summary is an object describing the quote; graph is a separate array with one entry per chart point.
- Quote for display or calculation:
summary.priceis the formatted regular-session price,summary.extracted_priceis its numeric value, andsummary.currencytells you the unit. - Chart data: Pair each point's
datewith itscloseto plot a price against a timestamp in the exchange's time zone. - Trading activity:
stats.previous_close.extracted_valuegives you the previous closing price, andstats.volume.extracted_valuegives you the trading volume as a number. - Earnings: For a stock like Apple,
earnings.quarterlycan include bothactualandestimate, so you can compare reported earnings per share with expectations. - Symbol lookup: A company-name search returns matches in
suggestions; each match has astocksymbol and aserpapi_linkfor looking up its quote with the same API.
The available fields depend on the instrument. See the API documentation for the full list and examples for stocks, ETFs, and cryptocurrencies.
How to use the Yahoo! Finance API
You can use our API with any AI tools or any programming language.
Try it in the Playground
Open the AAPL example in the Playground. With engine=yahoo_finance and q=AAPL, look at summary.price and summary.date together: that's the quoted price and the time it was reported. Feel free to change the search query to another item you want to check.
Get your API key
Create a SerpApi account, then copy your key from Manage API Key. In the terminal where you'll run the examples, replace the placeholder with your own key:
export SERPAPI_API_KEY="YOUR_SERPAPI_API_KEY"Keep the key out of source files, screenshots, and shared URLs.
Make a GET request
Our API is accessible in a simple GET request. JSON is the default. Use this form when your code needs exact fields
https://serpapi.com/search?engine=yahoo_finance&q=AAPL&api_key=YOUR_SERPAPI_API_KEY
For a readable version of the same lookup, add output=md. Markdown output presents a selection of the data rather than every JSON field:
https://serpapi.com/search?engine=yahoo_finance&q=AAPL&api_key=YOUR_SERPAPI_API_KEY&output=md
cURL implementation
Here's the equivalent of the request in cURL. engine selects Yahoo! Finance, q supplies the ticker, and api_key authenticates the request.
curl --get --fail 'https://serpapi.com/search' \
--data-urlencode 'engine=yahoo_finance' \
--data-urlencode 'q=AAPL' \
--data-urlencode "api_key=$SERPAPI_API_KEY"
Python implementation
Install the SerpApi Python SDK in your Python environment:
pip install serpapiSave this as main.py. The SDK returns a dictionary-like result, so you can read the quote and loop over the chart points directly.
import os
import serpapi
symbol = "AAPL"
client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"], timeout=60)
result = client.search({"engine": "yahoo_finance", "q": symbol})
if "error" in result:
raise SystemExit(f"SerpApi returned an error for {symbol}.")
summary = result.get("summary") or {}
print(f"{symbol} regular-session price:", summary.get("price", "not available"))
points = result.get("graph") or []
if not points:
print("No chart points returned.")
for point in points[:5]:
print(point.get("date", "n/a"), point.get("close", "n/a"), sep=" | ")
Run the code with:
python your-file-name.py
The first line is the price you'd display on the watchlist. The next lines are timestamp | close, up to five points in response order. An empty chart gets its own message; a failed lookup stops the script instead.
Export the chart to CSV
To keep every point, append this block to main.py. It reuses points from the same response, so the export doesn't need a second request. Each entry becomes one row with the ticker, the timestamp as returned, and the closing price. Missing values stay blank.
import csv
if points:
with open("prices.csv", "w", encoding="utf-8", newline="") as file:
writer = csv.writer(file)
writer.writerow(["symbol", "date", "close"])
for point in points:
writer.writerow([symbol, point.get("date"), point.get("close")])Run python your-file-name.py with the block in place. If there are chart points, the script writes prices.csv in your current directory, replacing any file of that name.

JavaScript implementation
To print the same fields in Node.js, install the SerpApi JavaScript library:
npm install serpapiSave this as main.js:
async function main() {
const apiKey = process.env.SERPAPI_API_KEY;
if (!apiKey) {
console.error("Set SERPAPI_API_KEY before running main.js.");
process.exitCode = 1;
return;
}
const { getJson } = await import("serpapi");
const symbol = "AAPL";
const result = await getJson({ engine: "yahoo_finance", q: symbol, api_key: apiKey });
if ("error" in result) {
console.error(`SerpApi returned an error for ${symbol}.`);
process.exitCode = 1;
return;
}
console.log(`${symbol} regular-session price:`, result.summary?.price ?? "not available");
const points = result.graph ?? [];
if (!points.length) console.log("No chart points returned.");
for (const point of points.slice(0, 5)) {
console.log(`${point.date ?? "n/a"} | ${point.close ?? "n/a"}`);
}
}
main().catch(() => {
console.error("Could not complete the lookup. Check the SDK installation, API key, and connection.");
process.exitCode = 1;
});
Run it with:
node main.jsOther languages and no-code options
Check our integrations page for more programming languages. We also have CLI and MCP available for your AI tools:

You can also use a tool like Make.com with a custom HTTP request:

Customize the chart range and region
windowsets the time span of the graph. Use1Dfor one day,YTDfor the year to date, or1Yfor one year. A one-year chart can also include the open, high, low, and volume for each interval.yahoo_domainselects the regional edition. The default isfinance.yahoo.com;deselectsde.finance.yahoo.com. This changes number formatting and which tickers appear in the regional market lists. It doesn't convert the quote to euros. Usesummary.extracted_pricefor arithmetic rather than parsing a localized price string.
For example, to request a year of Apple chart data, keep the ticker and add window=1Y:
https://serpapi.com/search?engine=yahoo_finance&q=AAPL&window=1Y&api_key=YOUR_SERPAPI_API_KEYConclusion
You now have two pieces for a watchlist row: a regular-session price for the label and timestamped closes for the chart. To see the difference the time range makes, open the AAPL Playground example, set window to 1Y, and compare the dates of the first few chart points with the original response.
We also have a Google Finance API if you want to check the data from the Google Finance page. Here is the full tutorial:

Frequently asked questions
What if I know the company name but not its ticker?
We have the Google Finance Autocomplete API to search listings name based on the company name.
Why are there gaps in the chart?
Yahoo! Finance has no price point for an interval without a trade. That can leave several minutes between points, especially outside the regular session. Plot the returned timestamps rather than assuming rows are evenly spaced.
How fresh is the displayed price?
We always perform live scraping on the website. Check summary.date, for the time information from Yahoo.
Warning: An identical request can use SerpApi's cache for up to an hour. no_cache=true requests a fresh fetch.


