Published on Thu Aug 20 2026 00:00:00 GMT+0000 (Coordinated Universal Time) by Miguel Gonzalez Herrera
Before diving in, a caveat: the legaltech/ine actor isn’t a strictly “legal” connector — it doesn’t query case law, legislation, or legal databases, but official statistics from Spain’s National Statistics Institute (INE). Still, having direct access to that social and economic data is also an advantage for anyone practicing law. Legal reality is, almost always, the consequence of a prior social reality: a mortgage foreclosure doesn’t appear out of nowhere — it appears because a given territory signed a large number of mortgages during an expansion period, and some of them later stopped being paid. Understanding that statistical backdrop — how many mortgages are behind it, how it evolves, which provinces concentrate the foreclosures — gives context to a specific case or legal problem that no legal search engine will give you.
Every month, Spain’s National Statistics Institute (INE) publishes two separate statistics: mortgages granted (how many are signed) and mortgage foreclosures (how many end up in a judicial procedure). Each lives in its own statistical operation, with its own tables and its own codes. Cross-referencing them — by province, by year, working out what percentage of a region’s new mortgages ends in foreclosure — isn’t something you can ask a search engine for: it’s a calculation you have to assemble yourself, table by table. In this guide you’ll see how the Apify MCP, connected to Claude, does that cross-reference for you — and we’ll use the INE’s own data to build the charts in this article.
📊 What Does the legaltech/ine Actor Do (and What Isn’t It For)?
The legaltech/ine actor is a natural-language semantic layer on top of the INE’s full catalog, including the Mortgage Statistics (HPT) and the Mortgage Foreclosure Statistics (EH). The workflow always follows the same steps:
- Search for the table or statistical operation from your question, combining the actor’s internal catalog with the INE’s own search engine.
- Inspect that table’s dimensions (province, property type, holder type, period…) and the values available for each one.
- Filter and extract the numeric data, with stable links back to the source so you can cite it.
If you ask it how many mortgages were signed in Spain last month, you’ll get an answer, but that figure is already in the INE’s monthly press release and in dozens of financial outlets that summarize it the same day — that’s not where the actor adds the most value. Where it really shines is the cross-reference nobody has done for you: taking the mortgage table and the foreclosure table, aligning them by province and year, and computing a ratio that exists nowhere in published form because it requires combining two separate statistical operations.
🔍 The Real Use Case: A Ratio That Doesn’t Exist Until You Calculate It
The starting question is this:
What percentage of the mortgages granted in each province in 2024 ended in a foreclosure registered that same year?
Nobody publishes this figure by province. Media coverage sticks to national headlines (“mortgage foreclosures fall X% year-on-year”) or, at best, a one-off ranking using whatever data was available the year the article was written. But the ratio of foreclosures per 100 new mortgages, province by province, updated to the latest available data, can only be obtained by cross-referencing two INE tables that don’t share an operation or a code:
1. Filtering the Mortgage Statistics table by province and summing the twelve monthly series for 2024 gives you the number of mortgages granted.
2. Filtering the Mortgage Foreclosure Statistics table with the same province and year filter gives you the number of foreclosures initiated and registered in the property registry.
3. Dividing the second figure by the first, province by province, produces a number that’s in no article anywhere: the relative weight of foreclosure against new credit in each territory.
Here’s the aggregated national series for 2014-2025 — the starting point before drilling into the provincial detail:
The national headline is already counterintuitive: the two series move in opposite directions. More mortgage credit isn’t translating into more foreclosures — but that aggregated headline hides exactly the kind of territorial difference that only shows up once you drill down to province level, which is where the actor genuinely surfaces something Google has no index of.
The Ranking That Exists Nowhere in Published Form
Computing the foreclosure-to-mortgage ratio for all 52 provinces in 2024 produces this:
Cantabria, La Rioja, and Alicante lead with more than 6 foreclosures per 100 new mortgages in 2024. At the other end, Soria, Gipuzkoa, and Segovia sit below 1.3%. It’s a good example of a figure that can easily go unnoticed until you drill down to this level of detail, cross-referencing two separate INE statistical operations, province by province, across all 52 provinces. And if it never ends up published as a news story or article, asking ChatGPT or Claude directly won’t get you this specific figure either, because the model can only draw on what’s indexed.
Why the Raw Number Misleads and the Ratio Doesn’t
If you compare mortgage and foreclosure volumes directly by province, the correlation is very high (r ≈ 0.90 on 2024 data). But that correlation is almost entirely a size effect: bigger provinces have more of everything.
| Province | Mortgages 2024 | Foreclosures 2024 | Ratio |
|---|---|---|---|
| Madrid | 90,007 | 2,064 | 2.29% |
| Barcelona | 66,155 | 2,525 | 3.82% |
| Cantabria | 6,665 | 487 | 7.31% |
| Soria | 951 | 2 | 0.21% |
Madrid has more than double the absolute number of foreclosures than Cantabria (2,064 versus 487), which on its face suggests more risk. But relative to the volume of mortgages signed in each territory, Cantabria’s ratio (7.31%) is more than three times Madrid’s (2.29%). The raw number — the one that usually shows up indexed in press releases and articles — can lead you to read the situation the opposite way from what the ratio shows. It’s another example of why it’s worth drilling down to the granular data: if you settle for what’s already published, it’s easy to overlook the figure that actually matters.
🤖 Tutorial: Connect Apify to Claude and Start Cross-Referencing Mortgages and Foreclosures
Thanks to the Model Context Protocol (MCP), Claude can connect to external tools like Apify. Instead of downloading INE tables and cross-referencing them by hand in a spreadsheet, you can ask Claude in natural language for the cross-reference you need and let it assemble it for you.
Step 1: Open Claude or ChatGPT in Your Browser
No install needed: go straight to Claude’s connectors settings and sign in with your account, or to ChatGPT’s connectors settings if you’d rather use that. MCP connectors work the same way from the browser as they do from the desktop or mobile apps.
Step 2: Connect the Apify MCP (no token needed)
You no longer need to generate and paste an API token by hand: the Apify connector is authorized directly with OAuth from within Claude.
-
Go to Customize → Connectors.
-
Click the + button next to Connectors and select Add custom connector.
-
Fill in the form with these two fields:
- Name:
Apify - MCP Server URL:
https://mcp.apify.com/


