Skip to main content
RapidDev - Software Development Agency
retool-integrationsREST API Resource

How to Integrate Retool with SpyFu

Connect Retool to SpyFu using a REST API Resource with API key authentication. Configure the SpyFu API base URL and secret key parameter, then build queries to pull competitor keyword data, ad spend estimates, and PPC history. The setup takes about 10 minutes and enables competitive intelligence dashboards for marketing teams.

What you'll learn

  • How to find your SpyFu API key and configure it as a REST API Resource in Retool
  • How to build queries to fetch competitor keyword lists, ad spend estimates, and PPC data
  • How to build a competitive intelligence dashboard with Tables and Charts in Retool
  • How to compare multiple competitors' keyword strategies in a single Retool view
  • How to use JavaScript transformers to calculate keyword overlap and opportunity gaps
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner14 min read10 minutesSEOLast updated April 2026RapidDev Engineering Team
TL;DR

Connect Retool to SpyFu using a REST API Resource with API key authentication. Configure the SpyFu API base URL and secret key parameter, then build queries to pull competitor keyword data, ad spend estimates, and PPC history. The setup takes about 10 minutes and enables competitive intelligence dashboards for marketing teams.

Quick facts about this guide
FactValue
ToolSpyFu
CategorySEO
MethodREST API Resource
DifficultyBeginner
Time required10 minutes
Last updatedApril 2026

Why Connect Retool to SpyFu?

Marketing teams that do competitive analysis manually — running individual SpyFu searches for each competitor domain, exporting CSVs, and comparing in spreadsheets — spend hours on work that a Retool dashboard can automate in minutes. Connecting Retool to SpyFu's API lets teams build internal competitive intelligence panels that pull fresh data for any domain on demand, compare multiple competitors side-by-side, and spot keyword opportunities automatically.

SpyFu's API exposes domain keyword data (both paid and organic), PPC ad history, estimated monthly ad budgets, keyword ranking data, and competitive overlap metrics. In Retool, these endpoints become queryable through a visual interface — marketing analysts can build dashboards that would otherwise require developer resources to create. The data refreshes on demand by clicking a button, rather than requiring manual CSV exports.

The most valuable use cases center on PPC competitor intelligence: identifying which keywords competitors are spending money on (indicating profitable terms), seeing the actual ad copy they use for those keywords, and spotting gaps where competitor spending is low but search volume is high. Retool's Table and Chart components make these comparisons immediately visual, turning raw SpyFu API data into actionable competitive insights for paid search managers.

Integration method

REST API Resource

SpyFu does not have a native Retool connector. Integration is achieved by configuring the SpyFu REST API as a REST API Resource in Retool. Authentication uses a secret_key parameter appended to every API request URL. Once the resource is configured with the base URL and API key, all competitive analysis queries are built visually in the Retool query editor. Retool proxies all requests server-side, keeping your API key off the browser.

Prerequisites

  • A SpyFu account on a paid plan that includes API access (Basic or higher)
  • A SpyFu API key (secret_key) available from your SpyFu account settings
  • A Retool account (Cloud or self-hosted) with permission to add Resources
  • Basic familiarity with the Retool query editor and component panel

Step-by-step guide

1

Locate your SpyFu API key and store it in Retool

Log in to your SpyFu account at spyfu.com. Navigate to your account settings by clicking your profile name in the top navigation bar and selecting Account Settings or API from the dropdown. SpyFu provides a secret_key (sometimes also called an API key) for programmatic access to the API. Copy this key — it is a long alphanumeric string that authenticates all API requests. SpyFu's API authentication is simple: you append the secret_key as a URL parameter to every request. While this is a straightforward authentication pattern, it means the key could be visible in server logs or network monitoring if not handled carefully. Retool's server-side proxy prevents the key from reaching the browser. In Retool, navigate to Settings (gear icon in the left sidebar on the Retool home page) → Configuration Variables. Click Add Variable, set the name to SPYFU_SECRET_KEY, paste your API key as the value, and toggle the Secret switch to On. Marking as Secret ensures the variable is only accessible in resource configurations and never sent to the browser. Click Save. This one-time setup makes the key available across all Retool apps without requiring it to be typed into individual queries.

