fr-company-enrichment
by corsair96
README.md
# French Company Enrichment
Enrich a French company from its **domain name**, **SIREN**, or **SIRET**.
Returns legal identity, address, activity, financials, officers, LEI and VAT
number as JSON.
Paid per call: **0.05 USDC on Base via x402** — no account, no API key, no
signup. Designed so that an autonomous AI agent can discover, pay and call it
without a human in the loop.
| Service | URL |
|---|---|
| API | `https://fr-company-enrichment.apiforge.workers.dev` |
| MCP (Streamable HTTP) | `https://fr-company-enrichment-mcp.apiforge.workers.dev/mcp` |
| OpenAPI 3.1 | `https://fr-company-enrichment.apiforge.workers.dev/openapi.json` |
| `llms.txt` | `https://fr-company-enrichment.apiforge.workers.dev/llms.txt` |
## Why
Company data for France is public but scattered: SIRENE/INSEE for legal
identity, GLEIF for the LEI, Pappers for financials, RDAP and crt.sh for the
domain. Assembling it means several lookups, several normalisations and a lot of
edge cases.
This service does it in one deterministic call, settles the payment on-chain
before returning anything, and caches the result for 24 hours.
**No LLM.** Zero inference calls. Every request is a deterministic
`fetch → parse → map → score` pipeline, which makes the output reproducible and
the cost predictable.
## Call it
```bash
curl -i "https://fr-company-enrichment.apiforge.workers.dev/enrich?siren=383474814"
```
Without payment you get `402 Payment Required` and a `PAYMENT-REQUIRED` header
(base64 JSON) describing what to pay. Any x402 v2 client handles the rest:
```ts
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const payFetch = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
const response = await payFetch(
"https://fr-company-enrichment.apiforge.workers.dev/enrich?siren=383474814",
);
console.log(await response.json());
```
A runnable version lives in [`examples/client.ts`](examples/client.ts).
### Query modes
Exactly one parameter, per request:
| Parameter | Format | Example |
|---|---|---|
| `domain` | Public domain name. IPs, `localhost` and internal hosts are rejected. | `airbus.com` |
| `siren` | 9 digits | `383474814` |
| `siret` | 14 digits (SIREN + NIC) | `38347481400015` |
`domain` requires a live lookup to resolve the company, so a domain that matches
no French company returns `404`. Malformed input returns `400` **before**
payment, so it is never charged.
### Response
```json
{
"siren": "383474814",
"siret_siege": "38347481400100",
"name": "AIRBUS",
"legal_form": "SAS",
"status": "active",
"creation_date": "1991-10-18",
"address": {
"street": "2 Rond-Point Dewoitine",
"postal_code": "31700",
"city": "Blagnac",
"region": "Occitanie"
},
"activity": {
"naf_code": "30.30Z",
"naf_label": "Construction aéronautique et spatiale"
},
"financials": {
"revenue_latest": "57412795000",
"revenue_year": 2024,
"employees_range": "10000+"
},
"identifiers": {
"lei": "529900FCMZ4LKXFD0R69",
"vat_number": "FR89383474814"
},
"establishment": {
"siret": "38347481400015",
"nic": "00015",
"type_etablissement": "SIEGE",
"adresse": "2 Rond-Point Dewoitine, 31700 Blagnac",
"date_debut": "1991-10-18",
"est_siege": true
},
"sources": [
{ "name": "recherche-entreprises.api.gouv.fr", "matched": true },
{ "name": "GLEIF LEI", "matched": true }
],
"confidence": 1,
"cached": false
}
```
`establishment` is only present for a SIRET lookup.
## Payment
| Field | Value |
|---|---|
| Protocol | x402 v2, `exact` scheme |
| Network | Base mainnet (`eip155:8453`) |
| Asset | USDC (`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`) |
| Price | `50000` atomic = 0.05 USDC |
| `payTo` | `0x5C153d500a2b781fc235cc2Bd91F148b16957166` |
| Flow | `upfront` — settled before the handler runs |
| Facilitator | `https://facilitator.payai.network` |
The endpoint uses the **upfront** flow: the facilitator must confirm
`/settle` success before a single byte of enrichment data is returned. A
`PAYMENT-RESPONSE` header carries the base64 settlement receipt (transaction
hash included).
Free endpoints, safe to call without payment:
- `GET /` — service root (links and ownership proof)
- `GET /health`
- `GET /validate?domain=…` / `?siren=…` / `?siret=…` — input check before paying
- `GET /.well-known/x402.json` — x402 discovery manifest
- `GET /openapi.json`, `GET /llms.txt`, `GET /agent.json`
## MCP
The API is also served as an MCP server over Streamable HTTP, so an agent can
call it as a tool instead of hand-rolling HTTP:
```
https://fr-company-enrichment-mcp.apiforge.workers.dev/mcp
```
Tools:
| Tool | Purpose |
|---|---|
| `enrich_company` | Enrich by `domain`, `siren` or `siret`. Accepts an optional `payment_signature`. |
| `validate_identifier` | Free check that an identifier is acceptable before paying. |
| `get_api_info` | Price, network, asset, `payTo`, sources and links. |
It is a **dual-era** server: modern clients (revision `2026-07-28`) use
`server/discover` and send their revision per request, while older clients use
the `initialize` handshake (`2025-11-25` and earlier). Responses are plain JSON,
with no server-initiated SSE stream.
The MCP Worker never runs the pipeline itself — it calls the API Worker through
a Cloudflare service binding, so all CPU-heavy work stays on the API side.
Listed in the official registry as
`io.github.corsair96/fr-company-enrichment` (see [`server.json`](server.json)).
## Sources
| Source | Used for |
|---|---|
| [API Recherche d'Entreprises](https://recherche-entreprises.api.gouv.fr) (SIRENE / INSEE / RNE) | legal identity, address, NAF, officers |
| [GLEIF](https://www.gleif.org) | LEI |
| RDAP / crt.sh | domain → company resolution |
| [Pappers](https://www.pappers.fr) | financials (optional, when a key is configured) |
Results are cached in Workers KV for 24 hours.
## Run it yourself
```bash
npm install
npm run dev # wrangler dev on http://localhost:8787
npm test # unit tests (no network)
npm run typecheck
npm run smoke # free surface; paid checks need TEST_WALLET_PRIVATE_KEY
npm run smoke:mcp
```
Deploy:
```bash
npx wrangler deploy # API Worker
npx wrangler deploy -c mcp/wrangler.jsonc # MCP Worker
```
Configuration lives in `wrangler.jsonc` and `mcp/wrangler.jsonc`. Secrets (such
as `PAPERS_API_KEY`) go through `wrangler secret put` and never into the repo.
## Layout
```
src/ API Worker: routing, payment, validation, sources, aggregation
mcp/ MCP Worker: JSON-RPC over Streamable HTTP
public/ static assets (OpenAPI, llms.txt, robots.txt)
test/ vitest unit tests
scripts/ smoke tests and local preview
examples/ client-side examples (MIT licensed)
```
## License
Split on purpose:
- **Server code** (`src/`, `mcp/`, `scripts/`, `public/`, config) —
[Business Source License 1.1](LICENSE). Source is public and readable, but
production use requires a commercial licence. Each version converts to
Apache-2.0 on its Change Date.
- **Examples** (`examples/`) — [MIT](examples/LICENSE). Copy them freely.
Using the hosted API is governed by [TERMS.md](TERMS.md), not by the code
licence. Paying per call is always allowed.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues