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 – Taxes, Tax Regions, and Territorial Rules
View Categories

REST API – Taxes, Tax Regions, and Territorial Rules

10 minutes

0:00 / 11: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)

The API provides access to all settings on the Tax Calculation screen: taxes and their calculation methods, fees and their amounts by region, tax regions, the region for each country, territorial exceptions, automatic suggestion, and the address tester. Validation controls match those of the UI: whatever is rejected by the screen is rejected by the API with the same error reason.

All three operations use the REST API session and are restricted to administrator accounts.

Operation Method Result
tax_region_configuration GET Complete configuration and consistency checks
tax_region_preview GET Region for an address, and suggestion for a new document, without saving anything
tax_region_configure POST A modification, validated and saved in a single step

The input parameter is a JSON object. Checkboxes (enabled, active, taxable, documentTest, intravatApproved) expect a true JSON boolean: the string "false" is rejected.


1. Read configuration #

tax_region_configuration takes no parameters.

curl 'https://apps.kafinea.com/YourKafinea/webservice.php?operation=tax_region_configuration&sessionName=YOUR_SESSION_ID'
Key of result.configuration Content
regions Numeric ID and name of each tax region
taxes Each item tax (appliesTo: product) and fee tax (shipping), including inactive ones: taxId, name, active, calculation method method, type, compoundOn, default rate defaultRate, and rates by region ratesByRegionId
charges Each fee from the Fees (& their taxes) tab: chargeId, name, format, type, default amount defaultValue, amounts by region valuesByRegionId, taxable, and applied taxes taxIds
countries Each country: identifier, ISO code, base region, business and individual regions, business condition
rules Territorial exceptions, active or inactive, with their criterion and priority
enabled, departure_country, operation_kind, organization_ids Automatic suggestion and its scope
diagnostics configurationIssues (duplicate countries, overlapping exceptions, deleted region) and missingRates (missing rates for a used region)

The identifiers in this response are those to be sent back in updates. They vary from one instance to another: retrieve them from the target instance.


2. Test an address or a new document #

tax_region_preview receives the address in input: country (ISO code, French or English name), postcode, and state.

curl -G 'https://apps.kafinea.com/YourKafinea/webservice.php' \
  --data-urlencode 'operation=tax_region_preview' \
  --data-urlencode 'sessionName=YOUR_SESSION_ID' \
  --data-urlencode 'input={"country":"France","postcode":"97300"}'

The response returns the recognized country, the geographic region (geography), and the rule or country that determined it. Using documentTest: true, include customer and transaction facts (partyNature, intravatApproved, vatNumber, organizationId, operation, goodsOrServices, departureCountry, partyRegionId): the response then includes the region that a new document would receive (document). No facts are inferred. vatNumber is the customer’s VAT number, formatted as a JSON string; any other data type is rejected.

organizationId accepts the company ID or its exact name (also via organizationName). A missing or unknown company, or a name shared by multiple companies, is reported in inputIssues, along with the configured companies.

When the transaction context does not permit suggesting a region, document.advisories contains UNSUPPORTED_TAX_CONTEXT and document.advisory_details specifies the reason:

cause Meaning
ORGANIZATION_NOT_CONFIGURED The company is not among the companies selected for automatic selection
OPERATION_KIND_NOT_SUPPORTED The transaction does not involve goods
DEPARTURE_COUNTRY_NOT_CONFIGURED The departure country in the settings is missing or not recognized
DEPARTURE_COUNTRY_UNKNOWN The provided departure country is missing or not recognized
DEPARTURE_COUNTRY_MISMATCH The provided departure country differs from the configured departure country
MODULE_NOT_SUPPORTED The document is not a sales document
OPERATION_NOT_SALE The transaction is not a sale

Each entry also provides the received value (actual), the expected value (expected), and a human-readable message, for example: “Company 0 is not among the companies configured for automatic region selection: 530 (My Company).”

To test a modification before saving it, pass configurationPreview: the same object as in tax_region_configure, extended with configurationKind (settings, country, or rule).


3. Modify configuration #

tax_region_configure receives kind and the complete modification object input.

