sirenic: Python client for the Sirenic API
Company data from the official French and European registers (INSEE Sirene, INPI RNE and the national
registers of European countries), for scripts, back offices and agents. Every paid JSON response carries its
per-block provenance: which register each block came from, its licence, its version, its as_of date and a
state from a closed list.
- One class,
sirenic.Client, and one dependency,requests. - Paid routes are paid with an API key (prepaid credits) or per call in x402 (USDC or EURC on Base) with the
optional
[pay]extra and a hard price cap. With neither, a paid route raisesPaymentRequiredcarrying the quote: a free dry run. - Typed errors, read from the responses the service serves.
- Nothing stored, no key embedded; your key is sent to
base_urlonly (defaulthttps://api.sirenic.eu, https required except onlocalhost):get()takes a path, never a URL, and a redirect to another host is not followed.
Install
pip install sirenic # API key, or free routes only
pip install "sirenic[pay]" # per-call x402 payment with your own wallet
Python 3.10 or later.
API key
Create an account and a key on the account page, then:
export SIRENIC_API_KEY=srn_live_...
import sirenic
client = sirenic.Client() # reads SIRENIC_API_KEY; or sirenic.Client(api_key="srn_live_...")
profil = client.entreprise("552032534")
print(profil["denomination"], profil.credits_charged)
Each call is paid from your prepaid balance at the price of its route. To cap a single call, pass
max_credits (for example sirenic.Client(max_credits=0.5)): the client first asks the free quote of the
same request, one more request without the key, and above the cap raises CreditCapExceeded without making
the paid call. The quote request is sent without the key, so it counts against the service's per-IP rate limit
for calls without a key (120 requests per minute): heavy use behind one IP address can get a 429
(RateLimited) before the paid call, which is then not made; for heavy traffic or a shared IP address, leave
max_credits unset.
Example
import sirenic
client = sirenic.Client()
# Free: company name to SIREN
for s in client.suggestions("danone")["suggestions"]:
print(s["siren"], s["denomination"])
# Paid: the identity plus two blocks, then the envelope of each block
dossier = client.dossier("552032534", blocs=["finances", "pi"])
for p in dossier.provenance:
print(p.bloc, p.source_code, p.as_of, p.precision_as_of, p.etat)
for liste in dossier.listes_bornees:
print(liste.path, liste.name, liste.nombre_total, liste.tronque)
Methods
| Method | Route |
|---|---|
suggestions(q) |
GET /v1/suggestions (free) |
entreprise(siren) |
GET /v1/entreprise/{siren} |
dossier(siren, blocs) |
GET /v1/entreprise/{siren}/dossier |
kyb(siren) |
GET /v1/kyb/{siren} |
facturation_dossier(siren, iban=None) |
GET /v1/facturation/dossier |
get(chemin, params=None) |
any other path under /v1/ or /preview/ |
Each returns a sirenic.Response: data (the parsed JSON), response["field"], provenance (a list of
sirenic.Provenance), bloc(name), listes_bornees, credits_charged, credits_remaining and
request_id.
Reading the envelope
Provenance keeps the served field names: bloc, source_code, registre, mode, licence, version,
as_of (the snapshot date) and precision_as_of (what that date means: official publication, Sirenic
ingestion or live consultation), age_jours, etat (servi, absence_mesuree, absence_non_conclusive,
partiel, perime, indisponible, sans_objet), motif, couverture, confiance and
empreinte_sha256. A bounded list states its total and its cut in listes_bornees: nombre_total, tronque
and total_borne_basse. Read the states before the numbers: an absence_non_conclusive block does not mean
"nothing to report". The closed lists and the reading rules are served for free at
GET /v1/lecture, the register codes at
GET /v1/provenance/registres.
Paying per call with x402
import os
import sirenic
client = sirenic.Client(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
kyb = client.kyb("552032534")
The official x402 package (2.20 or later) signs an EIP-3009 authorization
locally: your wallet key never leaves the process. The client pays on Base, in USDC (the first option of every
Sirenic quote) or in EURC when a quote offers only EURC. A quote above max_price_usd raises PriceCapExceeded
and nothing is signed; the cap is compared with the quoted amount, the same figure in USDC and EURC. A quote
with no option in these two assets raises UnsupportedAsset, which names the offered ones.
Errors
| Exception | When |
|---|---|
PaymentRequired |
402 with an x402 quote: price, accepts (asset, asset_name, network, pay_to, amount), quote |
PriceCapExceeded |
x402 rail, quote above max_price_usd; a subclass of PaymentRequired |
CreditCapExceeded |
API key rail, price above max_credits (credits, max_credits): the call was not made; a subclass of PriceCapExceeded |
UnsupportedAsset |
x402 rail, no option of the quote in USDC or EURC on Base (assets names the offered ones); a subclass of PaymentRequired |
PaymentFailed |
x402 rail, the signed payment was not accepted |
InsufficientCredits |
402 credits_insuffisants on the key rail: solde, prix, recharge_url |
AccountRequired |
401 compte_requis: a route reserved to identified accounts (filed deeds) |
AuthenticationError |
401 or 403: unknown, expired or revoked key, suspended or closed account |
InvalidRequest |
400: a missing or malformed parameter (champ) |
NotFound |
404 |
RateLimited |
429: retry_after in seconds |
UpstreamUnavailable |
503 amont_indisponible: the official source did not answer, retry later |
ServiceUnavailable |
any other 503, code from the closed list motif_panne of GET /v1/lecture |
NetworkError |
connection error or timeout |
All derive from sirenic.SirenicError (status, code, message, body, headers). A response with a
status of 400 or above is not charged.
Prices
Each route has its own price, the same with an API key (1 credit = 1 EUR) and in x402 (USDC, or the same
figure in EURC). See the price list
and the API reference, one page per
route. suggestions is free.
Links
License
MIT
Metadata
Release files for sirenic 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sirenic-0.1.0.tar.gz | 19.9 kB | Without provenance | Details for sirenic-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sirenic-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sirenic-0.1.0-py3-none-any.whl |
Total release size: 39.3 kB
Release files / sirenic-0.1.0.tar.gz
| Download URL | sirenic-0.1.0.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5f8e9aeb064eaffd67ec65cd5b4ae0f2afb6dfbfd8d878d24cb72ea7eb14acb
|
|
BLAKE2b-256 checksum How to use checksums |
22871eafcc8fa32763360cba3a3a1791d9c0075067b812dc8f9a062cd1dcacbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / sirenic-0.1.0-py3-none-any.whl
| Download URL | sirenic-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fa3ee4cc1e5bc0555ef6449cf8e9daa97ae08b62fccd08d75c8cc6102076173
|
|
BLAKE2b-256 checksum How to use checksums |
b0a5266de398830885aee55c7871a0e1b6b8a5317e04dbc66d8c54f4c6b5510c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for sirenic 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.