# France SIRENE → Company Markdown DD Card (`ingenious_quip_bxq/france-sirene-markdown`) Actor

Batch French SIREN/SIRET lookups via Recherche Entreprises (keyless) or your own INSEE API Sirene key. Markdown due-diligence cards: denomination, status, NAF/APE, address, établissements summary, source. RAG chunks. No email/phone. Failed rows free. 256 MB.

- **URL**: https://apify.com/ingenious_quip_bxq/france-sirene-markdown.md
- **Developed by:** [新世紀書僮](https://apify.com/ingenious_quip_bxq) (community)
- **Categories:** Business, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 sirene company cards

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 SIRENE → Company Markdown DD Card

Batch French **SIREN** (9 digits) / **SIRET** (14 digits) lookups into Markdown due-diligence cards + JSON dataset + optional RAG chunks.

**Official / government APIs only.** No HTML scraping of commercial directories. **No email, phone, or lead fields** — ever.

### Providers

| Mode | Endpoint | Key |
|---|---|---|
| **Default / demo** | `https://recherche-entreprises.api.gouv.fr/search?q={siren_or_siret}` | None (keyless) |
| **Production BYOK** | `https://api.insee.fr/api-sirene/3.11/siren/{siren}` (+ `/siret/{siret}`, `/siret?q=siren:…`) | Your INSEE integration key as header `X-INSEE-Api-Key-Integration` |

`provider=auto` (default): with `apiKey` tries **INSEE** first, then falls back to Recherche Entreprises; without a key uses Recherche only.

#### Get an INSEE API key (buyer self-serve)

1. Open **https://portail-api.insee.fr**
2. Sign in (CONNEXION-POUR-LES-EXTERNES) and create an application
3. Subscribe the app to **API Sirene**
4. Copy the **Clé d'API / integration key** into this Actor’s `apiKey` input (secret)

The Actor publisher does **not** sign INSEE contracts, does **not** top-up quotas, and does **not** store a shared key on the Actor. INSEE bills / rate-limits your own account (typically ~30 req/min).

### Input

- `sirens` — string list of SIREN and/or SIRET (punctuation OK; Luhn-validated)
- `datasetId` / `keyValueStoreId` + `keyValueRecordKey` (default `INPUT_SIRENS`) / `sirenField`
- `provider` — `auto` | `recherche` | `insee`
- `apiKey` — optional secret (INSEE integration key). Use `YOUR_KEY` as a placeholder in docs only.
- `stopOnAuthError` (default true)
- `includeEtablissements` (default true) — summary only, not a full dump
- `includeRagChunks` (default true)
- `maxItems` 100 · `maxConcurrency` 2 (max 5) · `maxRetries` 3 · `requestTimeoutSecs` 30

### Output

One dataset row per id: `siren`, `siret`, `denomination` / `nomComplet`, `sigle`, `etatAdministratif` / `etatLabel`, `dateCreation`, `naf` (code + libelle when available), `natureJuridique`, `trancheEffectifs`, `address` (**no** phone/email), `etablissementsSummary`, `markdown`, `source`, `sourceUrl`, `status`, error fields, `checkedAt`.

Key-value store: `REPORT.md`, `CHUNKS.jsonl`, `SUMMARY`, `OUTPUT`.

Markdown sections: **Identity · Status · NAF/APE · Address · Établissements · Source**.

### Pricing (pay-per-event)

| Event | Price |
|---|---|
| `apify-actor-start` | $0.001 |
| `sirene-card` (primary) | **$0.004** per successful card |

Invalid input, not found, auth errors, rate limits after retries, and other failures are **free** (dataset row written, not charged).

### Example

```json
{
  "sirens": ["380129866", "552081317"],
  "provider": "auto",
  "apiKey": "YOUR_KEY",
  "includeEtablissements": true,
  "includeRagChunks": true
}
```

### Limits

Default run: **256 MB**, timeout **3600 s** (max memory 1024 MB). Keep concurrency low on the keyless path.

### Licence

Actor source is AGPL-3.0. Underlying SIRENE data is published under Licence Ouverte / Open Licence 2.0 (INSEE / Etalab).

### Source code

Open source (AGPL-3.0): https://github.com/xbox002000/france-sirene-markdown

# Changelog

This Actor's version history is a separate document: https://apify.com/ingenious_quip_bxq/france-sirene-markdown/changelog.md

# Actor input Schema

## `sirens` (type: `array`):

One SIREN (9 digits) or SIRET (14 digits) per line, e.g. 380 129 866 or 38012986648625. Punctuation and spaces are stripped. Luhn check digits are validated (invalid rows are free). Duplicates dropped.

## `datasetId` (type: `string`):

Optional. Read ids from another run's dataset (field from 'SIREN field', else siren / siret / taxId / numero).

## `keyValueStoreId` (type: `string`):

Optional. Read ids from a key-value record: JSON array, {"sirens": \[...]}, or plain text with one id per line.

## `keyValueRecordKey` (type: `string`):

Record key inside the key-value store.

## `sirenField` (type: `string`):

Optional. Name of the field holding the SIREN or SIRET in dataset items or JSON objects.

## `provider` (type: `string`):

auto = with apiKey try INSEE first then Recherche Entreprises; without key use Recherche only. recherche = keyless official search API only. insee = INSEE API Sirene only (requires apiKey).

## `apiKey` (type: `string`):

Optional. Your INSEE API Sirene integration key from https://portail-api.insee.fr (sent as header X-INSEE-Api-Key-Integration). Not needed for the default Recherche Entreprises path. Stored encrypted, never logged or output. Placeholders like YOUR_KEY are ignored. The Actor publisher does not provide or top-up an INSEE key.

## `stopOnAuthError` (type: `boolean`):

After INSEE returns 401/403 once, skip it for the remaining ids (auto mode keeps using Recherche Entreprises). Failed rows are free.

## `includeEtablissements` (type: `boolean`):

Add a short establishments summary: total/open counts, head-office SIRET, and a small sample. Never dumps thousands of establishments.

## `includeRagChunks` (type: `boolean`):

Write one self-describing chunk per card section to the key-value store record CHUNKS.jsonl.

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

Stop after this many unique valid SIREN/SIRET (0 = no limit).

## `maxConcurrency` (type: `integer`):

Parallel lookups. Public endpoints are rate-limited; 2 is a safe default.

## `maxRetries` (type: `integer`):

Retries per provider for HTTP 429 (honours Retry-After, capped at 30 s), 5xx, timeouts and network errors. 400/401/403/404 are not retried.

## `requestTimeoutSecs` (type: `integer`):

Timeout for each provider HTTP call.

## Actor input object example

```json
{
  "sirens": [
    "380129866"
  ],
  "keyValueRecordKey": "INPUT_SIRENS",
  "provider": "auto",
  "stopOnAuthError": true,
  "includeEtablissements": true,
  "includeRagChunks": true,
  "maxItems": 100,
  "maxConcurrency": 2,
  "maxRetries": 3,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items: siren, siret, denomination, etatAdministratif, NAF/APE, address, établissements summary, markdown, source, errorClass.

## `reportMarkdown` (type: `string`):

Due-diligence cards: Identity, Status, NAF/APE, Address, Établissements, Source.

## `chunks` (type: `string`):

One JSON line per card section with siren / section / text, ready to embed.

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

idsOk, idsFailed, byClass, bySource, charged, durationSecs, peakMemoryMb.

# 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 = {
    "sirens": [
        "380129866"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ingenious_quip_bxq/france-sirene-markdown").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 = { "sirens": ["380129866"] }

# Run the Actor and wait for it to finish
run = client.actor("ingenious_quip_bxq/france-sirene-markdown").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 '{
  "sirens": [
    "380129866"
  ]
}' |
apify call ingenious_quip_bxq/france-sirene-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ingenious_quip_bxq/france-sirene-markdown"
        }
    }
}
```

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/Kd1Ry64dz0UtU5ksC/builds/GfdbAYQ85xnZOcng8/openapi.json
