FormatX API Documentation

API REST pour convertir vos factures PDF en format Facture-X conforme EN 16931

Authentification

Incluez votre clé API dans le header de chaque requête:

X-API-Key: fx_your_api_key_here
              
ou

Authorization: Bearer fx_your_api_key_here

POST /api/v1/convert

Convertit une facture PDF en Facture-X

Request Body

{
  "pdfBase64": "JVBERi0xLjQKJeLjz9...",  // Required: PDF en base64
  "profile": "comfort",                   // Optional: basic | comfort | extended
  "autoValidate": true                    // Optional: valider automatiquement
}

Response 200

{
  "success": true,
  "data": {
    "extractedData": {
      "invoiceNumber": "2025119002",
      "invoiceDate": "2025-11-19",
      "supplierName": "MASSAGE CONCEPT",
      ...
    },
    "factureX": {
      "xml": "<?xml version='1.0'...",
      "profile": "comfort",
      "fileName": "facture-x-2025119002.xml"
    },
    "validation": {
      "isValid": true,
      "score": 95,
      "errors": [],
      "warnings": []
    }
  },
  "meta": {
    "apiVersion": "1.0",
    "creditsRemaining": 950
  }
}

POST /api/v1/validate

Valide une facture ou un XML Facture-X

Request Body

{
  "invoiceData": {
    "invoiceNumber": "INV-001",
    "supplierVAT": "FR32123456789",
    ...
  }
}

Response 200

{
  "success": true,
  "validation": {
    "isValid": true,
    "score": 100,
    "errors": [],
    "warnings": []
  }
}

Codes d'erreur

401 UnauthorizedClé API invalide ou manquante
429 Rate Limit ExceededLimite mensuelle atteinte
422 Unprocessable EntityImpossible d'extraire les données du PDF

Tarification

Gratuit

0€

100 conversions/mois

Starter

49€/mois

1,000 conversions/mois (0.05€/conv)

Business

199€/mois

10,000 conversions/mois (0.02€/conv)

Exemple complet (cURL)

curl -X POST https://formatx.app/api/v1/convert \
  -H "X-API-Key: fx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "pdfBase64": "JVBERi0xLjQKJeLjz9...",
    "profile": "comfort",
    "autoValidate": true
  }'