How to Integrate Semrush with Your Headless CMS
Connect Semrush to your headless CMS so every published page can pull keyword, ranking, and competitor data into the same workflow your editors already use.
What is Semrush?
Semrush is an SEO and digital marketing platform used by SEO teams, content marketers, agencies, and growth teams to research keywords, track rankings, audit sites, and analyze competitors. Its API exposes reports such as keyword volume, CPC, competition, domain organic rankings, backlinks, and traffic estimates. Teams often use Semrush as the search intelligence layer behind editorial planning, content briefs, technical SEO checks, and reporting.
Why integrate Semrush with a headless CMS?
SEO work often breaks down at the handoff. A strategist finds a target keyword in Semrush, an editor writes the page somewhere else, a developer ships it, and then someone updates a spreadsheet with the published URL. Two weeks later, nobody knows whether the page used the right keyword, which internal links were planned, or whether Semrush ranking data ever made it back to the content team.
Architecture overview
A typical Sanity and Semrush integration starts when an editor publishes an article, landing page, or product page in Sanity Studio. A Sanity webhook fires on the publish mutation and sends the document ID to a Sanity Function or your own webhook listener. The Function uses @sanity/client and GROQ to fetch the exact SEO fields needed from the Content Lake, for example title, slug, focusKeyword, targetDatabase, locale, canonicalUrl, and referenced topic clusters. It then calls Semrush's HTTP API, such as the Keyword Overview report with type=phrase_this for keyword volume and competition, or a Domain Analytics report for the published domain. The Function parses the Semrush response, writes selected metrics back to Sanity as structured fields, and your frontend renders the page from the same content source. Editors see current search data in Sanity Studio, developers use the same structured fields on the website, and SEO teams can refresh metrics on publish or on a controlled schedule.
Common use cases
Keyword metrics in the editor
Fetch Semrush search volume, CPC, competition, and trend data for a page's focus keyword and show it beside the draft in Sanity Studio.
Ranking refresh after publish
When a URL goes live, trigger a Semrush lookup for the target domain and keyword, then save the latest ranking fields back to the content record.
Topic cluster gap analysis
Use Sanity references to map pillar pages and supporting articles, then compare planned keywords against Semrush keyword reports.
Competitor-aware briefs
Pull Semrush competitor keyword data into content briefs so editors can see search intent, ranking pages, and difficulty before they write.
Step-by-step integration
- 1
Set up Semrush API access
Create or use a Semrush account with API access, then get your API key from the Semrush API settings. Check your available API units, choose the regional database you need, such as us, uk, de, or fr, and confirm which reports your plan can call.
- 2
Install the Sanity client
Semrush's public API is HTTP-based, so you don't need an official Node SDK for the basic reports. In your Function or webhook service, install @sanity/client and use fetch for Semrush requests.
- 3
Model SEO fields in Sanity Studio
Add fields such as seo.focusKeyword, seo.secondaryKeywords, seo.targetDatabase, seo.metaTitle, seo.metaDescription, seo.canonicalUrl, and seo.semrushMetrics. Keep Semrush metrics in their own object so editors can tell the difference between human-written fields and synced report data.
- 4
Create the publish trigger
Create a Sanity webhook filtered to the document types you want, such as article, landingPage, or productPage. Trigger only on publish mutations to avoid spending Semrush API units on every draft keystroke.
- 5
Call Semrush and write results back
In a Sanity Function or webhook listener, use GROQ to fetch the published document, call the Semrush API report you need, parse the response, and patch the document with selected metrics such as search volume, CPC, competition, and trend.
- 6
Test with real pages and API limits
Publish one test page with a focus keyword, verify the webhook payload, inspect the Semrush response, and confirm the metrics appear in Sanity Studio. Then add rate limiting or scheduled refreshes so you don't burn API units on low-value updates.
How Sanity + Semrush works
Build your Semrush integration on Sanity
Use Sanity's AI Content Operating System as the structured foundation, event system, and API layer for connecting published content with Semrush reports.
Start building free →CMS approaches to Semrush
| Capability | Traditional CMS | Sanity |
|---|---|---|
| SEO fields for API calls | SEO data is often mixed into plugins, page templates, or rendered HTML, so integrations may need scraping or custom exports. | SEO fields, references, locales, and Semrush metrics can live in typed schemas and be fetched together with GROQ. |
| Sync timing | Teams often rely on scheduled crawls, manual exports, or plugin-specific jobs after pages publish. | Webhooks and Functions can trigger Semrush lookups on publish, update, or delete, without a separate server for basic sync logic. |
| API cost control | Broad site crawls can spend Semrush API units on pages that didn't change. | GROQ filters and projections let you sync only published pages with a focus keyword, target database, and changed SEO fields. |
| Editor visibility | SEO metrics may live in a plugin panel or external Semrush project, separate from the content brief. | Sanity Studio can show Semrush metrics, warnings, and brief data next to the fields editors already use. |
| Multi-channel content | SEO work is usually tied to webpages first, with mobile, app, and AI use cases handled later. | The same content record can power web pages, mobile screens, Semrush reporting, and AI agents through one structured back end. |
Keep building
Explore related integrations to complete your content stack.
Sanity + Google Search Console
Bring impressions, clicks, CTR, and average position into Sanity so editors can compare planned keywords with real search performance.
Sanity + Screaming Frog
Pair structured Sanity fields with crawl data to find missing titles, duplicate descriptions, broken canonicals, and indexability issues.
Sanity + Clearscope
Connect content briefs and topic recommendations to Sanity so writers can work from search intent data inside their editorial workflow.