Skip to content
📢 Kafinea is a compatible solution for electronic invoicing! Learn more ➔
kafinea logo svg

Kafinea

  • Features
        • Finance
          • Purchases
          • Audits & KPIs
          • Accounting
          • Invoicing
        • Management
          • Documents
          • Project Management
          • Inventory Management
          • Maintenance
        • HR
          • Employees
          • Timesheets
          • Absence Management
          • Recruitment
        • Customer Service
          • Service Contracts
          • Interventions
          • Warranty Tracking
          • Tickets
        • Sales
          • Subscriptions
          • Sales Automation
          • CRM
          • Points of Sale
        • Cross-Features
          • API
          • Extranet
          • Electronic Signature
          • Workflows
  • Use Cases
  • Pricing
  • Login
  • Discover the demo
📢 Kafinea is electronic invoicing compatible! ➔
kafinea logo svg
Kafinea

API

16
  • REST API – Bulk import (upsert)
  • REST API – Authentication
  • REST API – Retrieve a Document’s PDF
  • REST API – File Management
  • REST API – Entity Relationships
  • REST API – Introduction
  • REST API – Taxes, Tax Regions, and Territorial Rules
  • REST API – Requests and Querying
  • REST API – Refresh an online store order
  • REST API – Bulk deletion (trash)
  • REST API – Cost Accounting
  • REST API – Product Kits
  • REST API – Generic and Specific Products
  • REST API – Action links
  • REST API – Approvals
  • REST API – Full Reference (OpenAPI)

Marketing

1
  • Leads

Sales

14
  • Customer purchase orders
  • Customer accounts
  • Customer Quotes
  • Customer credit notes
  • Company Search (Sirene)
  • Margins in quotes
  • Invoicing
    • Classic Invoicing
    • Progress Invoicing
    • Issue an electronic invoice
    • Invoicing Article Consumption
    • Recurring invoicing
  • Payments
    • Customer payments
    • Linking a payment to one or more invoices
  • Price list
    • Price list administrator guide

Purchases

5
  • Supplier invoices
  • Supplier Purchase Orders
  • Suppliers
  • Supplier Credits
  • Receiving an Electronic Invoice

Catalog

8
  • Units of measure
  • Products
  • Services
  • Sourcing Management
  • The Purchase Order Assistant
  • Generic products
  • Product kits
  • Catalog margin analysis

Finance

11
  • Bank Accounts
  • Manual entries
  • SEPA Mandates
  • Third-party bank accounts
  • Bank Transactions
  • Accounting
    • Cash accounting
    • Accounting entries
    • Tools for Checking Your Accounting
    • Accounting
    • Financial statements
    • Fiscal years

Human Resources

5
  • Timesheets
  • Activities
  • Pay Slips
  • Employee Extranet
    • Leave Management
    • The employee portal card

Project management

2
  • Secure assignments using a people list
  • The responder area: view and accept my assignments

Customer Support

1
  • The Client Portal

Inventory management

4
  • Goods receipt notes
  • Delivery Notes
  • Stock movements
  • Inventory Valuation

Cash register

1
  • Cash Registers

Document management

1
  • Electronic signature

Automation

2
  • Forms
  • Workflows

Templates

2
  • Email templates
  • Document templates

Artificial intelligence

4
  • AI Workflows
  • AI Chat
  • AI Text Assistant
  • Connect ChatGPT, Claude, or Gemini to Kafinea (MCP)

Kafinea interface

9
  • Automatic saving
  • Data Import/Export
  • Navigation
  • Records
  • Lists
  • The Layout Manager
  • Links Between Elements
  • Document Lines
  • List views: Kanban, Cards, Calendar, Planning, Gantt, Geographic map, and Analysis

Settings

10
  • Tax Configuration
  • Global search
  • Access Rights
  • User preferences
  • Numbering formats
  • SMTP Settings
  • Permanent locking
  • Catalog popup filtering
  • AI agents
  • Administer the MCP server

Business Guides

2
  • Enable employees to complete their HR record independently
  • Mobilizing thousands of field workers at scale
  • Kafinea
  • Documentation
  • API
  • REST API – Bulk import (upsert)
View Categories

REST API – Bulk import (upsert)

6 minutes

0:00 / 6:12
  • View as Markdown Open this page as plain Markdown (opens in a new tab)
  • Open in ChatGPT Ask questions about this page (opens in a new tab)
  • Open in Claude Ask questions about this page (opens in a new tab)
  • Open in Google AI Studio Ask questions about this page (Google account required) (opens in a new tab)

This page describes the operation to use to load or update a large number of records
at once
, identifying them by a business key (an item code, a customer reference, a
store reference) rather than by their Kafinea ID.

Operation Method Description
mass_upsert POST Write a batch of records identified by a business key

It is generic: it works for all modules, with the key you choose.

