POST /invoice

Crée une nouvelle facture.

Numérotation automatique:

  • Si l'état est 'waiting', 'paid', 'notpaid' ou 'late', un numéro est automatiquement attribué
  • Le système verrouille la numérotation pendant l'attribution pour éviter les doublons
  • Un numéro d'enregistrement FEC (numberRecord) est aussi généré

Types de factures:

  • invoice: Facture standard
  • invoice_credit: Avoir
  • external: Facture externe (client fournisseur)
  • external_credit: Avoir externe
  • proforma: Facture proforma
  • advance: Acompte

Calculs automatiques:

  • Les totaux HT, TVA et TTC sont calculés automatiquement
  • Les réductions globales sont appliquées
  • La date d'échéance est calculée selon les paramètres de l'entreprise

Événements déclenchés:

  • CREATE_INVOICE
  • Mise à jour du stock si nécessaire

Réponse:

  • Inclut les liens pdf_link et html_link pour accéder aux documents
application/json

Body Required

  • client string

    ID du client

  • client_name string

    Nom du client (si pas de client référencé)

  • client_address string
  • client_city string
  • client_zip_code string
  • client_country string

    Default value is France.

  • client_email string(email)

    Email pour l'envoi de la facture

  • date string(date-time)

    Date de la facture (défaut = maintenant)

  • payment_expiry_date string(date-time)

    Date d'échéance (calculée automatiquement si non fournie)

  • state string

    État initial (draft = brouillon sans numéro)

    Values are draft, waiting, paid, notpaid, or late. Default value is draft.

  • type string

    Values are invoice, invoice_credit, external, external_credit, proforma, or advance. Default value is invoice.

  • title string

    Titre/objet de la facture

  • invoice_lines array[object]

    Lignes de la facture

    Hide invoice_lines attributes Show invoice_lines attributes object
    • title string

      Titre de la ligne

    • description string

      Description détaillée

    • reference string

      Référence produit

    • product string

      ID du produit (optionnel)

    • price_ht number

      Prix unitaire HT

    • quantity number

      Default value is 1.

    • tva_rate number

      Taux de TVA (ex. 20 pour 20%)

    • unit string

      Unité (pièce, heure, etc.)

    • type string

      Type de ligne

      Values are product, header, subtotal, or globalDiscount. Default value is product.

    • discount number

      Remise en pourcentage

Responses

  • 201 application/json

    Facture créée

    Hide response attribute Show response attribute object
    • newInvoice object
      Hide newInvoice attributes Show newInvoice attributes object
      • _id string

        Unique identifier for the invoice

      • VATRates array[object]

        List of VAT rates applied to the invoice

        Hide VATRates attributes Show VATRates attributes object
        • amount number

          Amount of VAT

        • rate string

          VAT rate

        • total number

          Total amount with this VAT rate

      • acomptes array[object]

        List of advance payments

        Hide acomptes attributes Show acomptes attributes object
        • _id string
        • amount number

          Amount of the advance payment

        • amount_ht number

          Amount without tax

        • credit boolean

          Default value is false.

        • date string(date-time)
      • base_currency string

        The currency with which the company works for this invoice

        Default value is EUR.

      • client string

        Reference to the client

      • client_name string

        Name of the client

      • client_address string

        Address of the client

      • client_city string

        City of the client

      • client_zip_code string

        Zip code of the client

      • client_country string

        Country of the client

        Default value is France.

      • client_email string

        Email of the client

      • client_phone string

        Phone number of the client

      • company string

        Reference to the company

      • company_name string

        Name of the company

      • date string(date-time)

        Date of the invoice

      • payment_expiry_date string(date-time)

        Expiry date for payment

      • invoice_lines array[object]

        List of invoice lines

        Hide invoice_lines attributes Show invoice_lines attributes object
        • _id string

          Unique identifier for the line

        • description string

          Description of the line

        • price_ht number

          Price without tax

          Default value is 0.

        • quantity number

          Quantity

          Default value is 1.

        • reference string

          Reference of the product

        • title string

          Title of the line

        • total_ht number

          Total amount without tax

          Default value is 0.

        • total_ttc number

          Total amount with tax

          Default value is 0.

        • tva_rate number

          VAT rate

        • type string

          Type of the line

          Values are product, header, subtotal, or globalDiscount. Default value is product.

        • unit string

          Unit of measurement

      • number string

        Invoice number

      • state string

        State of the invoice

        Values are draft, waiting, paid, notpaid, late, or inactive. Default value is draft.

      • title string

        Short description or label of the invoice

      • total_ht number

        Total amount without tax

      • total_ttc number

        Total amount with tax

      • total_tva number

        Total tax amount

      • type string

        Type of the invoice

        Values are invoice, credit, sold, advance, external, or external_credit. Default value is invoice.

      • payments array[object]

        List of payments

        Hide payments attributes Show payments attributes object
        • _id string

          Unique identifier for the payment

        • mode string

          Reference to the payment method

        • method_name string

          Name of the payment method

        • amount number

          Amount of the payment

        • date string(date-time)

          Date of the payment

        • check_number string

          Check number if applicable

  • 400

    Données invalides

  • 403

    Non autorisé

