# French Real Estate Deal Score (`tagadanar/french-real-estate-deal-score`) Actor

Score French owner-direct property listings (PAP) against official sold prices (DVF): each listing gets an over/under-market deal score from the area's real €/m². Spot underpriced sales fast. Agent-ready via MCP.

- **URL**: https://apify.com/tagadanar/french-real-estate-deal-score.md
- **Developed by:** [Raphaël R](https://apify.com/tagadanar) (community)
- **Categories:** Real estate, Lead generation, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 listing scoreds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## French Real Estate Deal Score — Asking vs Sold Price (PAP + DVF)

**Find underpriced French properties in seconds.** This actor takes a [PAP.fr](https://www.pap.fr) owner-direct sale search and scores every listing against **what comparable properties actually sold for**, using the French government's official transaction database (**DVF** — *Demandes de Valeurs Foncières*).

Each listing gets a **deal score**: how far its asking €/m² sits **below (good) or above (expensive)** the area's real, recorded median. No more guessing whether a price is fair — you see it.

Built for **property investors, buyers, agents doing pige, and AI agents** (API + MCP).

### Why this actor

- ✅ **Asking vs achieved, automatically** — live owner asking prices (PAP) benchmarked against official sold prices (DVF), per property type, in the same commune.
- ✅ **A single deal score per listing** — e.g. `+18` means the asking €/m² is 18 % below the local median sale; `-12` means 12 % above. Sorted best-deal-first.
- ✅ **Owner-direct** — PAP has no agencies, so a good deal means a direct-to-owner opportunity (add `scrapeDetails` for the owner's phone).
- ✅ **Official, free benchmark data** — DVF from files.data.gouv.fr (Etalab / DGFiP). Outliers (symbolic €1 sales, garages) filtered out.
- ✅ **Paste one URL** — the benchmark area is auto-derived; override it only if you want.

### How it works

1. Scrapes the PAP sale listings from your search URL (asking prices).
2. Pulls DVF sold transactions for the same commune and years.
3. Builds a median €/m² benchmark per property type (Apartment / House), ignoring data-entry noise.
4. Scores each listing: `dealScore = (median_sold − asking) / median_sold × 100`.
5. Returns listings **best-deal-first**, each carrying the benchmark it was judged against.

### Input

```json
{
    "searchUrl": "https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424",
    "dvfLocation": "",
    "dvfYears": ["2024", "2025"],
    "scrapeDetails": false,
    "maxListings": 200
}
````

- `searchUrl` — a pap.fr **sale** search URL (asking prices to score).
- `dvfLocation` — optional commune/postal/INSEE for the benchmark; empty = auto-derive.
- `dvfYears` — DVF years to build the benchmark from (more = larger sample).
- `scrapeDetails` — also fetch each owner's phone and street address.

### Output (one record per listing)

```json
{
    "source": "PAP",
    "propertyType": "Appartement",
    "price": 249000,
    "surface": 55,
    "pricePerM2": 4527,
    "dealScore": 19,
    "dealLabel": "Great deal (well below market)",
    "benchmarkPerM2": 5600,
    "benchmarkSample": 214,
    "benchmarkArea": "13100",
    "benchmarkYears": ["2024", "2025"],
    "location": "Aix-En-Provence",
    "url": "https://www.pap.fr/annonces/appartement-…-r462001771",
    "phone": null
}
```

`dealScore` is `null` for rentals, listings without a surface, or areas with too few comparable sales (in which case `dealLabel` explains why). The run's `BENCHMARK` key-value record holds the full per-type benchmark and the communes used.

### Pricing

Pay per event — no subscription:

| Event | When |
|---|---|
| Actor start | Once per run |
| Listing scored | Per listing returned (scored against DVF) |

### Companion actors

- [**PAP Real Estate Listings**](https://apify.com/tagadanar/french-real-estate-pap) — raw owner-direct listings (this actor's asking-price source).
- [**French Real Estate Sales (DVF)**](https://apify.com/tagadanar/french-real-estate-dvf) — the raw sold-price transactions (this actor's benchmark source).

### FAQ

**Where do the numbers come from?** Asking prices: public listings on pap.fr. Sold prices: DVF open data (files.data.gouv.fr/geo-dvf, Etalab / DGFiP). Both fetched live at run time.

**How is a "deal" defined?** Purely on €/m² vs the local median recorded sale for the same property type. It's a pricing signal, not an appraisal — always verify condition, floor, exact street, and DPE.

**Why is a score null?** Rentals (no sale comparable), listings without a usable surface, or a benchmark with fewer than 5 comparable sales. The benchmark context is still returned so you can judge.

**Paris / Lyon / Marseille?** Handled — their arrondissements are expanded automatically for DVF.

**Does it work with AI agents?** Yes — REST API and **MCP**. Ask *"show me PAP apartments in Aix priced under the DVF median."*

***

*Keywords: immobilier, prix au m², DVF, valeurs foncières, PAP, particulier à particulier, sous-évalué, bonne affaire immobilière, deal score, asking vs sold price, real estate France, property investment, pige immobilière, €/m².*

# Actor input Schema

## `searchUrl` (type: `string`):

A pap.fr <b>sale</b> search URL — these owner-direct asking prices are scored against official sold prices. Build the search on <a href='https://www.pap.fr' target='_blank'>pap.fr</a> (city, apartment/house, filters) and paste its URL. Example: <code>https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424</code>

## `dvfLocation` (type: `string`):

Commune name, postal code or INSEE code for the DVF sold-price benchmark. Leave empty to auto-derive it from the listings / search URL. Set it to widen or pin the comparison area (e.g. <code>13100</code> or <code>Aix-en-Provence</code>).

## `dvfYears` (type: `array`):

Which DVF years of sold prices to build the benchmark from. More years = larger sample. Available roughly 2021–2025.

## `scrapeDetails` (type: `boolean`):

Open each listing page to add the owner's phone and street address — handy for acting on the best deals. Slower (one page per listing).

## `minPrice` (type: `integer`):

Keep only listings at or above this price.

## `maxPrice` (type: `integer`):

Keep only listings at or below this price.

## `minSurface` (type: `integer`):

Keep only listings with at least this built surface.

## `minRooms` (type: `integer`):

Keep only listings with at least this many rooms.

## `propertyTypes` (type: `array`):

Keep only these types. Scoring benchmarks Apartments and Houses.

## `keywords` (type: `array`):

Keep only listings whose description/location contains one of these words.

## `maxListings` (type: `integer`):

Stop after scoring this many listings.

## `maxPagesPerUrl` (type: `integer`):

Safety cap on PAP pagination depth.

## Actor input object example

```json
{
  "searchUrl": "https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424",
  "dvfYears": [
    "2024",
    "2025"
  ],
  "scrapeDetails": false,
  "propertyTypes": [],
  "keywords": [],
  "maxListings": 200,
  "maxPagesPerUrl": 20
}
```

# Actor output Schema

## `listings` (type: `string`):

Owner-direct listings enriched with a DVF-based deal score (best deals first).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchUrl": "https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424",
    "dvfLocation": "",
    "dvfYears": [
        "2024",
        "2025"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/french-real-estate-deal-score").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchUrl": "https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424",
    "dvfLocation": "",
    "dvfYears": [
        "2024",
        "2025",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("tagadanar/french-real-estate-deal-score").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchUrl": "https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424",
  "dvfLocation": "",
  "dvfYears": [
    "2024",
    "2025"
  ]
}' |
apify call tagadanar/french-real-estate-deal-score --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=tagadanar/french-real-estate-deal-score",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "French Real Estate Deal Score",
        "description": "Score French owner-direct property listings (PAP) against official sold prices (DVF): each listing gets an over/under-market deal score from the area's real €/m². Spot underpriced sales fast. Agent-ready via MCP.",
        "version": "0.1",
        "x-build-id": "b9OpiR6qPr3M0CNix"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/tagadanar~french-real-estate-deal-score/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-tagadanar-french-real-estate-deal-score",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/tagadanar~french-real-estate-deal-score/runs": {
            "post": {
                "operationId": "runs-sync-tagadanar-french-real-estate-deal-score",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/tagadanar~french-real-estate-deal-score/run-sync": {
            "post": {
                "operationId": "run-sync-tagadanar-french-real-estate-deal-score",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchUrl"
                ],
                "properties": {
                    "searchUrl": {
                        "title": "PAP search URL (sale listings)",
                        "type": "string",
                        "description": "A pap.fr <b>sale</b> search URL — these owner-direct asking prices are scored against official sold prices. Build the search on <a href='https://www.pap.fr' target='_blank'>pap.fr</a> (city, apartment/house, filters) and paste its URL. Example: <code>https://www.pap.fr/annonce/vente-appartements-aix-en-provence-13-g11424</code>"
                    },
                    "dvfLocation": {
                        "title": "Benchmark area (optional)",
                        "type": "string",
                        "description": "Commune name, postal code or INSEE code for the DVF sold-price benchmark. Leave empty to auto-derive it from the listings / search URL. Set it to widen or pin the comparison area (e.g. <code>13100</code> or <code>Aix-en-Provence</code>)."
                    },
                    "dvfYears": {
                        "title": "Benchmark years",
                        "type": "array",
                        "description": "Which DVF years of sold prices to build the benchmark from. More years = larger sample. Available roughly 2021–2025.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "scrapeDetails": {
                        "title": "Also fetch owner phone & full address",
                        "type": "boolean",
                        "description": "Open each listing page to add the owner's phone and street address — handy for acting on the best deals. Slower (one page per listing).",
                        "default": false
                    },
                    "minPrice": {
                        "title": "Minimum price (€)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Keep only listings at or above this price."
                    },
                    "maxPrice": {
                        "title": "Maximum price (€)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Keep only listings at or below this price."
                    },
                    "minSurface": {
                        "title": "Minimum surface (m²)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Keep only listings with at least this built surface."
                    },
                    "minRooms": {
                        "title": "Minimum rooms",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Keep only listings with at least this many rooms."
                    },
                    "propertyTypes": {
                        "title": "Property types",
                        "type": "array",
                        "description": "Keep only these types. Scoring benchmarks Apartments and Houses.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "Appartement",
                                "Maison",
                                "Terrain",
                                "Immeuble",
                                "Local commercial",
                                "Parking / Box"
                            ],
                            "enumTitles": [
                                "Apartment",
                                "House",
                                "Land",
                                "Building",
                                "Commercial",
                                "Parking / Box"
                            ]
                        },
                        "default": []
                    },
                    "keywords": {
                        "title": "Keywords",
                        "type": "array",
                        "description": "Keep only listings whose description/location contains one of these words.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxListings": {
                        "title": "Max listings",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Stop after scoring this many listings.",
                        "default": 200
                    },
                    "maxPagesPerUrl": {
                        "title": "Max search pages",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Safety cap on PAP pagination depth.",
                        "default": 20
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
