Prerequisites
Before starting, make sure you have:- A theStacc project with Content SEO enabled and at least one published blog
- Your Public API Key (more on where to find it below)
- A static site built with Astro, Next.js, Hugo, Nuxt, or any other static site generator
- Your site deployed on Cloudflare Pages, Vercel, Netlify, or similar
Overview
The integration has three parts:- Fetch — Your site calls the theStacc API at build time to get blog data
- Render — Your generator turns the API response into static HTML pages
- Rebuild — A deploy hook triggers a new build whenever you publish or unpublish a post
Get your API key
Every project has its own Public API Key. To find it, open your project and go to Content > Settings > Publishing, then scroll to the API Access section. In that section you’ll see:- Public API Key — your key, starting with
pk_live_. Use Reveal to show it and Copy to copy it to your clipboard. - Rotate Key — generates a brand-new key and immediately invalidates the old one. Use this if the key was ever exposed. After rotating, update the key everywhere you’ve stored it, or your builds will start failing.
- Revoke — removes the key entirely. Any site using it will stop fetching content until you generate a new one.
Environment setup
Store your API key as an environment variable. Never hardcode it in your source files. Create or update your.env file:
.env to your .gitignore if it’s not already there.
For your hosting platform, add the same variables in the dashboard so they’re available during the build:
- Cloudflare Pages — Settings > Environment variables
- Vercel — Settings > Environment Variables
- Netlify — Site configuration > Environment variables
https://api.thestacc.com/blog/api/v1/public/blogs. The three endpoints you’ll use are:
GET /— list published blogs (metadata only by default; addinclude_content=truefor full HTML)GET /{slug}— one published blog by slug (always includes full HTML content)GET /sitemap— a lightweight list of slugs and dates for building your sitemap