POST /invoice
curl \
 --request POST 'https://wuro.pro/api/v3.2/invoice' \
 --header "X-APP-ID: $API_KEY" \
 --header "X-APP-SECRET: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"client":"string","client_name":"string","client_address":"string","client_city":"string","client_zip_code":"string","client_country":"France","client_email":"hello@example.com","date":"2025-05-04T09:42:00Z","payment_expiry_date":"2025-05-04T09:42:00Z","state":"draft","type":"invoice","title":"string","invoice_lines":[{"title":"string","description":"string","reference":"string","product":"string","price_ht":42.0,"quantity":1,"tva_rate":42.0,"unit":"string","type":"product","discount":42.0}]}'
Request examples
{
  "client": "string",
  "client_name": "string",
  "client_address": "string",
  "client_city": "string",
  "client_zip_code": "string",
  "client_country": "France",
  "client_email": "hello@example.com",
  "date": "2025-05-04T09:42:00Z",
  "payment_expiry_date": "2025-05-04T09:42:00Z",
  "state": "draft",
  "type": "invoice",
  "title": "string",
  "invoice_lines": [
    {
      "title": "string",
      "description": "string",
      "reference": "string",
      "product": "string",
      "price_ht": 42.0,
      "quantity": 1,
      "tva_rate": 42.0,
      "unit": "string",
      "type": "product",
      "discount": 42.0
    }
  ]
}
Response examples (201)
{
  "newInvoice": {
    "_id": "string",
    "VATRates": [
      {
        "amount": 42.0,
        "rate": "string",
        "total": 42.0
      }
    ],
    "acomptes": [
      {
        "_id": "string",
        "amount": 42.0,
        "amount_ht": 42.0,
        "credit": false,
        "date": "2025-05-04T09:42:00Z"
      }
    ],
    "base_currency": "EUR",
    "client": "string",
    "client_name": "string",
    "client_address": "string",
    "client_city": "string",
    "client_zip_code": "string",
    "client_country": "France",
    "client_email": "string",
    "client_phone": "string",
    "company": "string",
    "company_name": "string",
    "date": "2025-05-04T09:42:00Z",
    "payment_expiry_date": "2025-05-04T09:42:00Z",
    "invoice_lines": [
      {
        "_id": "string",
        "description": "string",
        "price_ht": 0,
        "quantity": 1,
        "reference": "string",
        "title": "string",
        "total_ht": 0,
        "total_ttc": 0,
        "tva_rate": 42.0,
        "type": "product",
        "unit": "string"
      }
    ],
    "number": "string",
    "state": "draft",
    "title": "string",
    "total_ht": 42.0,
    "total_ttc": 42.0,
    "total_tva": 42.0,
    "type": "invoice",
    "payments": [
      {
        "_id": "string",
        "mode": "string",
        "method_name": "string",
        "amount": 42.0,
        "date": "2025-05-04T09:42:00Z",
        "check_number": "string"
      }
    ],
    "pdf_link": "string",
    "html_link": "string"
  }
}