Skip to main content

Python helper to request Sirene Api on

Project description

`🇫🇷 Français <>`__

Python helper to request Sirene API

API Sirene give access to French companies and business database. Entities are recorded since the creation of this administrative register in 1973. To use this API you have to create an account on

The python library api_insee is a help to request the API Sirene in perfect simplicity. You’ll find more information about the API in the official documentation


From a terminal :

pip install api-insee

To request the API you must create a consummer account on Then with your access keys :

from api_insee import ApiInsee

api = ApiInsee(
    key = # consummer key,
    secret = # secret key

Request samples

  • Fetch data from a siret or sirene number
data = api.siren('005520135').get()
data = api.siret('39860733300059').get()

# Request executed:
  • Set parameters to the request:
data = api.siren('005520135', date='2018-01-01').get()

# Request executed:
  • Perform an advanced search on given criteria using q= parameter
data = api.siren(q='unitePurgeeUniteLegage:True').get()

# Request executed:
# /?q=unitePurgeeUniteLegage:True
  • Filter fields in the response
champs = [

request = api.siret('39860733300059', champs=champs)
# Request executed:
# /39860733300059?champs=siret,denominationUniteLegale,nomUsageUniteLegale,prenom1UniteLegale

Advanced search on criteria

Class in api_insee.criteria let you construct advanced searchs easily. All variables available are described in the official documentation

  • You can combine several criteria in one request.
from api_insee.criteria import Field

data = api.siren(q=(
    Field('codeCommuneEtablissement', 92046),
    Field('unitePurgeeUniteLegale', True)

# Request executed:
# /?q=codeCommuneEtablissement:92046 AND unitePurgeeUniteLegale:True
  • Or using a dictionnary
data = api.siren(q={
    'codeCommuneEtablissement' : 92046,
    'unitePurgeeUniteLegale' : True

# Request executed:
# /?q=codeCommuneEtablissement:92046 AND unitePurgeeUniteLegale:True
  • Use logical operator |, &, - (not) to specify your requests.
data = api.siren(q=(
    Field('codeCommuneEtablissement', 92046) | Field('unitePurgeeUniteLegale', True)

data = api.siren(q=-Field('codeCommuneEtablissement', 92046)).get()

# Request executed:
# /?q=codeCommuneEtablissement:92046 OR unitePurgeeUniteLegale:True
# /?q=-codeCommuneEtablissement:92046

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Built Distribution

api_insee-1.5-py2.py3-none-any.whl (14.3 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page