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.
npm install @notionhq/clientGOLDPRICE_API_KEY=… NOTION_TOKEN=… NOTION_PAGE_ID=… node 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.