Skip to main content

API REST FactPulse

Project description

FactPulse SDK Python

Client Python officiel pour l'API FactPulse - Facturation électronique française.

🎯 Fonctionnalités

  • Factur-X : Génération et validation de factures électroniques (profils MINIMUM, BASIC, EN16931, EXTENDED)
  • Chorus Pro : Intégration avec la plateforme de facturation publique française
  • AFNOR PDP/PA : Soumission de flux conformes à la norme XP Z12-013
  • Signature électronique : Signature PDF (PAdES-B-B, PAdES-B-T, PAdES-B-LT)
  • Traitement asynchrone : Support Celery pour opérations longues

🚀 Installation

pip install factpulse

📖 Démarrage rapide

1. Authentification

from factpulse import ApiClient, Configuration

# Configuration du client
config = Configuration(host='https://factpulse.fr/api/facturation/')
config.access_token = 'votre_token_jwt'

client = ApiClient(configuration=config)

2. Générer une facture Factur-X

from factpulse.api.traitement_facture_api import TraitementFactureApi
import json

api = TraitementFactureApi(client)

# Données de la facture
facture_data = {
    "numero_facture": "FAC-2025-001",
    "date_facture": "2025-01-15",
    "montant_total_ht": "1000.00",
    "montant_total_ttc": "1200.00",
    "fournisseur": {
        "nom": "Mon Entreprise SAS",
        "siret": "12345678901234",
        "adresse_postale": {
            "ligne_un": "123 Rue Example",
            "code_postal": "75001",
            "nom_ville": "Paris",
            "pays_code_iso": "FR"
        }
    },
    "destinataire": {
        "nom": "Client SARL",
        "siret": "98765432109876",
        "adresse_postale": {
            "ligne_un": "456 Avenue Test",
            "code_postal": "69001",
            "nom_ville": "Lyon",
            "pays_code_iso": "FR"
        }
    },
    "lignes_de_poste": [{
        "numero": 1,
        "denomination": "Prestation de conseil",
        "quantite": "10.00",
        "montant_unitaire_ht": "100.00",
        "montant_ligne_ht": "1000.00"
    }]
}

# Générer le PDF Factur-X (multipart/form-data)
pdf_bytes = api.generer_facture_api_v1_traitement_generer_facture_post(
    donnees_facture=json.dumps(facture_data),
    profil='EN16931',
    format_sortie='pdf'
)

# Sauvegarder
with open('facture.pdf', 'wb') as f:
    f.write(pdf_bytes)

3. Soumettre une facture complète (Chorus Pro / AFNOR PDP)

from factpulse.api.traitement_facture_api import TraitementFactureApi

api = TraitementFactureApi(client)

# Soumettre une facture avec destination Chorus Pro
response = api.soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post(
    body={
        "facture": facture_data,
        "destination": {
            "type": "chorus_pro",
            "credentials": {
                "login": "votre_login_chorus",
                "password": "votre_password_chorus"
            }
        }
    }
)

print(f"Facture soumise : {response.id_facture_chorus}")

🔑 Obtention du token JWT

Via l'API

import requests

response = requests.post(
    'https://factpulse.fr/api/token/',
    json={
        'username': 'votre_email@example.com',
        'password': 'votre_mot_de_passe'
    }
)

token = response.json()['access']

Accès aux credentials d'un client spécifique :

Si vous gérez plusieurs clients et souhaitez accéder aux credentials (Chorus Pro, AFNOR PDP) d'un client particulier, ajoutez le champ client_uid :

response = requests.post(
    'https://factpulse.fr/api/token/',
    json={
        'username': 'votre_email@example.com',
        'password': 'votre_mot_de_passe',
        'client_uid': 'identifiant_client'  # UID du client cible
    }
)

token = response.json()['access']

Via le Dashboard

  1. Connectez-vous sur https://factpulse.fr/api/dashboard/
  2. Générez un token API
  3. Copiez et utilisez le token dans votre configuration

📚 Ressources

📄 Licence

MIT License - Copyright (c) 2025 FactPulse

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

factpulse-1.0.6.tar.gz (146.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

factpulse-1.0.6-py3-none-any.whl (475.1 kB view details)

Uploaded Python 3

File details

Details for the file factpulse-1.0.6.tar.gz.

File metadata

  • Download URL: factpulse-1.0.6.tar.gz
  • Upload date:
  • Size: 146.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for factpulse-1.0.6.tar.gz
Algorithm Hash digest
SHA256 ca28fa6adda8bc7796a3409dfa04dd9e93ed53432a533567d33bb1eb3d5656ad
MD5 818cc4ba50ee5850c5ba807f57120f5b
BLAKE2b-256 a2f308d31234ecab49da54d1a41913c84273c284af767b2df8c9d85bfeff1dbc

See more details on using hashes here.

File details

Details for the file factpulse-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: factpulse-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 475.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for factpulse-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 59e6055d96a64b8473073f0e1934f6e6acf9347c017da5b078d1f85b504fca54
MD5 4078f8140850a2d5f82d3c071dd29b07
BLAKE2b-256 74b0f219d3a8c325cfd4e4782846931f11f1227a48e5e840b465eba6ee470557

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page