TutorialsTutorial

Add the gold price to your Notion database

Fetch the price, then update your Notion row.

26 Oct 2026 · 1 min read

Put the gold price in a Notion database with a small Node.js script. Run it on a schedule to fetch the price and write it to a Number property through the Notion API.

1. Create a Notion integration

Create a Notion integration and copy its secret for the NOTION_TOKEN environment variable.

2. Connect your database

Open the database page’s Connections menu and share the page with your integration.

3. Prepare the row

Add a Number property named Price. Copy the page ID of the row you want to update for the NOTION_PAGE_ID environment variable.

4. Get a free goldprice.dev key

Get a free API key for the GOLDPRICE_API_KEY environment variable.

5. Run the script

Set GOLDPRICE_API_KEY, NOTION_TOKEN and NOTION_PAGE_ID in your environment. Run update-gold-price.mjs with Node.js to fetch the gold price and write it to Price.

Shell
npm install @notionhq/clientGOLDPRICE_API_KEY=… NOTION_TOKEN=… NOTION_PAGE_ID=… node update-gold-price.mjs
update-gold-price.mjs
// Writes the live gold price (US dollars per troy ounce) to a Notion page's Price property.import { Client } from '@notionhq/client'const res = await fetch('https://api.goldprice.dev/v1/prices?symbol=XAU-USD-SPOT', {  headers: { 'X-API-Key': process.env.GOLDPRICE_API_KEY },})if (!res.ok) throw new Error(`goldprice.dev answered ${res.status}`)const { symbols } = await res.json()const price = Number(symbols[0].price)const notion = new Client({ auth: process.env.NOTION_TOKEN })await notion.pages.update({  page_id: process.env.NOTION_PAGE_ID,  properties: { Price: { number: price } },})console.log(`Price set to ${price}`)

6. Schedule updates

Run update-gold-price.mjs on a schedule using cron on any server or a scheduled job on a CI service.

Questions

Can a Notion formula fetch the price?

No. Notion has no formula that fetches a web URL, so this setup uses a script and the Notion API.

Is there a no-code alternative?

Yes. Follow our [Zapier tutorial](/tutorials/zapier).

How often does the price update?

The script updates Price whenever it runs. Set the schedule with cron or a scheduled job on a CI service.

Keep reading

Start with a free API key

Get 5,000 requests a month with a free API key, with no card needed.

Get a free key