kind Effect input
region Creates, renames, or deletes a region {"action":"save","name":"…"} to create; add region_id to rename; {"action":"delete","region_id":12} to delete
tax_grid Replaces the default rate and region rates of an existing tax appliesTo, taxId, defaultRate, complete ratesByRegionId, for example {"3":0,"5":20}
tax Creates a tax, or redefines an existing tax appliesTo, name, active, method (Simple, Compound or Deducted), type (Fixed or Variable), defaultRate, ratesByRegionId, compoundOn; taxId to edit
tax_status Enables or disables a tax appliesTo, taxId, active
charge Creates a fee, or redefines an existing fee with its amounts by region name, format (Flat or Percent), type, defaultValue, valuesByRegionId, taxable, taxIds; chargeId to edit
charge_delete Deletes a fee chargeId
country Changes the region of a country, or of multiple countries at once country_id, mdstaxregionid, mdsprofessionaltaxregionid, mdsindividualtaxregionid, mdsprofessionaltaxcondition (nature_only, qualified_customer or vat_number); or isocodes containing only the fields to update (see below)
rule Creates or updates a territorial exception label, country, criterion_type (postcode_prefix, postcode_range, subdivision), criterion_value, criterion_end for a range, priority, active, the three regions, and the condition; ruleid to update
settings Enables or configures automatic suggestion enabled, departure_country, operation_kind (goods to enable), organization_ids
french_baseline Executes Generate France Tax Settings {}
curl -X POST 'https://apps.kafinea.com/YourKafinea/webservice.php' \
  -d 'operation=tax_region_configure' \
  -d 'sessionName=YOUR_SESSION_ID' \
  -d 'kind=rule' \
  --data-urlencode 'input={"label":"Canaries – Las Palmas","country":"ES","criterion_type":"postcode_prefix","criterion_value":"35","priority":50,"active":true,"mdstaxregionid":5,"mdsprofessionaltaxregionid":0,"mdsindividualtaxregionid":0,"mdsprofessionaltaxcondition":"nature_only"}'

In this example, 5 is the identifier of the “Non-EU” region retrieved from the instance. A region value is 0 when unset. The response {"saved":true,"result":{…}} returns the created or updated identifier (region_id, ruleid, taxId, chargeId). Then re-read the configuration using tax_region_configuration, and test several addresses.

The system guarantees match those of the UI:

  • a modification is saved entirely or not at all; creating a tax and french_baseline are fully validated prior to writing;
  • a region still in use by a country, exception, rate table, item, or saved document is retained;
  • two active exceptions of equal priority targeting the same address are rejected;
  • automatic suggestion can only be enabled if the configuration contains no inconsistencies;
  • a zero rate is a configured rate, and a fixed tax maintains an empty table;
  • french_baseline only fills in missing items and never overwrites an already configured region, rate, or country. Its response lists what was created; if re-executed, it creates nothing.

A rejection starts with a stable error code, such as LBL_TAX_REGION_INVALID_RULE, followed by the explanation displayed in the UI and, for an incomplete object, the missing field. Test the code in your integration logic and display the explanation.

Regions can also be read and updated via the CRUD operations on the module below, subject to the same validation rules:

elementType=MdsTaxRegion   champ : name

The condition vat_number grants the business region to a business customer whose record contains a VAT number from a country other than the departure country: only the presence of a digit and the two-letter prefix matter, EL denotes Greece, and a prefix-free number is accepted. Ticking the Intra-community exemption authorized checkbox on the record (mdsintravatapproved) also satisfies the condition. Otherwise, the base region applies with notice VAT_NUMBER_MISSING.

Multiple countries at once. Using isocodes (from 1 to 300 ISO codes from the country list) instead of country_id, only the submitted fields are updated across each country in the list: each country retains its other fields, ensuring that a custom-configured country is not overridden beyond those fields. The business region must always be passed with its condition. Either all countries are updated, or none; the response lists them in result.isocodes and the history retains one line per country. When placed inside configurationPreview, the same object can be tested with tax_region_preview before being saved.

curl -X POST 'https://apps.kafinea.com/YourKafinea/webservice.php' \
  -d 'operation=tax_region_configure' \
  -d 'sessionName=YOUR_SESSION_ID' \
  -d 'kind=country' \
  --data-urlencode 'input={"isocodes":["BE","DE","IT"],"mdsprofessionaltaxregionid":6,"mdsprofessionaltaxcondition":"vat_number"}'

