Fetch Moz Domain Authority, Page Authority, and link metrics for any URL using the Moz Links API in a Next.js API route. Authenticate with HTTP Basic auth using your Moz Access ID as the username and your Secret Key as the password. Store both credentials as server-only Vercel environment variables and build a V0-generated SEO authority dashboard that displays DA, PA, and spam scores for any domain.
Building an SEO Authority Dashboard with Moz Domain Authority Data in V0
Domain Authority (DA) and Page Authority (PA) are Moz's proprietary metrics — industry-standard scores used by SEO professionals worldwide to evaluate the relative strength of websites and pages. A Domain Authority score of 1-100 predicts how likely a domain is to rank in search engine results, with higher scores indicating stronger domains. Built on machine learning models trained on Moz's link index of 45 trillion links, these scores are referenced in virtually every SEO audit, competitive analysis, and link building campaign.
For V0-generated applications serving SEO professionals, marketing teams, or digital agencies, integrating Moz Authority data enables powerful features: bulk domain authority checking tools, competitor comparison dashboards, link prospect qualification workflows, and client reporting systems. These are features that SEO tools like Ahrefs and SEMrush charge premium rates for — building them with the Moz API gives you direct access to the underlying data at API pricing.
The Moz Links API v2 provides access to URL metrics including Domain Authority, Page Authority, spam score, root domains linking in, total links, and follow vs nofollow link counts. The API accepts batch requests (up to 25 URLs per request) for efficient bulk checking. Authentication uses HTTP Basic auth with your Access ID and Secret Key, making it one of the simpler API authentication patterns to implement in a Next.js API route.
Integration method
The Moz Links API uses HTTP Basic authentication with your Moz Access ID and Secret Key. Your Next.js API route calls the Moz API server-side, queries Domain Authority and link metrics for target URLs, and returns the data to your V0-generated SEO dashboard. Both API credentials are stored as server-only Vercel environment variables — never exposed to the browser.
Prerequisites
- A Moz account — sign up at moz.com (free account gives limited API access; paid plans unlock higher request limits)
- Moz Access ID and Secret Key from moz.com → Account → API Keys (or moz.com/products/api)
- Understanding that Moz's free plan includes 10 queries/month; most integrations require a paid Moz Pro subscription
- A V0 account at v0.dev and a Vercel account for deployment
Step-by-step guide
Generate the SEO Authority Dashboard UI with V0
Generate the SEO Authority Dashboard UI with V0
Start by building the SEO dashboard UI in V0 using mock DA/PA data. The visual design of authority score displays is important for usability — DA scores are meaningless numbers to non-SEO users without context, so your UI needs to provide qualitative framing alongside the numbers. In V0's chat, describe your dashboard layout. For a DA checker, this typically includes a URL input field, a submit button, and a results section showing the DA score in a visual gauge or large number display with color coding (green for strong, yellow for moderate, red for weak), followed by supporting metrics like PA, spam score, and link counts. Ask V0 to create a `DomainMetrics` TypeScript interface that matches the Moz API response structure. The key fields from the Moz Links API are: `domain_authority`, `page_authority`, `spam_score`, `root_domains_to_root_domain`, `unique_links`, and `nofollow_percent`. Defining these types early makes it easier to connect real API data to your components without type errors. Also ask V0 to generate a qualitative DA rating component that maps score ranges to descriptive labels and colors: 0-20 (Poor, red), 21-40 (Below Average, orange), 41-60 (Average, yellow), 61-80 (Good, blue), 81-100 (Excellent, green). This contextual framing makes the scores meaningful for users who are not SEO experts.
Build a Domain Authority checker with a URL input, check button, and results section. Results show: a large circular progress ring with the DA score (0-100), colored green for 60+, yellow for 40-59, orange for 20-39, red below 20. Below the ring, show 4 metric tiles: Page Authority (number with PA label), Spam Score (percentage, green if low), Root Domains Linking (number with trend), and Total Links (number). Below metrics, show a qualitative summary: 'This domain has [Excellent/Good/Average/Below Average/Poor] authority based on Moz's Domain Authority score.'
Paste this in V0 chat
Pro tip: Ask V0 to generate the DA score display as a reusable ScoreGauge component that accepts a score (0-100), a label, and a colorTheme (green/yellow/red auto-calculated from score). This lets you display DA, PA, and other 0-100 scores consistently across your dashboard.
Expected result: A complete SEO authority dashboard UI renders in V0's sandbox with mock data. The DA gauge, metric tiles, and qualitative rating display correctly. The TypeScript interfaces for Moz API data are defined.
Create the Moz Links API Route
Create the Moz Links API Route
Create a Next.js API route that fetches URL metrics from the Moz Links API v2. The Moz API uses HTTP Basic authentication — your Access ID is the username and your Secret Key is the password, encoded as Base64 in the Authorization header. The Moz Links API v2 endpoint for URL metrics is `POST https://lsapi.seomoz.com/v2/url_metrics`. The request body is a JSON object with a `targets` array of up to 25 URL strings and a `metrics` array specifying which metrics to fetch. The available metric fields include: `domain_authority`, `page_authority`, `spam_score`, `root_domains_to_root_domain`, `unique_links`, `nofollow_percent`, and others. The API returns a `results` array where each item corresponds to the input URL in the same order, containing the requested metric values. Domain Authority scores range from 1 to 100 (Moz's algorithm never returns exactly 0 or 100). Spam scores range from 0-100 where lower is better. Create `app/api/moz/url-metrics/route.ts` that accepts either a single URL as a GET query parameter or an array of URLs as a POST body, calls the Moz API with your credentials, and returns the formatted metrics. Handle rate limiting responses (429) and authentication errors (401) with appropriate error messages to help diagnose configuration issues. For bulk URL checking (the link prospect qualifier use case), accept a POST body with up to 25 URLs, batch them in a single Moz API request (the API supports this natively), and return all results at once.
Add a batch URL check mode to the SEO dashboard with a tab switch between 'Single URL' and 'Bulk Check'. The Bulk Check tab shows a textarea for entering up to 25 URLs (one per line), a minimum DA threshold input (default 40), and a Check All button. Results show in a sortable table by DA score with a 'Qualifies (DA >= 40)' badge or 'Below threshold' badge.
Paste this in V0 chat
1// app/api/moz/url-metrics/route.ts2import { NextRequest, NextResponse } from 'next/server'34const MOZ_API_URL = 'https://lsapi.seomoz.com/v2/url_metrics'56function getMozAuthHeader(): string {7 const accessId = process.env.MOZ_ACCESS_ID!8 const secretKey = process.env.MOZ_SECRET_KEY!9 return `Basic ${Buffer.from(`${accessId}:${secretKey}`).toString('base64')}`10}1112const DEFAULT_METRICS = [13 'domain_authority',14 'page_authority',15 'spam_score',16 'root_domains_to_root_domain',17 'unique_links',18 'nofollow_percent',19]2021// Normalize URL to include protocol22function normalizeUrl(url: string): string {23 if (!url.startsWith('http://') && !url.startsWith('https://')) {24 return `https://${url}`25 }26 return url27}2829export async function GET(request: NextRequest) {30 const { searchParams } = new URL(request.url)31 const url = searchParams.get('url')3233 if (!url) {34 return NextResponse.json({ error: 'url parameter required' }, { status: 400 })35 }3637 try {38 const response = await fetch(MOZ_API_URL, {39 method: 'POST',40 headers: {41 Authorization: getMozAuthHeader(),42 'Content-Type': 'application/json',43 },44 body: JSON.stringify({45 targets: [normalizeUrl(url)],46 metrics: DEFAULT_METRICS,47 }),48 next: { revalidate: 3600 }, // Cache Moz data for 1 hour49 })5051 if (response.status === 401) {52 return NextResponse.json({ error: 'Invalid Moz API credentials' }, { status: 401 })53 }5455 if (response.status === 429) {56 return NextResponse.json({ error: 'Moz API rate limit exceeded. Please try again later.' }, { status: 429 })57 }5859 if (!response.ok) {60 const error = await response.text()61 return NextResponse.json({ error: `Moz API error: ${error}` }, { status: response.status })62 }6364 const data = await response.json()65 const metrics = data.results?.[0]6667 if (!metrics) {68 return NextResponse.json({ error: 'No data returned for this URL' }, { status: 404 })69 }7071 return NextResponse.json({72 url: normalizeUrl(url),73 domain_authority: Math.round(metrics.domain_authority || 0),74 page_authority: Math.round(metrics.page_authority || 0),75 spam_score: Math.round(metrics.spam_score || 0),76 root_domains_linking: metrics.root_domains_to_root_domain || 0,77 total_links: metrics.unique_links || 0,78 nofollow_percent: Math.round(metrics.nofollow_percent || 0),79 })80 } catch (error) {81 return NextResponse.json({ error: 'Failed to fetch Moz metrics' }, { status: 500 })82 }83}8485export async function POST(request: NextRequest) {86 try {87 const { urls } = await request.json()8889 if (!Array.isArray(urls) || urls.length === 0) {90 return NextResponse.json({ error: 'urls array required' }, { status: 400 })91 }9293 if (urls.length > 25) {94 return NextResponse.json({ error: 'Maximum 25 URLs per request' }, { status: 400 })95 }9697 const targets = urls.map(normalizeUrl)9899 const response = await fetch(MOZ_API_URL, {100 method: 'POST',101 headers: {102 Authorization: getMozAuthHeader(),103 'Content-Type': 'application/json',104 },105 body: JSON.stringify({ targets, metrics: DEFAULT_METRICS }),106 })107108 if (!response.ok) {109 return NextResponse.json({ error: 'Moz API request failed' }, { status: response.status })110 }111112 const data = await response.json()113114 const results = data.results.map((metrics: any, index: number) => ({115 url: targets[index],116 domain_authority: Math.round(metrics.domain_authority || 0),117 page_authority: Math.round(metrics.page_authority || 0),118 spam_score: Math.round(metrics.spam_score || 0),119 root_domains_linking: metrics.root_domains_to_root_domain || 0,120 total_links: metrics.unique_links || 0,121 }))122123 return NextResponse.json({ results })124 } catch (error) {125 return NextResponse.json({ error: 'Bulk metrics fetch failed' }, { status: 500 })126 }127}Pro tip: Moz Domain Authority updates approximately once a month. Cache API responses for 1-24 hours using Next.js fetch cache options — DA scores do not change minute-to-minute and caching reduces API call usage significantly.
Expected result: The /api/moz/url-metrics route returns DA, PA, spam score, and link count data for any URL. GET requests check a single URL, POST requests handle bulk checking of up to 25 URLs simultaneously.
Connect the Dashboard to the API and Deploy
Connect the Dashboard to the API and Deploy
With the UI components and API route ready, connect them by updating your V0-generated components to fetch real data from your API route. The URL input form submits to your `/api/moz/url-metrics` route and the response populates the DA gauge, metric tiles, and qualitative summary. For the single URL checker, use a React client component with a `useState` for the URL input, metrics state (null initially), and loading/error states. On form submit, call `fetch('/api/moz/url-metrics?url=' + encodeURIComponent(url))` and update the metrics state with the response. The DA score gauge, PA display, and other metric tiles re-render automatically with the real data. For the bulk checker, use a POST request with the array of URLs: `fetch('/api/moz/url-metrics', { method: 'POST', body: JSON.stringify({ urls: urlArray }) })`. The results array maps directly to table rows. Add environment variables to Vercel before deploying. Go to Vercel Dashboard → your project → Settings → Environment Variables. Add `MOZ_ACCESS_ID` with your Moz Access ID from the Moz API dashboard (moz.com/api). Add `MOZ_SECRET_KEY` with your Moz Secret Key. Neither credential needs the `NEXT_PUBLIC_` prefix — both are used server-side only in your API route. After deployment, test by entering a well-known domain like 'moz.com' itself or 'wikipedia.org'. These domains have high DA scores (90+) that confirm the API is returning real data. Also test the error handling by entering an invalid domain to verify graceful error display.
Wire up the domain authority checker form to fetch from /api/moz/url-metrics?url= when submitted. Show a loading skeleton in the results area while fetching, display the real DA/PA/spam scores when loaded, and show an error card with message and retry button if the API call fails. Add a 'Copy Report' button that copies the full metrics to clipboard as formatted text.
Paste this in V0 chat
1// Vercel Dashboard → Settings → Environment Variables:2// MOZ_ACCESS_ID = your_moz_access_id3// MOZ_SECRET_KEY = your_moz_secret_key45// Client-side DA checker component6'use client'7import { useState } from 'react'89interface MozMetrics {10 url: string11 domain_authority: number12 page_authority: number13 spam_score: number14 root_domains_linking: number15 total_links: number16 nofollow_percent: number17}1819export function DomainAuthorityChecker() {20 const [url, setUrl] = useState('')21 const [metrics, setMetrics] = useState<MozMetrics | null>(null)22 const [loading, setLoading] = useState(false)23 const [error, setError] = useState<string | null>(null)2425 async function checkDomain(e: React.FormEvent) {26 e.preventDefault()27 if (!url.trim()) return2829 setLoading(true)30 setError(null)31 setMetrics(null)3233 try {34 const response = await fetch(`/api/moz/url-metrics?url=${encodeURIComponent(url.trim())}`)35 const data = await response.json()3637 if (!response.ok) {38 throw new Error(data.error || 'Failed to fetch metrics')39 }4041 setMetrics(data)42 } catch (err) {43 setError(err instanceof Error ? err.message : 'Failed to check domain')44 } finally {45 setLoading(false)46 }47 }4849 function getDaLabel(score: number): string {50 if (score >= 80) return 'Excellent'51 if (score >= 60) return 'Good'52 if (score >= 40) return 'Average'53 if (score >= 20) return 'Below Average'54 return 'Poor'55 }5657 return (58 <div className="space-y-6">59 <form onSubmit={checkDomain} className="flex gap-3">60 <input61 type="text"62 value={url}63 onChange={(e) => setUrl(e.target.value)}64 placeholder="Enter domain (e.g., example.com)"65 className="flex-1 px-4 py-2 border border-gray-300 rounded-lg"66 />67 <button68 type="submit"69 disabled={loading}70 className="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-500 disabled:opacity-50"71 >72 {loading ? 'Checking...' : 'Check DA'}73 </button>74 </form>75 {metrics && (76 <div className="space-y-4">77 <p className="text-lg font-medium">78 Domain Authority for <span className="text-blue-600">{metrics.url}</span>:79 {' '}<span className="font-bold">{metrics.domain_authority}</span> ({getDaLabel(metrics.domain_authority)})80 </p>81 </div>82 )}83 </div>84 )85}Pro tip: Add response caching to your Moz API route using Next.js { next: { revalidate: 86400 } } (24 hours). Moz DA scores update monthly, so daily caching provides fresh-enough data while dramatically reducing API call consumption.
Expected result: The deployed SEO authority dashboard fetches real Moz Domain Authority scores. Entering 'wikipedia.org' returns a high DA score (90+). The bulk checker processes up to 25 URLs in a single request. All credentials are stored securely as Vercel environment variables.
Common use cases
Domain Authority Checker Tool
An SEO consultant builds a DA checker tool for their clients. Users enter a domain name, click Check, and see the Domain Authority score, Page Authority for the homepage, spam score, and total backlink count — along with a qualitative rating (Low/Medium/High/Excellent) based on the DA score range.
Build a Domain Authority checker with a search input asking for a domain (placeholder: 'example.com'), a large Check DA button, and results showing a circular DA score gauge (0-100 with color: red 0-30, orange 31-50, yellow 51-70, green 71-100), a smaller PA score below it, a spam score bar, and three metric cards for Root Domains Linking In, Total Links, and Follow Links. Add a history of the last 5 checked domains below.
Copy this prompt to try it in V0
Competitor Domain Authority Comparison
A marketing team wants to compare their domain authority against three competitors side by side. They enter five domains and see a comparison table showing DA, PA, spam score, and total links for each, with the highest value in each column highlighted in green.
Create a competitor comparison tool with an input for up to 5 domain names (input rows with a + Add Competitor button). Show results in a comparison table with columns: Domain, DA Score (with color-coded badge), PA Score, Spam Score (low is good, show green/yellow/red), Root Domains Linking, and Total Links. Highlight the winning value in each metric column. Add an Export as CSV button.
Copy this prompt to try it in V0
Link Building Prospect Qualifier
An outreach team needs to quickly qualify link building prospects by checking their DA scores. They paste a list of URLs and get a bulk report showing which sites meet their minimum DA threshold, filtered and sorted for prioritized outreach.
Build a bulk URL checker that accepts a textarea with one URL per line (up to 25 URLs), a minimum DA filter input, and a Check All button. Show results in a table with URL, DA score, PA score, spam score. Allow sorting by DA score. Highlight rows where DA meets the minimum threshold in green, and rows below threshold in gray. Show a summary: X of Y sites qualify.
Copy this prompt to try it in V0
Troubleshooting
401 Unauthorized from Moz API despite entering credentials
Cause: The MOZ_ACCESS_ID or MOZ_SECRET_KEY is incorrect, or the credentials belong to a Moz account that does not have API access enabled. Basic auth encoding issues (extra whitespace, wrong order) also cause 401 errors.
Solution: Go to moz.com → Account Settings → API and verify your Access ID and Secret Key. The Access ID is a string like 'mozscape-XXXXXXXX', and the Secret Key is a long alphanumeric string. Ensure there are no leading or trailing spaces in your Vercel environment variable values. The authorization header format is Basic base64(accessId:secretKey) — note the colon between them.
1// Verify auth header encoding:2const auth = Buffer.from(`${process.env.MOZ_ACCESS_ID}:${process.env.MOZ_SECRET_KEY}`).toString('base64')3console.log('Auth header prefix:', `Basic ${auth}`.substring(0, 20)) // Check format in Vercel logsMoz API returns domain_authority: 0 for real websites
Cause: The URL format is incorrect. The Moz API expects URLs with protocol (https://example.com), and domains without 'www' vs with 'www' return different PA scores (though DA should be the same for the root domain).
Solution: Always normalize URLs to include the https:// protocol before sending to Moz API. Strip trailing slashes for consistency. Use the root domain (example.com) for DA checks rather than specific page URLs, which return PA for that specific page.
1function normalizeUrl(url: string): string {2 url = url.trim()3 if (!url.startsWith('http://') && !url.startsWith('https://')) {4 url = `https://${url}`5 }6 // Remove trailing slash for root domain checks7 return url.replace(/\/$/, '')8}Only getting 10 API calls per month before hitting the free tier limit
Cause: Moz's free tier includes only 10 API rows per month. Each URL in a batch request counts as one row, so 25 URLs in one request = 25 rows consumed. The free tier is intended for basic testing, not production use.
Solution: Upgrade to Moz Pro for meaningful API access limits. Alternatively, implement aggressive response caching (cache DA results for 7-30 days) to maximize your API budget. For development, use a hardcoded mock response to avoid consuming API quota.
Best practices
- Cache Moz API responses aggressively — DA scores update monthly, so caching for 24 hours or even 7 days is perfectly appropriate and dramatically reduces API quota consumption.
- Normalize all input URLs to include https:// protocol before sending to the Moz API — URLs without protocol return inconsistent or zero results.
- Store MOZ_ACCESS_ID and MOZ_SECRET_KEY as server-only Vercel environment variables without any NEXT_PUBLIC_ prefix — these credentials grant access to your Moz account's API quota.
- Always round DA and PA scores to integers — Moz returns floating point values but SEO professionals always discuss these scores as whole numbers.
- Add spam score interpretation to your UI — spam scores above 30-40% are concerning, and most users do not know the threshold without guidance.
- Provide qualitative DA labels alongside the numeric score (Poor/Below Average/Average/Good/Excellent) — numeric scores alone are not meaningful to non-SEO users.
- Implement request batching for bulk checkers — send all URLs in a single Moz API call rather than one call per URL, as each call uses your API quota even for batch requests.
Alternatives
Ahrefs provides Domain Rating (their equivalent to DA) alongside comprehensive backlink data, keyword rankings, and content analysis — a more complete SEO data platform but at a higher price point.
SEMrush offers Authority Score alongside keyword rankings, traffic data, and site audit tools, making it better for teams needing a full SEO toolkit rather than just authority metrics.
SpyFu specializes in competitor PPC and organic keyword data with its own authority metrics, better suited for competitive intelligence than pure authority measurement.
Ubersuggest provides domain authority scores and keyword data through Neil Patel's API, offering a more affordable alternative with similar domain authority metrics.
Frequently asked questions
Where do I find my Moz Access ID and Secret Key?
Log in to moz.com and navigate to your account settings. Go to moz.com/api or Account → API Access. Your Access ID is displayed in the format 'mozscape-XXXXXXXX'. Click 'Show Secret Key' to view your Secret Key. If you do not have API access, you may need to enable it or upgrade your Moz plan — the free tier includes limited API access.
How often does Moz update Domain Authority scores?
Moz updates Domain Authority scores approximately once per month as part of their regular link index updates. The update date is published on Moz's blog. This means caching DA scores for days or even weeks is appropriate — the data you cache today will still be accurate tomorrow.
What is a good Domain Authority score?
DA is relative, not absolute. A DA of 40 for a local business is excellent; for a major news site, it would be weak. In general: new sites score 1-20, established sites with some backlinks score 20-40, reputable sites with strong backlinks score 40-60, authority sites like industry publications score 60-80, and major sites like Wikipedia or Amazon score 80+. Compare DA within the same competitive niche for meaningful context.
Can I check Domain Authority for subdomains separately?
Yes. The Moz Links API returns different metrics for subdomains vs root domains. Checking subdomain.example.com returns the PA (Page Authority) for that subdomain and the DA for example.com as the root domain. To specifically check subdomain authority, use the full subdomain URL in your API request.
How many URLs can I check in a single Moz API request?
The Moz Links API v2 supports batching up to 25 URLs in a single POST request. Each URL in the batch consumes one API row from your quota. For bulk DA checking tools, send up to 25 URLs per request and handle pagination client-side if users need to check more than 25 at once.
Is Moz Domain Authority the same as Google PageRank?
No. Domain Authority is Moz's proprietary metric, not an official Google metric. Google stopped publicly showing PageRank scores in 2016. DA is a third-party prediction of how well a domain might rank, calculated from Moz's own link index and machine learning models. While DA correlates with Google ranking ability, it is not used directly by Google and should be understood as a comparative benchmarking tool, not a definitive measure of Google ranking potential.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation