Odoo 19 & 20 JSON-2 API: The Interface for E-Commerce Integrations

Since Odoo 19, the JSON-2 API has been the interface for new external integrations, and it remains the recommended route in Odoo 20 (September 2026). XML-RPC and JSON-RPC still work, but Odoo has deprecated them. With Odoo 20, the first part is already gone: the db service. Anyone still building on XML-RPC today is effectively already planning the next migration of the integration layer.

This article describes the interface the way an Odoo connector actually uses it: authentication and API keys, methods, error objects, transactions, idempotence in bulk imports and how it works alongside the token models of Shopware and PlentyONE.


What Odoo 20 Changes for the Interfaces

  • JSON-2 stays the same: structure, authentication and error format are identical to Odoo 19. A JSON-2 connector built for Odoo 19 can therefore be reused; models and fields may change between versions and should be checked via /doc.
  • db service removed: since Odoo 20 (Odoo Online: 19.1), the RPC service db no longer exists. Scripts that use it to list, create or back up databases break on upgrade.
  • common and object still work: they are scheduled for removal in Odoo 22 (fall 2028) and Odoo Online 21.1 (winter 2027). XML-RPC integrations that only read and write records therefore still run on Odoo 20, but they have a fixed end date.

Since version 2.0.0, our public reference scripts on GitHub are available separately for Odoo 19 and Odoo 20, with identical test IDs. This makes every call directly comparable between the two versions.


Why JSON-2 Is the Current Standard

Odoo lists the endpoints /xmlrpc, /xmlrpc/2 and /jsonrpc as deprecated and names the JSON-2 API as their successor. For new development this means: building on XML-RPC is still technically possible, but architecturally outdated.

Before any architecture decision, check whether your operating model allows external API access at all. According to Odoo, access to data via the external API is only included in the Custom pricing plan; One App Free and Standard exclude it. For Odoo.sh and self-hosted installations, the documentation states no separate rule, so access should be clarified with Odoo or your Odoo partner.

For a Shopware-Odoo integration this leads to a clear requirement: on Odoo Online you need the Custom plan. Anyone who clarifies this only after the architecture decision risks an operating model that does not technically allow the planned integration.


Integration diagram for Odoo 19 and 20 with JSON-2 API, authentication and connected middleware.

Authentication and API Keys

Authentication is stateless: an API key is sent as a bearer token in the HTTP header; JSON-2 has no login with user name and password. You create the key in the preferences under Account Security, with a description and a duration. It is shown only once and cannot be retrieved later.

Important for continuous operation: API keys expire. Odoo allows a maximum duration of three months. A connector therefore needs planned rotation: create a new key, store it in the connector and only then revoke the old one. Programmatically this works via res.users.apikeys.generate(), by default only for users with administrator rights and with a maximum of ten keys per user. For integrations, use a dedicated key per service.

An example call against a self-hosted Odoo instance, valid unchanged for Odoo 19 and 20:

curl -X POST "${ODOO_URL}/json/2/res.partner/search_read" \
  -H "Content-Type: application/json; charset=utf-8" \
  -H "Authorization: Bearer ${ODOO_API_KEY}" \
  -H "User-Agent: shopware-odoo-connector" \
  -d '{"domain":[],"fields":["name"],"limit":1}'

Besides Authorization and Content-Type, two more headers matter: X-Odoo-Database, required when a server hosts several databases and the dbfilter does not evaluate the host header; and User-Agent with the name of your software, as recommended by Odoo. In migration projects with parallel processes, this lets you tell migration load apart from regular connector traffic.


Syntax, Methods and Error Handling

Every call is a POST to /json/2/<model>/<method>, with all arguments named in the JSON body. JSON-2 has no positional arguments. Language and other settings are passed via context, for example {"lang": "en_US"}. The most important methods for integrations:

MethodFunction
search_readsearch and read in one step, including pagination and complex filters (domains)
readtargeted reading of specific records by their IDs
writeupdate existing records
unlinkpermanently delete records
loadbatch import method from the CSV import mechanism, much faster for bulk data than individual create() calls

Instead of an error field in the result, the API returns real HTTP status codes: 200 on success, 4xx or 5xx on error, for example 401 for an invalid or expired API key. On error, the body contains a JSON error object with the fields name (fully qualified name of the Python exception), message, arguments, context and debug. Using name, you can tell business errors such as validation failures apart from technical errors such as authentication problems and control the retry decision accordingly.

An example: if the API reports a validation error because a required field is missing, an automatic retry is pointless, as the error will occur again in exactly the same way. If it returns 401, the key is invalid or expired; no retry fixes that, only a valid key does. A connector that treats both cases the same hides real data problems behind apparent technical faults.


Transactions: Every Call Stands on Its Own

Every call to the JSON-2 endpoint runs in its own SQL transaction. Several calls cannot be chained into one transaction. Processes that must either fully succeed or not happen at all, such as creating an order and posting the payment, therefore need a method that bundles all steps into a single call. A connector that calls such steps one after another must detect and resolve partial success itself.


The load Method: Performance and Idempotence

For bulk imports in an ERP migration, the load() method is the central building block. It processes several records within a single model call and thus noticeably reduces API and ORM overhead compared with many individual create() calls – the actual performance gain depends on the model, fields, constraints and data volume.