Reserved for administrators. Loading a batch of records is a data
migration task. A non-administrator account keeps create and update, one record at a time, with
its own permissions.


Why not create or update? #

The create and update operations remain the right choice when you
write one record at a time. For a data migration, they run into two issues:

  • Volume: one record per call, meaning 16,000 calls for 16,000 customers;
  • Resuming after an interruption: create always creates. An import interrupted midway cannot
    be restarted without first cleaning up what has already gone through, and update requires knowing
    the Kafinea ID, which you don’t have yet at this point.

mass_upsert finds the record by its business key: it updates what exists, creates what is
missing, and writes nothing when the submitted values already match what’s in place. You can therefore
resend the same batch as many times as needed.


Upsert – Write a batch of records #

POST https://apps.kafinea.com/{instance}/webservice.php

Parameter Type Required Description
operation string yes Must be mass_upsert
sessionName string yes Session identifier
elementType string yes Module name (e.g. Products, Accounts)
keyFields JSON yes Technical names of the fields forming the business key
elements JSON yes Array of records (500 maximum per call)

Each element of elements is a champ : valeur object, key included. The technical names of the
fields are read using describe.

curl example: update the weight and country of origin of items identified by their code.

curl -X POST https://apps.kafinea.com/YourKafinea/webservice.php \
  -d "operation=mass_upsert" \
  -d "sessionName=YOUR_SESSION_ID" \
  -d "elementType=Products" \
  -d 'keyFields=["productcode"]' \
  -d 'elements=[
        {"productcode":"9782070413110","productname":"Le Petit Prince","mdsweight":"0.180","mdsorigincountry":"FRA"},
        {"productcode":"9782070368228","productname":"La Peste","mdsweight":"0.150","mdsorigincountry":"FRA"}
      ]'

Response #

{
  "success": true,
  "result": {
    "module": "Products",
    "keyFields": ["productcode"],
    "processed": 2,
    "created": 1,
    "updated": 1,
    "unchanged": 0,
    "records": [
      { "index": 0, "id": "14x8842", "outcome": "updated" },
      { "index": 1, "id": "14x9317", "outcome": "created" }
    ],
    "errors": []
  }
}
Field Meaning
processed Number of records processed without errors
created The key was unknown: the record has just been created
updated The key existed and at least one submitted value was different
unchanged The key existed and everything was already up to date: nothing was written
records The line-by-line detail, with the position in the batch and the resulting ID
errors The rejected lines, with their position in the batch and the reason

Choosing the business key #

The key is the one you name in keyFields, and it can include several fields. It must
identify exactly one record: if the submitted key matches more than one, the line is rejected
with this reason rather than picking one at random. Correct the duplicate data, then resend the
line.

A few common keys:

What you are importing Business key
Items ["productcode"]
External ID mappings ["sourcesystem","objecttype","externalref"]

Key values are compared after removing leading and trailing spaces. An empty key
value causes the line to be rejected: a business key cannot be guessed.


Replayable: resend without worry #

The operation is idempotent. The same batch sent twice produces unchanged on the second run:
no duplicates, no unnecessarily updated modification date, and no stray history entries on records.

Likewise, a faulty line does not cancel the others: the valid lines in the batch are written, the
rejected lines come back in errors with their position, to be corrected and resent on their own.

On the other hand, if the elements parameter itself cannot be read (invalid JSON, more than 500
elements), the entire call is rejected: writing half of an unreadable batch would be worse than
writing none of it.

Finally, the operation does not open any backdoor: it applies the same permissions and the same
required-field checks as create and update. Whatever these operations reject, this one
rejects as well.


Use case: declaring IDs from an external system #

The most common need is to tell Kafinea which record corresponds to which object in an
external system
: a customer from your online store, an item from your marketplace, a
record from your previous software.

This is the mapping table that Kafinea checks before any attempt to match by
name or email. A declared mapping is a certainty, not a guess: it
eliminates duplicate customer records at the source. A mapping carries three pieces of information:

Field Role
sourcesystem Where the ID comes from. For an online store: onlinestore: followed by the store record’s ID
objecttype The relevant Kafinea module (Accounts, Products, SalesOrder…)
externalref The value the external system assigns to this object
recordid The targeted Kafinea record, in the form of a Webservice ID (10x54325)

Uniqueness is guaranteed per source system, and that’s the key point. The same customer may
have a different ID on each of your stores, and two stores may use the
same number for two different customers: the mapping can express this, whereas a simple “external
ref.” field on the customer record could not.

curl -X POST https://apps.kafinea.com/YourKafinea/webservice.php \
  -d "operation=mass_upsert" \
  -d "sessionName=YOUR_SESSION_ID" \
  -d "elementType=MdsExternalRef" \
  -d 'keyFields=["sourcesystem","objecttype","externalref"]' \
  -d 'elements=[
        {"sourcesystem":"onlinestore:44053","objecttype":"Accounts","externalref":"39146","recordid":"10x54325"},
        {"sourcesystem":"onlinestore:44053","objecttype":"Products","externalref":"3760174130121","recordid":"13x8842"}
      ]'

