# France Municipal Finances: Town Debt, Budget & Tax Revenue (`datacraft-studio/france-municipal-finances`) Actor

Official DGFiP accounts of every French town (commune): revenue, spending, staff costs, debt, debt payback years, self-financing (CAF), capital spending, taxes and state grants, compared with similar towns, with history and alerts. Pay per town.

- **URL**: https://apify.com/datacraft-studio/france-municipal-finances.md
- **Developed by:** [Yahya Nouali](https://apify.com/datacraft-studio) (community)
- **Categories:** Business, Real estate
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 town finances delivereds

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## France Municipal Finances: Town Debt, Budget & Tax Revenue

Get the **official accounts of every French town (commune)** from the DGFiP (French public finance directorate): revenue, spending, staff costs, **outstanding debt, debt payback years, self-financing (CAF)**, capital spending, local taxes and state grants, each compared with the average of towns of the same size, with up to 5 years of history and automatic financial alerts.

About 35,000 towns per year, years 2008 to 2025 (latest published by DGFiP). No account, no API key, no scraping of websites: the actor reads the public open data files.

### Who uses it

- **Banks and lenders to local authorities**: screen debt, debt payback ratio and self-financing before a loan.
- **Companies selling to towns** (construction, public works, IT, energy, urban equipment): find towns with high capital spending or a fast-growing budget.
- **Consultants, auditors, journalists, researchers**: compare a town with similar towns, rank departments, track debt over time.
- **Real-estate investors**: check the financial health and property tax rate of a town before buying.

### What you get (one row per town)

- Identity: INSEE code, name, department, region, legal population, population stratum, intercommunality tax regime.
- For 22 budget items: amount in euros, amount per inhabitant, and **average per inhabitant of similar towns** (stratum): operating revenue, local taxes, other taxes, state grant (DGF), operating expenses, staff costs, purchases, interest charges, subsidies paid, operating result, gross operating surplus, self-financing (CAF), net CAF, investment resources, new loans, investment subsidies received, investment spending, equipment spending, debt repayment, **outstanding debt**, debt service, working capital.
- Tax rates voted by the town: property tax (taxe foncière bâtie), land tax (non bâti), housing tax (second homes), with stratum averages.
- Ratios: **debt payback years** (debt / CAF), debt as % of operating revenue, debt per inhabitant vs similar towns (%), capital spending vs similar towns (%).
- Alerts: `debt_years_over_12`, `negative_self_financing`, `negative_net_self_financing`, `operating_deficit`, `debt_per_capita_over_2x_stratum`.
- History (option, on by default): debt, CAF, equipment spending, operating revenue and property tax rate for up to 4 previous years, plus 1-year and period changes.
- Source, licence and dataset date on every row.

A last row (`recordType: run_summary`, free) gives the year, counts, unknown codes or names, and the source date.

### Input examples

- Two towns: `{"inseeCodes": ["69123", "33063"]}`
- Towns of a department above 5,000 inhabitants, debt increase first: `{"departments": ["69"], "minPopulation": 5000, "sortBy": "debt_change_desc"}`
- All of France, towns over 10,000 inhabitants with a financial alert: `{"minPopulation": 10000, "onlyWithAlerts": true, "sortBy": "debt_years_desc"}`
- Biggest public buyers: `{"minPopulation": 2000, "minEquipmentPerCapita": 800, "sortBy": "equipment_per_capita_desc"}`
- An older year: `{"townNames": ["Brest"], "year": "2023"}`

Leave every area field empty to scan all of France (about 35,000 towns; use `maxItems` to limit the cost).

### Pricing

Pay per event: **$0.003 per town delivered**. Towns removed by your filters and the summary row are free. Example: 100 towns = $0.30; the whole country (~35,000 towns) ≈ $105. Runs at 512 MB, about 3 to 60 seconds.

### Data source and licence

- Source: DGFiP, "Comptes individuels des communes" (fichiers globaux), published on data.economie.gouv.fr and data.gouv.fr (Ministère de l'Économie et des Finances), from the accounts shown on collectivites-locales.gouv.fr.
- Licence: **Licence Ouverte v2.0 (Etalab)**, which allows commercial reuse with attribution. Each row cites the source and the dataset date (`sourceDataDate`).
- Scope: main budget (budget principal) only, as in the DGFiP files. Amounts are converted from thousands of euros to euros; per-inhabitant values and stratum averages are those published by DGFiP.
- The data contains no personal data (towns are public bodies).

This actor is not affiliated with the DGFiP or the French government. Figures are reproduced as published; check the official accounts before any financial decision.

# Changelog

This Actor's version history is a separate document: https://apify.com/datacraft-studio/france-municipal-finances/changelog.md

# Actor input Schema

## `inseeCodes` (type: `array`):

5-character INSEE commune codes, e.g. 69123 (Lyon), 13055 (Marseille), 2A004 (Ajaccio), 97411 (Saint-Denis, La Réunion). Leave every area field empty to scan all of France.

## `townNames` (type: `array`):

Exact town names (accents and case ignored), e.g. Bordeaux, Saint-Étienne. All towns with that exact name are returned.

## `postalCodes` (type: `array`):

All towns of these postal codes (resolved with geo.api.gouv.fr).

## `departments` (type: `array`):

Department codes, e.g. 69, 13, 2A, 971. All towns of these departments.

## `year` (type: `string`):

Financial year of the accounts (e.g. 2025). Leave empty for the latest year published by DGFiP.

## `minPopulation` (type: `integer`):

Skip towns below this legal population.

## `maxPopulation` (type: `integer`):

Skip towns above this legal population.

## `minDebtPerCapita` (type: `integer`):

Only towns whose outstanding debt per inhabitant is at least this value.

## `maxDebtPerCapita` (type: `integer`):

Only towns whose outstanding debt per inhabitant is at most this value (0 = debt-free towns).

## `minDebtYears` (type: `integer`):

Only towns whose debt / self-financing ratio (years needed to repay the debt) is at least this value. 12 years is the usual alert threshold. Towns with zero or negative self-financing are kept.

## `minEquipmentPerCapita` (type: `integer`):

Only towns that spent at least this much on equipment (works, buildings, roads...) per inhabitant this year. Useful to find active public buyers.

## `onlyWithAlerts` (type: `boolean`):

Keep only towns with at least one alert: debt payback over 12 years, negative self-financing, operating deficit, or debt per inhabitant over twice the average of similar towns.

## `includeHistory` (type: `boolean`):

Add debt, self-financing, capital spending and property tax rate for up to 4 previous years, plus 1-year and period changes.

## `sortBy` (type: `string`):

Order of the delivered towns.

## `maxItems` (type: `integer`):

Maximum number of towns delivered (and charged). The run summary row is free.

## Actor input object example

```json
{
  "inseeCodes": [
    "69123",
    "33063"
  ],
  "onlyWithAlerts": false,
  "includeHistory": true,
  "sortBy": "population_desc",
  "maxItems": 10
}
```

# Actor output Schema

## `towns` (type: `string`):

One row per town with budget, debt, investment and tax figures.

## `summary` (type: `string`):

Accounts year, counts, unknown towns and source date.

# 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 = {
    "inseeCodes": [
        "69123",
        "33063"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("datacraft-studio/france-municipal-finances").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 = {
    "inseeCodes": [
        "69123",
        "33063",
    ],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("datacraft-studio/france-municipal-finances").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "inseeCodes": [
    "69123",
    "33063"
  ],
  "maxItems": 10
}' |
apify call datacraft-studio/france-municipal-finances --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datacraft-studio/france-municipal-finances"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Ud8VGhoGzIuVUVgvI/builds/aoYRpOfkQ9tUm4pO6/openapi.json