The real reason load() is the right choice for migrations is not performance, however, but idempotence: load() accepts an id column that does not refer to the numeric database ID but to the record’s external ID (XML ID) – a freely assignable identifier that is stable across systems, in the form module.identifier. Odoo keeps these external IDs in the ir.model.data model, which maps them to the internal database ID. A record whose external ID already exists is updated instead of duplicated on a repeated import – the basis for test migrations that can be repeated as often as needed.


Authentication Compared Across Systems

For a Shopware-Odoo integration it matters that all three systems use the same token format (Authorization: Bearer <Token>) but differ in how tokens are obtained and how long they last:

  • Odoo 19 and 20 (JSON-2): the API key is used directly as the bearer token, without a token exchange. It expires after the duration chosen when it was created, at most after three months. The connector needs no refresh per run, but a planned rotation.
  • Shopware 6 (Admin API): authentication via the OAuth 2.0 client credentials flow; the resulting access token is valid for only 600 seconds. For longer extraction runs, the connector must renew the token proactively instead of waiting for the first 401 error.
  • PlentyONE (REST API): authentication also via OAuth 2.0; the token is valid for 86,400 seconds (24 hours) – much less critical for single runs, but relevant for budget-controlled extractions running over several days.

Dynamic Runtime Documentation

A practical advantage of the JSON-2 API for integration work: every Odoo instance provides runtime-generated documentation under the path /doc. According to Odoo, the models, fields and methods actually available are specific to each database and can be looked up on exactly this /doc page.

This matters because Odoo instances differ in their actual data model – depending on installed modules, enabled features and individually created custom fields such as the x_shopware_uuid fields used in migration projects. Static, version-bound API documentation cannot reflect these instance-specific differences.

In practice, this means for a connector: before going live, check the actual field structure of the target instance via /doc instead of relying only on general documentation. This applies especially to custom fields and to the upgrade from Odoo 19 to 20: models and fields can change between versions, so the connector is checked against the /doc page of the upgraded instance after the upgrade.

JSON-2 as the Basis of the Shopware-Odoo Integration

The JSON-2 API is the transport layer for ongoing synchronisation between Shopware and Odoo. Error handling and retry logic deliberately sit with the calling client, not the API: JSON-2 does not retry automatically. How this client-side error handling, event processing and queue integration are built in practice is shown in our article on the Odoo Shopware 6 Connector.


The JSON-2 API is the technical foundation of the integration. How it fits into the overall architecture of an ERP migration is shown in our overview on migrating from PlentyONE to Odoo.


Frequently Asked Questions about the Odoo JSON-2 API

Will our XML-RPC integration keep running on Odoo 20?

Usually yes, as long as it only uses the common and object services, i.e. reads and writes records. These are scheduled for removal only in Odoo 22 (fall 2028) and Odoo Online 21.1 (winter 2027). Scripts that use the db service no longer work on Odoo 20. For new development, use the JSON-2 API directly.

Do we need to adapt our JSON-2 connector for Odoo 20?

The interface itself is unchanged in Odoo 20. What needs checking are the models and fields you use, which can change between versions, and the duration of your API keys.

What happens if our chosen Odoo hosting model does not allow external API access?

Then the JSON-2 API is not available in full, which makes a Shopware integration considerably harder or impossible. This requirement should therefore be checked before the hosting model is finally chosen, not afterwards.

Is the JSON-2 API suitable for very large data volumes?

Yes, especially in combination with the batch-capable load() method, which processes several records per call. For bulk migrations with several hundred thousand items, this is the recommended approach compared with individual create() calls.

We are not sure whether our planned Odoo hosting enables the required API at all.

That is the first question, not the last. Without external API access, the integration described here cannot be implemented – so this requirement comes before every architecture decision, not after it. We can support you here too: our managed hosting servers also provide ideal conditions for Odoo.


Sources

The statements on the JSON-2 API, API keys, transactions, the /doc endpoint and availability per Odoo plan are based on the official Odoo documentation for version 20.0: External JSON-2 API and External RPC API. The removal schedule for the RPC services comes from the External RPC documentation 20.0, the release date of Odoo 20 from the Odoo 20 Release Notes. Odoo has already postponed the schedule for the RPC interfaces once. Last checked against the live documentation: 2 December 2026.


Have Your API Architecture Reviewed for Your Migration

Whether your chosen Odoo operating model and edition provide the JSON-2 API to the extent you need, and what the integration architecture for your existing shop system should look like, we clarify in our free, no-obligation e-commerce audit.

✔ Free   ✔ No obligation   ✔ Tested against real Odoo 19 instances   ✔ Response within 24 hours

Christopher Einenkel

Senior Integration Architect & API Specialist
Specialist in ERP/PIM Integrations & Enterprise Interfaces

Christopher Einenkel is the strategic mind at HQ GmbH for advanced system integrations and complex API architectures. Whenever data synchronizations reach their limits or demanding enterprise systems such as Salesforce need to be connected to Shopify, he designs tailored, high-performance interface logic.

His track record includes the in-house development of proprietary enterprise solutions, including automated AI translation tools for product master data, seamless B2B procurement systems, as well as automated market evaluation and competitive monitoring solutions. In addition, he manages the technical implementation and API integration of digital software call center systems into existing CRM and ERP environments for our enterprise clients.

View full profile & interface certifications
Christopher Einenkel - Senior Integration Architect at HQ GmbH
↑