recordid identifies a record: it is written and read like any other link to a record
in the API, using the full Webservice ID returned by query or retrieve. A
raw ID (54325) is rejected. The targeted record is thus a clickable link in
Kafinea, and the customer record displays the list of its external IDs.

Declared mappings can be read back like any other module, using
query.

Migrating an existing customer base #

The typical scenario is setting up an online store whose customers already exist
in Kafinea. Without mappings, synchronization can only guess, and creates duplicates.

  1. On the store record, set customer recognition to “Store customer ref.”
    (see the online store settings).
  2. Declare the mappings in batches of 500, using this operation.
  3. Run the synchronization: each order finds its customer by identity.

A customer missing from the table is not silently created if you have unchecked “Create customers
from the store”: the order is attached to the store’s fallback customer and the issue is
named in the synchronization log. You complete the mapping, then refresh
the order from the store.


Related references 🔗 #

  • Full API reference
  • Bulk deletion (trash)
  • Queries and lookups
  • API introduction
Index
  • Why not create or update?
  • Upsert – Write a batch of records
    • Response
  • Choosing the business key
  • Replayable: resend without worry
  • Use case: declaring IDs from an external system
    • Migrating an existing customer base
  • Related references 🔗

An all-in-one software designed for SMEs. Take advantage of the automation capabilities and flexibility of our business management platform to make work easier for all your employees.

RESOURCES

Blog
Brand Guidelines
Distributors
Help
Security

Customer portal
ABOUT

About Us
Contact Us
Cookie Policy
FAQ
Legal Notice
Privacy Policy
Terms of Service

Electronic invoicing compatible solution
French Tech Grand Paris Logo
FINANCE

Accounting
Audits & KPIs
Invoicing
Purchases

MANAGEMENT

Documents
Inventory Management
Maintenance
Project Management

HR

Absence Management
Employees
Recruitment
Timesheets

CUSTOMER SERVICE

Interventions
Service Contracts
Tickets
Warranty Tracking

SALES

CRM
Points of Sale
Sales Automation
Subscriptions

© 2026 Madiasoft - Kafinea

24 rue Louis Blanc, 75010 PARIS, France

+33 1 70 06 05 41

Facebook Linkedin
kafinea logo svg
Gérer le consentement aux cookies
Pour offrir les meilleures expériences, nous utilisons des cookies pour stocker et/ou accéder aux informations des appareils. Le fait de consentir à ces cookies nous permettra de traiter des données telles que le comportement de navigation ou les ID uniques sur ce site. Le fait de ne pas consentir ou de retirer son consentement peut avoir un effet négatif sur certaines caractéristiques et fonctions.
Fonctionnel Always active
Le stockage ou l’accès technique est strictement nécessaire dans la finalité d’intérêt légitime de permettre l’utilisation d’un service spécifique explicitement demandé par l’abonné ou l’internaute, ou dans le seul but d’effectuer la transmission d’une communication sur un réseau de communications électroniques.
Préférences
Le stockage ou l’accès technique est nécessaire dans la finalité d’intérêt légitime de stocker des préférences qui ne sont pas demandées par l’abonné ou la personne utilisant le service.
Statistiques
Le stockage ou l’accès technique qui est utilisé exclusivement à des fins statistiques. Le stockage ou l’accès technique qui est utilisé exclusivement dans des finalités statistiques anonymes. En l’absence d’une assignation à comparaître, d’une conformité volontaire de la part de votre fournisseur d’accès à internet ou d’enregistrements supplémentaires provenant d’une tierce partie, les informations stockées ou extraites à cette seule fin ne peuvent généralement pas être utilisées pour vous identifier.
Marketing
Le stockage ou l’accès technique est nécessaire pour créer des profils d’internautes afin d’envoyer des publicités, ou pour suivre l’internaute sur un site web ou sur plusieurs sites web ayant des finalités marketing similaires.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Voir les préférences
  • {title}
  • {title}
  • {title}
  • Features
    • Finance
      • Purchases
      • Audits & KPIs
      • Accounting
      • Invoicing
    • Management
      • Documents
      • Interventions
      • Project Management
      • Inventory Management
    • HR
      • Employees
      • Timesheets
      • Absence Management
      • Recruitment
    • Customer Service
      • Service Contracts
      • Warranty Tracking
      • Maintenance
      • Tickets
    • Sales
      • Subscriptions
      • Sales Automation
      • CRM
      • Points of Sale
    • Cross-Features
      • API
      • Extranet
      • Electronic Signature
      • Workflows
  • Use Cases
  • Pricing
  • Login
  • Discover the demo