Pro tip: SpyFu API access may require a specific paid plan. If you cannot find an API key in your account settings, contact SpyFu support or check their pricing page to confirm API access is included in your current subscription tier.

Expected result: Your SpyFu API key (secret_key) is stored as a Secret Configuration Variable in Retool. You are ready to configure the REST API Resource.

2

Create a SpyFu REST API Resource in Retool

Navigate to the Resources tab in the Retool left sidebar or top navigation. Click the Add Resource button in the top right corner. In the resource type selector, search for 'REST API' or scroll to find it, then click REST API to open the configuration form. In the Name field, enter 'SpyFu API'. In the Base URL field, enter the SpyFu API base URL: https://www.spyfu.com/apis/domain_api — note that SpyFu organizes its API into multiple sub-APIs (domain_api, keyword_api, etc.), each with its own base URL path. You may choose to create one resource per SpyFu API group, or set the base URL to https://www.spyfu.com/apis and specify the sub-path in individual queries. For authentication, SpyFu uses a URL parameter (secret_key) rather than an HTTP header. Scroll to the URL Parameters section in the resource configuration and click Add parameter. Set Key to secret_key and Value to {{ retoolContext.configVars.SPYFU_SECRET_KEY }}. This appends your API key to every request URL automatically. Add a Header: Key = Accept, Value = application/json. Click Save Changes. The SpyFu API resource now appears in your Resources list. Because SpyFu has multiple API modules with different base URLs, you may need additional resources (e.g., one for keyword_api) — follow the same steps with the appropriate base URL for each.

Pro tip: SpyFu's domain_api and keyword_api have different base URL paths. If you query both in the same dashboard, create two separate REST API Resources (one per base URL) to keep configuration clean, rather than overriding the base URL in individual queries.

Expected result: A 'SpyFu API' REST API Resource appears in the Retool Resources list with the base URL and secret_key URL parameter configured. The key is dynamically injected from the Configuration Variable.

3

Build queries to fetch competitor keyword and spend data

