Skip to main content
RapidDev - Software Development Agency
lovable-integrationsEdge Function Integration

How to Integrate Lovable with Moz

To integrate Moz with Lovable, create a Supabase Edge Function that authenticates with the Moz Link API using your Access ID and Secret Key stored in Cloud Secrets. The Edge Function fetches Domain Authority, Page Authority, and spam scores for URLs using HTTP Basic Auth. Build SEO monitoring dashboards that track DA trends over time and compare domain scores across competitors.

What you'll learn

  • How to obtain your Moz API Access ID and Secret Key
  • How to implement HTTP Basic Auth in a Deno Edge Function
  • How to fetch Domain Authority, Page Authority, and spam scores for any URL
  • How to build a DA/PA monitoring dashboard with competitor comparison
  • How to track domain authority changes over time using Supabase storage
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate11 min read35 minutesMarketingMarch 2026RapidDev Engineering Team
TL;DR

To integrate Moz with Lovable, create a Supabase Edge Function that authenticates with the Moz Link API using your Access ID and Secret Key stored in Cloud Secrets. The Edge Function fetches Domain Authority, Page Authority, and spam scores for URLs using HTTP Basic Auth. Build SEO monitoring dashboards that track DA trends over time and compare domain scores across competitors.

Track Domain Authority and Backlink Metrics with Moz and Lovable

Moz's Domain Authority (DA) and Page Authority (PA) scores are the most widely cited metrics for evaluating a website's ranking potential in search engines. DA scores range from 1 to 100 on a logarithmic scale, where higher scores indicate greater potential to rank in Google search results. While Google itself does not use DA as a ranking factor, these scores are widely used in SEO workflows for link building, outreach qualification, and competitive benchmarking.

The Moz Link API provides programmatic access to DA, PA, spam score, linking root domains, and total external links for any URL. These data points together give a comprehensive picture of any domain's link profile quality and authority.

Building a Lovable dashboard powered by Moz data requires the standard Edge Function proxy pattern. The Moz API uses HTTP Basic Auth — your Access ID and Secret Key are Base64-encoded into the Authorization header. Your Edge Function handles this server-side using credentials from Cloud Secrets, keeping them away from browser network requests. Moz's free API tier includes 10 requests per month for testing, with paid plans providing higher limits for production dashboards.

Integration method

Edge Function Integration

The Moz Link API uses HTTP Basic Auth with your Access ID and Secret Key. Because these credentials must stay server-side, all Moz API requests must be proxied through a Supabase Edge Function. The Edge Function encodes the credentials from Cloud Secrets into a Base64 Basic Auth header, calls the Moz Link API endpoints, and returns domain and page authority metrics to your Lovable frontend.

Prerequisites

  • A Lovable project with Lovable Cloud enabled
  • A Moz Pro account (free accounts have limited API access — 10 requests/month)
  • Your Moz API Access ID and Secret Key from moz.com/products/api
  • Basic understanding of HTTP Basic Auth (the Edge Function handles all encoding)

Step-by-step guide

1

Get your Moz API credentials

Log in to your Moz account at moz.com and navigate to the API section. Go to moz.com/products/api or find the API link in your account dashboard. On the API page, you will see your Access ID (a string that looks like 'mozscape-XXXXXXXX') and your Secret Key (a long alphanumeric string). If you do not see API credentials, you may need to activate API access from your account settings. The free Moz Community plan includes 10 API requests per month. For a production dashboard with regular data refreshes, you will need a Moz Pro subscription, which includes higher API limits. Copy both the Access ID and Secret Key — you will need both to authenticate. The Moz API uses HTTP Basic Auth where the username is your Access ID and the password is your Secret Key.

Pro tip: Moz API credentials are labeled 'Access ID' and 'Secret Key' — these are the username and password for Basic Auth. Do not confuse them with other Moz account tokens.

Expected result: You have your Moz Access ID and Secret Key ready to store in Cloud Secrets.

2

Store credentials in Cloud Secrets