- Name:
-
Click Add, open the newly created connector, and click Connect to authorize it. If you don’t have an Apify account yet, this is the moment to create one — the authorization window will prompt you, and the free plan includes enough monthly usage credits to run the actor.
Create a Free Apify Account
-
To enable the connector in a conversation, click + in the chat, hover over Connectors, and toggle on Apify.
With this done, you now have access to every LegalTech actor from Claude: legaltech/ine, legaltech/hacienda, legaltech/cendoj, and many more.
💬 Prefer ChatGPT? The same Apify MCP works the same way in ChatGPT: turn on Developer mode, create an app from Settings → Connectors with the name
Apify, URLhttps://mcp.apify.com/, and OAuth authentication, authorize it, and you can uselegaltech/ineby typing@Apifyin the chat. You’ll find the full walkthrough in our guide How to Use the Apify MCP in ChatGPT.
📱 Bonus: Once the connector is set up on your computer, you can also use it from the Claude or ChatGPT mobile app: the connector is tied to your account, so there’s nothing left to configure.
Step 3: Ask About Mortgages and Foreclosures from the Chat, in Natural Language
Once the connector is configured, open the Claude chat and confirm that Apify shows up as an available tool.

Now you can ask Claude for the full cross-reference without needing to know a single table code. For example:
Use the legaltech/ine actor and calculate, for each province, what percentage of the mortgages granted in 2024 ended in a foreclosure registered that same year
Use the legaltech/ine actor and compare the trend in mortgage foreclosures against mortgages granted in Spain over the last ten years
Use the legaltech/ine actor and tell me which provinces have the highest ratio of foreclosures to new mortgages in the latest available year
Use the legaltech/ine actor and tell me whether my province is above or below the national average on that ratio
Claude will first run a semantic search to locate the Mortgage Statistics and Mortgage Foreclosure Statistics tables, inspect their dimensions to narrow down by province and period, extract the numeric data from both, and compute the cross-reference and the ratio directly in the conversation.
Step 4: Analyze and Cross-Reference the Data from the Chat
Once Claude has the data, you can keep working with it without leaving the conversation:
- Compare my province’s foreclosure ratio with its neighboring provinces.
- Build a table showing this ratio’s trend over the last five years, not just the latest figure.
- Has my province’s ratio risen or fallen since the 2014 crisis peak?
- Cross this ratio with the average housing price by province and tell me if there’s a relationship.
- Give me the source and the exact INE table links this figure comes from, so I can cite them.
The analysis is a conversation: you keep refining your questions, and Claude keeps answering based on the current figure it just pulled directly from the INE’s API, cross-referencing in real time two statistical operations that have never been published together.
Written by Miguel Gonzalez Herrera
← Back to blog