A country’s region should preferably be updated using kind: "country": this is the only operation that also configures business and individual regions. Generic operations on the country module enforce the same safeguards:

elementType=MdsTaxCountry   champs : countryname, isocode, mdstaxregionid, taxzone
  • update and revise can update mdstaxregionid: the selected region is validated just as in the UI, and previously configured business and individual regions are preserved;
  • a country’s ISO code cannot be changed (LBL_TAX_COUNTRY_ISO_IMMUTABLE); case and whitespace variations are tolerated;
  • create only accepts an existing ISO code that is not already in the list (LBL_TAX_COUNTRY_ISO_UNKNOWN, LBL_TAX_COUNTRY_ISO_DUPLICATE);
  • delete is rejected (LBL_TAX_COUNTRY_DELETE_REFUSED): clear the country mapping instead.

Taxes (Tax) and item taxes (ProductTaxes) can still be read using retrieve and query, but their generic write operations are rejected (LBL_TAX_GENERIC_WRITE_REFUSED, LBL_PRODUCT_TAXES_GENERIC_WRITE_REFUSED): taxes must be created and modified using kind: "tax", tax_grid, or tax_status. Updating a product or service via the API only alters its tax categories if tax fields are explicitly provided (tax1, tax2…): fields provided with a value replace its entire set of categories, and passing an empty field removes the corresponding category. If no tax fields are supplied, categories remain unchanged.

Create a tax #

A tax is created using kind: "tax" without taxId. It follows the rules of the Add Tax form:

  • the name must be unique among taxes of the same scope, including inactive ones;
  • the calculation method is selected upon creation and cannot be changed later; to change it, create another tax and disable the former one;
  • a compound tax (Compound) applies on top of other active simple taxes, listed in compoundOn;
  • a deducted tax (Deducted) applies only to items and remains fixed;
  • only a variable tax (Variable) accepts rates by region.
curl -X POST 'https://apps.kafinea.com/YourKafinea/webservice.php' \
  -d 'operation=tax_region_configure' \
  -d 'sessionName=YOUR_SESSION_ID' \
  -d 'kind=tax' \
  --data-urlencode 'input={"appliesTo":"product","name":"Éco-participation","active":true,"method":"Simple","type":"Fixed","defaultRate":0.5,"ratesByRegionId":{},"compoundOn":[]}'

Creation adds a column to document lines: taxes cannot be deleted, but they can be disabled using kind: "tax_status". All validation checks occur prior to creation. Next, check the new tax on the relevant products and services.

Configure fees by region #

A variable fee takes an amount per region in valuesByRegionId, for example {"3":15,"5":0}. The amount Flat is stated in the base currency; a fee Percent must remain between 0 and 100. A taxable fee lists active fee taxes in taxIds.

As in the UI, kind: "charge_delete" removes a fee from new documents; saved documents retain their existing amounts. Assign a different name to a new fee. If re-executed, the deletion returns alreadyDeleted: true.


4. With the MCP Server and the Assistant #

The MCP server and the Kafinea Assistant use these same operations, subject to their data modification controls. Modifying configuration settings does not recalculate previously saved documents.


5. Tax region of a document saved via the API #

The create, update, and revise operations for quotes, orders, invoices, and credit notes handle field region_id as follows:

region_id submitted Creation Modification with LineItems Modification without LineItems
missing suggested region, or customer default region, otherwise none unchanged unchanged
null treated as missing region removed rejected if it differs from the saved region
"" or 0 explicit absence of region explicit absence rejected if it differs from the saved region
region ID this region this region rejected if it differs from the saved region
other value rejected (INVALID_ID_ATTRIBUTE), nothing is saved rejected rejected

Each line’s tax rate depends on the region: a region only changes along with the lines. An update without LineItems that changes the region is rejected (MANDATORY_FIELDS_MISSING). Submitting the already saved region, for instance after a retrieve, remains accepted; null and 0 are equivalent here.

Each document maintains its own region: a document’s region is never carried over to the document saved immediately after in the same batch.


Related References #

  • Tax Configuration
  • Tax Region for Documents
  • Introduction to the REST API
Index
  • 1. Read configuration
  • 2. Test an address or a new document
  • 3. Modify configuration
    • Create a tax
    • Configure fees by region
  • 4. With the MCP Server and the Assistant
  • 5. Tax region of a document saved via the API
  • 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