In your Lovable project, click the plus (+) icon next to the preview to open side panels, then click the Cloud tab. Scroll to the Secrets section and click Add Secret twice, once for each credential. Add MOZ_ACCESS_ID with your Access ID value (the string starting with 'mozscape-'). Add MOZ_SECRET_KEY with your Secret Key value. Click Save after each entry. Both values are now encrypted and accessible only from Edge Functions via Deno.env.get('MOZ_ACCESS_ID') and Deno.env.get('MOZ_SECRET_KEY'). The Edge Function will combine these to create a Basic Auth header by Base64-encoding the string 'AccessID:SecretKey'. Never hardcode these values in application code — Lovable's security system actively flags hardcoded API keys, and the Moz API would be accessible to anyone who obtained them.

Pro tip: Store Access ID and Secret Key as separate secrets rather than pre-encoding them — this makes it easier to rotate individual credentials if needed.

Expected result: MOZ_ACCESS_ID and MOZ_SECRET_KEY both appear in the Cloud Secrets panel with their values masked.

3

Create the Moz Link API proxy Edge Function

Create the Edge Function that authenticates with the Moz API and fetches URL metrics. The Moz Link API v2 uses the endpoint https://lsapi.seomoz.com/v2/url_metrics with a POST body containing an array of URLs to analyze. The authentication is HTTP Basic Auth: Base64-encode the string 'AccessID:SecretKey' and pass it as the Authorization header. The response contains an array of objects with fields including domain_authority, page_authority, spam_score, root_domains_to_root_domain, and total_external_links. The function accepts a POST request from your frontend with a JSON body containing a urls array, builds the Basic Auth header from Cloud Secrets, calls the Moz API, and returns the metrics. The Moz API supports batch lookups of up to 50 URLs per request, making it efficient for competitor comparison dashboards.

Lovable Prompt

Create a Supabase Edge Function at supabase/functions/moz-proxy/index.ts that accepts POST requests with a JSON body containing a 'urls' array. Authenticate with the Moz Link API v2 using HTTP Basic Auth by Base64-encoding the MOZ_ACCESS_ID and MOZ_SECRET_KEY secrets. POST to https://lsapi.seomoz.com/v2/url_metrics with the urls array and return the results including domain_authority, page_authority, spam_score, and root_domains_to_root_domain fields.

Paste this in Lovable chat