Open or create a Retool app. In the Code panel at the bottom, click + New to create your first query. Name it getDomainPaidKeywords. Select your SpyFu API resource. Set method to GET and path to /v2/domain/getTopPaidKeywords (verify the exact endpoint from SpyFu's API documentation). Add URL parameters: domain = {{ domainInput.value }}, pageSize = 100, startingRow = 1. The secret_key parameter is already included automatically from the resource configuration. Set Trigger to run automatically when domainInput.value changes. Click Run with a test domain (e.g., 'example.com') to verify the response structure. Create a second query named getDomainMetrics. Resource = SpyFu API, method = GET, path = /v2/domain/getAdHistory. Add parameter: domain = {{ domainInput.value }}. This retrieves historical ad data including estimated monthly budget over time. Create a third query named getKeywordCompetitors. Resource = SpyFu API, path = /v2/domain/getTopCosPaidKeywordsOverlap or the equivalent overlap endpoint. Add parameter: domain = {{ domainInput.value }}. This returns domains that overlap in PPC keyword targeting with the queried domain. These three queries provide the data for a competitive PPC intelligence dashboard covering keyword lists, spend estimates, and competitive overlap.

formatPaidKeywords.js
1// JavaScript transformer to format paid keyword data for Table display
2// Attach to getDomainPaidKeywords query (Advanced → Transform data)
3const result = data;
4if (!result || !result.results) return [];
5
6return result.results.map(kw => ({
7 keyword: kw.keyword || kw.term || 'Unknown',
8 monthlySearches: (kw.searchVolume || kw.searches || 0).toLocaleString(),
9 estimatedCpc: kw.averageCpc
10 ? `$${parseFloat(kw.averageCpc).toFixed(2)}`
11 : 'N/A',
12 estimatedMonthlyCost: kw.monthlyBudget
13 ? `$${parseFloat(kw.monthlyBudget).toFixed(0)}`
14 : 'N/A',
15 position: kw.rank || kw.position || 'N/A',
16 competition: kw.competition
17 ? (kw.competition * 100).toFixed(0) + '%'
18 : 'N/A'
19})).sort((a, b) => {
20 const aSearches = parseInt((a.monthlySearches || '0').replace(/,/g, ''));
21 const bSearches = parseInt((b.monthlySearches || '0').replace(/,/g, ''));
22 return bSearches - aSearches;
23});

Pro tip: SpyFu API responses may differ slightly in field names between the v1 and v2 endpoints and between the domain_api and keyword_api modules. Always inspect the raw response first by clicking the Query Inspector or Result tab in Retool before building transformers.

Expected result: Three queries are fetching SpyFu data: getDomainPaidKeywords returns competitor paid keywords, getDomainMetrics returns historical spend data, and getKeywordCompetitors returns domains with overlapping PPC strategies.

4

Build the competitive intelligence dashboard UI

Assemble the dashboard interface. At the top of the canvas, drag a Text Input component labeled 'Competitor Domain' with placeholder 'e.g., competitor.com'. Next to it, add a Button labeled 'Analyze Domain' that triggers getDomainPaidKeywords, getDomainMetrics, and getKeywordCompetitors simultaneously via three event handlers. Below the input row, drag three Stat components. Configure them with data from getDomainMetrics: Estimated Monthly Ad Spend (format as currency), Total PPC Keywords, and Organic Keywords Count. These give an instant overview of a competitor's search investment. Drag a Table component onto the main canvas area. Set Data source to {{ getDomainPaidKeywords.data }} with the formatPaidKeywords transformer applied. Configure visible columns: keyword, monthlySearches, estimatedCpc, estimatedMonthlyCost, position, and competition. Enable column sorting so users can rank by monthly searches or CPC. Add a column filter using the searchInput component to narrow results to specific keyword themes. Drag a Chart component alongside the Table. Set type to Bar. Create a transformer that extracts the top 15 paid keywords by monthly search volume and maps them to { keyword, monthlySearches } objects. Set X-axis to keyword (truncated for display) and Y-axis to monthlySearches. This bar chart immediately visualizes the highest-traffic terms a competitor is targeting. For marketing teams doing systematic competitive analysis across large keyword sets, RapidDev's team can help build advanced multi-competitor dashboards with keyword gap analysis.

topKeywordsChart.js
1// Standalone transformer for top keywords Bar chart
2// Reference as {{ topKeywordsChartData }} in Chart Data source
3const keywords = getDomainPaidKeywords.data;
4if (!keywords || !keywords.results) return [];
5
6return keywords.results
7 .filter(kw => kw.searchVolume > 0)
8 .sort((a, b) => (b.searchVolume || 0) - (a.searchVolume || 0))
9 .slice(0, 15)
10 .map(kw => ({
11 keyword: kw.keyword && kw.keyword.length > 25
12 ? kw.keyword.substring(0, 25) + '...'
13 : kw.keyword,
14 searches: kw.searchVolume || 0
15 }));

Pro tip: Add a second Text Input for 'Your Domain' and create a comparison mode that fetches paid keywords for both domains and highlights terms the competitor bids on that you do not — this keyword gap view is often the most actionable output for PPC managers.

Expected result: The dashboard shows a domain input, three Stat cards with spend overview, a sortable keyword table with CPC estimates, and a bar chart of the top 15 paid keywords by search volume.

5

Add keyword overlap comparison and multi-competitor analysis

Extend the dashboard with multi-competitor comparison. Add two more Text Input components labeled 'Competitor 2' and 'Competitor 3'. Create duplicate queries for each competitor domain (getDomainPaidKeywords2, getDomainPaidKeywords3) that reference the second and third text inputs. Set all queries to run on the Analyze button click. Create a JavaScript transformer named keywordOverlapAnalysis. This transformer takes the keyword lists from all three competitor queries and your domain query, then computes overlap and gap metrics: keywords all competitors bid on (high competition, likely profitable), keywords only one competitor bids on (niche opportunities), and keywords no one bids on above a certain search volume threshold (blue ocean opportunities). Drag a new Table component below the main keyword table labeled 'Keyword Gaps - Opportunities'. Bind it to the keywordOverlapAnalysis transformer output. Configure columns: keyword, monthly searches, number of competitors targeting it, and an Opportunity Score (calculated as search volume / number of competitors bidding). Sort by Opportunity Score descending to surface the best PPC targets. Add a second Chart showing a comparison of estimated monthly spend for all analyzed domains as a grouped bar chart. This lets account managers quickly see where competitors are concentrating budget and whether the investment trend is increasing or decreasing.

keywordGapAnalysis.js
1// Keyword gap and overlap analysis transformer
2// Compares keyword lists from multiple competitor queries
3const myKeywords = new Set(
4 (getDomainPaidKeywords.data?.results || []).map(k => k.keyword)
5);
6const comp1Keywords = getDomainPaidKeywords1?.data?.results || [];
7const comp2Keywords = getDomainPaidKeywords2?.data?.results || [];
8
9// Find keywords competitors bid on that you don't
10const allCompKeywords = [...comp1Keywords, ...comp2Keywords];
11const gaps = allCompKeywords
12 .filter(kw => !myKeywords.has(kw.keyword))
13 .reduce((acc, kw) => {
14 const existing = acc.find(k => k.keyword === kw.keyword);
15 if (existing) {
16 existing.competitorCount++;
17 } else {
18 acc.push({
19 keyword: kw.keyword,
20 monthlySearches: kw.searchVolume || 0,
21 estimatedCpc: `$${parseFloat(kw.averageCpc || 0).toFixed(2)}`,
22 competitorCount: 1,
23 opportunityScore: (kw.searchVolume || 0)
24 });
25 }
26 return acc;
27 }, [])
28 .sort((a, b) => b.opportunityScore - a.opportunityScore);
29
30return gaps.slice(0, 50);

Pro tip: SpyFu's API has rate limits that vary by plan. For multi-domain queries that fire simultaneously, add a 1-2 second debounce between queries or use a single Analyze button that fires queries sequentially via chained event handlers to avoid hitting rate limits.

Expected result: The dashboard now supports up to 3 competitor domains simultaneously. A keyword gap Table shows PPC opportunities with opportunity scores, and a comparison Chart shows relative ad spend across all analyzed domains.

Common use cases

Build a competitor PPC analysis dashboard

Create a Retool dashboard where users enter a competitor domain, and the app automatically queries SpyFu for that domain's top paid keywords, estimated monthly ad spend, and most-clicked ads. Display keywords in a Table sorted by estimated monthly cost, with a Bar chart showing the top 20 keywords by monthly search volume.

Retool Prompt

Build a competitor PPC dashboard with a domain text input. When the user submits a domain, fetch SpyFu data for that domain and show a table of paid keywords with columns for keyword, monthly searches, estimated CPC, estimated monthly cost, and position. Add a bar chart of the top 20 keywords by search volume.

Copy this prompt to try it in Retool

Compare keyword overlap between your domain and competitors

Build a Retool app that queries SpyFu for the paid keywords of your domain and up to 3 competitor domains, then uses a JavaScript transformer to calculate keyword overlap (terms you and competitors both bid on) and gap analysis (high-traffic terms competitors bid on that you don't). Display results in a Table with overlap percentage and a color-coded opportunity indicator.

Retool Prompt

Build a keyword gap analysis panel that takes your domain and up to 3 competitor domains as inputs, fetches each domain's paid keyword list from SpyFu, and displays a table showing keywords that competitors target but your domain doesn't, sorted by estimated monthly search volume.

Copy this prompt to try it in Retool

Track competitor ad spend trends over time

Create a Retool analytics dashboard that fetches SpyFu monthly ad spend estimates for a list of competitor domains stored in a database, records the values as daily snapshots in a PostgreSQL table, and displays a Line chart showing each competitor's estimated spend trajectory over the past 6 months — enabling trend detection before competitors make major strategic moves.

Retool Prompt

Build a competitor spend tracker that shows a multi-line chart of estimated monthly PPC spend for up to 5 competitors, with data snapshots stored daily in a database. Add a table below showing each competitor's current spend estimate and month-over-month change.

Copy this prompt to try it in Retool

Troubleshooting

API queries return 401 Unauthorized or an error about invalid API credentials

Cause: The secret_key URL parameter is not being correctly appended to requests, or the key stored in Configuration Variables contains extra characters or whitespace.

Solution: Open the SpyFu API resource configuration (Resources tab → SpyFu API → Edit) and verify the URL parameter value is {{ retoolContext.configVars.SPYFU_SECRET_KEY }} without any extra spaces. Check the actual URL being constructed in the query's Request tab — the secret_key should appear as a URL parameter in the full request URL. If the parameter name differs from 'secret_key' (SpyFu may use 'api_key' or 'secret'), update the parameter key name accordingly.

Keyword query returns results but SpyFu data fields show null or undefined in the Table

Cause: SpyFu API response field names differ between the v1 and v2 API versions, or between the domain_api and keyword_api modules — the transformer references field names that do not exist in the actual response.

Solution: Open the query and click the Result tab (or Query Inspector) to see the raw JSON response from SpyFu. Identify the exact field names for keywords, search volume, CPC, and other metrics. Update the transformer to reference the correct field names. SpyFu commonly uses 'searchVolume', 'averageCpc', 'rank' but may also use 'searches', 'cpc', 'position' depending on the endpoint.

Domain input with 'www.' prefix returns no results while the same domain without 'www.' returns data

Cause: SpyFu's API may normalize domain input differently depending on the endpoint — some endpoints require domains without the 'www.' prefix and without 'http://' or 'https://' schemes.

Solution: Add a JavaScript transformer or inline expression to normalize the domain input before passing it to the query: {{ domainInput.value.replace(/^(https?:\/\/)?(www\.)?/, '').replace(/\/$/, '') }}. This strips the protocol and www prefix, and trailing slashes, leaving a clean domain like 'competitor.com'. Apply this normalization in the URL parameter value rather than requiring users to enter the exact format.

typescript
1// Domain normalization in URL parameter value
2{{ domainInput.value.replace(/^(https?:\/\/)?(www\.)?/, '').replace(/\/$/, '') }}

Best practices

  • Store your SpyFu secret_key in Retool Configuration Variables marked as Secret — even though SpyFu uses URL parameter auth, the key should never appear in browser network requests, which the Retool server-side proxy ensures.
  • Add domain input normalization to strip www., http://, and trailing slashes before passing to API parameters — inconsistent domain formats are the most common cause of empty results.
  • Use a Button to trigger competitive analysis queries rather than auto-running on input change — SpyFu API calls can be slow and each query consumes API quota, so triggering only on demand is more efficient.
  • Cache SpyFu query results for 60-120 minutes since competitor data does not change in real time — this significantly reduces API calls for repeated analyses of the same domains.
  • Build multi-competitor comparison by loading data for several domains into separate query slots and using a transformer to merge and compare the results rather than making the UI depend on multiple simultaneous API calls.
  • Track which competitor domains your team frequently monitors and store them in a Retool Database or database table — populate a Select component with saved competitors so analysts don't have to type domain names each session.
  • Combine SpyFu data with Google Ads data (from a separate Retool resource) to validate SpyFu's spend estimates against your own campaign data — this calibration improves trust in the competitive intelligence.

Alternatives

Frequently asked questions

Does Retool have a native SpyFu connector?

No. Retool does not include a dedicated SpyFu connector. Integration is achieved by configuring SpyFu's REST API as a generic REST API Resource in Retool's Resources tab with the secret_key URL parameter. Once configured, all SpyFu queries — domain keywords, ad history, competitor overlap — are built visually in Retool's query editor.

How accurate is SpyFu's estimated ad spend data?

SpyFu's ad spend estimates are derived from their web crawler's observations of ad appearances, search volumes, and historical CPC data — they are estimates, not exact figures. Accuracy varies by domain size and niche; high-traffic domains in well-tracked industries tend to have more accurate estimates than niche or smaller advertisers. Use SpyFu data for directional intelligence and trend analysis rather than precise budget reconciliation.

Can I use SpyFu data in Retool to automatically identify new PPC keywords to target?

Yes. By comparing your domain's current keyword list against competitor keyword data from SpyFu, you can build a gap analysis that surfaces high-volume keywords competitors bid on that you do not. A JavaScript transformer can calculate an 'Opportunity Score' based on search volume, competitor CPC, and number of competitors bidding. Display these in a priority-ranked Table to give your PPC team a ready list of keyword expansion candidates.

Does SpyFu's API cover organic search data, or only PPC?

SpyFu's API covers both paid search (PPC) and organic search data. Separate endpoints provide organic keyword rankings, estimated organic traffic, and SEO competitor analysis alongside the PPC data. In Retool, create separate queries for each data type — for example, getDomainOrganicKeywords for SEO data and getDomainPaidKeywords for PPC data — and present them in tabs on the same dashboard for a complete competitive view.

RapidDev

Talk to an Expert

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

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

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.