supabase/functions/moz-proxy/index.ts
1import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'
2
3const corsHeaders = {
4 'Access-Control-Allow-Origin': '*',
5 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
6}
7
8serve(async (req) => {
9 if (req.method === 'OPTIONS') return new Response('ok', { headers: corsHeaders })
10
11 try {
12 const accessId = Deno.env.get('MOZ_ACCESS_ID')
13 const secretKey = Deno.env.get('MOZ_SECRET_KEY')
14
15 if (!accessId || !secretKey) {
16 return new Response(
17 JSON.stringify({ error: 'MOZ_ACCESS_ID or MOZ_SECRET_KEY not configured' }),
18 { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
19 )
20 }
21
22 const { urls } = await req.json()
23
24 if (!urls || !Array.isArray(urls) || urls.length === 0) {
25 return new Response(
26 JSON.stringify({ error: 'urls array is required' }),
27 { status: 400, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
28 )
29 }
30
31 // Limit batch size to 50 (Moz API maximum)
32 const batch = urls.slice(0, 50)
33
34 // Create Basic Auth header
35 const credentials = btoa(`${accessId}:${secretKey}`)
36
37 const response = await fetch('https://lsapi.seomoz.com/v2/url_metrics', {
38 method: 'POST',
39 headers: {
40 'Authorization': `Basic ${credentials}`,
41 'Content-Type': 'application/json',
42 },
43 body: JSON.stringify({ targets: batch }),
44 })
45
46 if (!response.ok) {
47 const errorText = await response.text()
48 return new Response(
49 JSON.stringify({ error: 'Moz API error', status: response.status, details: errorText }),
50 { status: response.status, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
51 )
52 }
53
54 const data = await response.json()
55
56 // Map to friendly field names
57 const results = (data.results || []).map((item: any, i: number) => ({
58 url: batch[i],
59 domain_authority: Math.round(item.domain_authority || 0),
60 page_authority: Math.round(item.page_authority || 0),
61 spam_score: Math.round((item.spam_score || 0) * 100),
62 linking_root_domains: item.root_domains_to_root_domain || 0,
63 external_links: item.external_links || 0,
64 }))
65
66 return new Response(
67 JSON.stringify({ results }),
68 { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
69 )
70 } catch (error) {
71 return new Response(
72 JSON.stringify({ error: error.message }),
73 { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
74 )
75 }
76})

Pro tip: The Moz API returns spam_score as a decimal between 0 and 1. Multiply by 100 to get a 0–100 scale that is more intuitive to display.

Expected result: The moz-proxy Edge Function accepts POST requests with a urls array and returns DA, PA, spam score, and linking root domain counts for each URL.

4

Build the DA/PA monitoring dashboard

Build the competitor comparison and monitoring dashboard in Lovable. The primary interface should have a domain input section where users can add domains to a watchlist, a comparison table showing all tracked domains with their current DA, PA, spam score, and linking root domain count, and a detail view for individual domains showing historical DA/PA data from Supabase. Ask Lovable to create a React page that: reads a domains watchlist from a Supabase table (create a simple table called moz_watchlist with domain and notes fields), calls the moz-proxy Edge Function on load to fetch current metrics for all watched domains, displays the results in a sortable table with color-coded quality indicators, stores DA snapshots in a moz_history table for trend tracking, and includes a manual refresh button to fetch updated metrics on demand.

Lovable Prompt

Create a Domain Authority monitoring dashboard. Read domains from a Supabase moz_watchlist table. On load, POST all domains to our moz-proxy Edge Function and display results in a table with columns: Domain, DA (with color bar 0-100), PA, Spam Score (red if >20), Linking Root Domains. Add a Refresh button and an Add Domain button that inserts to moz_watchlist. Store fetched metrics in a moz_history Supabase table with domain, da, pa, spam_score, and fetched_at columns so we can track trends over time.

Paste this in Lovable chat

Pro tip: Display DA as a visual bar using a colored div with width set to `${da}%` — this gives users an immediate visual comparison without needing to read exact numbers.

Expected result: A working DA monitoring dashboard showing Domain Authority, Page Authority, and spam scores for all tracked domains, with the ability to add new domains and view historical trends.

Common use cases

Domain Authority monitoring and trend tracking

Track your site's Domain Authority score over time by storing monthly snapshots in Supabase. Display a line chart showing DA progression and send alerts when DA changes significantly, helping teams see the ROI of their link building efforts.

Lovable Prompt

Create a Domain Authority tracker that stores monthly DA snapshots in Supabase for our domain. Show a line chart of DA over the last 12 months, a current DA metric card with change from last month, and a table of our top referring domains with their DA scores fetched from our Moz Edge Function.

Copy this prompt to try it in Lovable

Competitor DA comparison dashboard

Enter a list of competitor domains and instantly see their Domain Authority, Page Authority for their homepage, spam score, and linking root domain count side by side. Update the comparison on demand to track how competitors' authority changes over time.

Lovable Prompt

Build a competitor analysis dashboard where I can add domains to a watchlist stored in Supabase. For each domain, call our Moz Edge Function to get DA, PA, spam score, and linking root domains. Show a comparison table with all competitors side by side, sortable by DA. Add a Refresh All button that fetches fresh data for every domain in the list.

Copy this prompt to try it in Lovable

Link prospecting tool for outreach teams

Build a tool where link builders can paste a list of URLs from potential link sources and instantly see Moz metrics for each one. Filter out low-DA or high-spam-score domains to prioritize outreach effort toward high-quality link opportunities.

Lovable Prompt

Create a link prospect evaluator where I paste a list of URLs (one per line) and it batch-fetches Moz metrics for each using our Edge Function. Display a table with domain, DA, PA, spam score, and a quality badge (Good: DA>40 and spam<3, Average: DA 20-40, Poor: DA<20 or spam>3). Let me export the results as CSV.

Copy this prompt to try it in Lovable

Troubleshooting

Edge Function returns 401 Unauthorized from the Moz API

Cause: The Access ID or Secret Key stored in Cloud Secrets is incorrect, has extra whitespace, or the Moz API account does not have API access enabled.

Solution: Verify the exact values of MOZ_ACCESS_ID and MOZ_SECRET_KEY by going to Cloud → Secrets and re-checking against moz.com/products/api. Re-create both secrets by deleting and re-adding them. Ensure there are no leading or trailing spaces. Also verify your Moz account has API access enabled — free Community accounts may have very limited access.

Moz API returns data but domain_authority is always 0 or null

Cause: The URL passed to the Moz API must be properly formatted. Moz requires the URL to include the protocol (http:// or https://) and for domain-level lookups, should be the root domain.

Solution: Ensure URLs are prefixed with https:// before sending to the Moz API. For domain authority (as opposed to page authority), pass the root domain homepage URL like 'https://example.com' not just 'example.com'. Brand new domains with no backlinks will have a DA and PA of 1.

typescript
1// Normalize URL before sending to Moz
2const normalizedUrls = urls.map(url =>
3 url.startsWith('http') ? url : `https://${url}`
4)

Moz API returns 429 Too Many Requests

Cause: You have exceeded your Moz API rate limit for your plan tier. Free accounts have very low limits.

Solution: Implement caching in Supabase to avoid repeated API calls for the same domain. Cache results for 24 hours since Moz typically updates DA and PA scores monthly. If you need higher limits, upgrade to a Moz Pro plan with a larger API quota.

Best practices

  • Store Access ID and Secret Key as separate Cloud Secrets — this makes individual credential rotation easy without affecting the other
  • Cache Moz API responses for at least 24 hours in Supabase — DA and PA scores only update approximately monthly, so frequent API calls waste quota
  • Always normalize domain URLs to include https:// before sending them to the Moz API to ensure consistent results
  • Batch multiple URL lookups in a single Moz API call (up to 50 URLs) rather than making individual calls per URL
  • Store historical DA snapshots in a separate table to track month-over-month changes, since the Moz API only returns current values
  • Display spam scores with a clear visual warning threshold — scores above 7-8% on a 100-point scale indicate potential quality concerns
  • Add input validation to reject obviously invalid URLs before sending them to the Moz API to avoid wasting API requests
  • For the link prospecting use case, add a filter for minimum DA threshold so outreach teams can quickly remove low-quality prospects from their lists

Alternatives

Frequently asked questions

Is Moz Domain Authority an official Google ranking factor?

No. Domain Authority is a proprietary metric created by Moz, not a metric used by Google's search algorithm. Google uses hundreds of its own signals to rank pages. However, DA is widely used in the SEO industry as a proxy for ranking potential because it correlates well with Google rankings in practice, particularly for link building qualification and competitive benchmarking.

How often does Moz update Domain Authority scores?

Moz updates DA scores approximately once per month during their regular index updates. This means you do not need to call the Moz API frequently — caching responses for 24 hours or even longer is appropriate. Significant DA changes take months of link building to achieve, so daily API refreshes are wasteful.

What is Moz's spam score and how is it calculated?

Moz's spam score predicts the likelihood that a site has been penalized or is likely to be penalized by Google, based on site-level signals associated with spammy or low-quality sites. It ranges from 0 to 100, where 1-30 is low risk, 31-60 is medium, and 61-100 is high. Spam scores above 7-8% are generally considered a concern for link building prospects. The Moz API returns it as a decimal (0.05 = 5%) which you should multiply by 100 for display.

How many API requests does the free Moz plan include?

The free Moz Community plan includes 10 API requests per month with the Moz Link API. This is enough for testing but not for production dashboards. Moz Pro plans start at $99/month and include significantly higher API limits. Check moz.com/products/api for current plan details and API quota information.

Can I check DA for multiple URLs in one API call?

Yes. The Moz Link API v2 URL Metrics endpoint accepts a batch of up to 50 URLs in a single POST request. Always use batch requests rather than individual calls per URL — it is significantly more efficient and uses fewer API quota units. In your Edge Function, accept an array of URLs from the frontend and forward them all in one Moz API call.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.