Title “Odoo API: XML-RPC, JSON-RPC, JSON-2, what to know” on a turnK night background

Odoo API: XML-RPC, JSON-RPC, JSON-2, what to know

summary
  1. What is the Odoo API?
  2. The Different Types of Odoo API
    1. XML-RPC: The Historical Standard
    2. JSON-RPC: The Modern Alternative
    3. The JSON-2 API: the one to choose for a new project on Odoo 19 and later
    4. What About a REST API?
    5. Your Odoo Version Changes Everything
  3. Is the Odoo API Available on Every Plan?
  4. Why Use the Odoo API? Key Benefits
  5. Getting Started with the Odoo API: A Practical Guide
    1. Prerequisites
    2. Authentication
    3. Common Operations (CRUD)
    4. A Few Tips
  6. Practical Use Cases for the Odoo API
  7. Market Connector or Custom Integration?
  8. Planning an Odoo integration project? Let's talk

The Odoo API is the gateway that lets an external application read and write in your ERP (contacts, orders, invoices, products) without going through the interface. It comes in three flavours: XML-RPC and JSON-RPC, the historical protocols, and JSON-2, described in the official documentation since Odoo 19. According to that documentation, access to data through the external API depends on your Odoo plan.

As digital tools multiply, getting your software platforms to talk to each other saves a lot of re-keying. If you use Odoo, the all-in-one business management suite, you have probably already seen what data exchanges change day to day. But how do you go further? How do you connect Odoo to your e-commerce site, your CRM, your accounting tool or other business tools?

What is the Odoo API?

Think of an API (Application Programming Interface) as a messenger or universal translator for software. It is a set of rules and protocols that lets applications communicate, exchange data and trigger actions without direct human intervention. The Odoo API is the gateway that lets external applications interact securely and in a structured way with your database and the features of your Odoo instance. It opens up a huge range of possibilities for automating your processes and enriching your software ecosystem.

The Different Types of Odoo API

Odoo's APIs change from one version to the next: the official Odoo documentation for your version is the reference. Two protocols have historically been used to interact with its modules, and a more recent API, JSON-2, is gradually replacing them.

XML-RPC: The Historical Standard

XML-RPC (Remote Procedure Call via XML) is the historical protocol of the Odoo API. It uses XML to structure the requests and responses exchanged between the external application and Odoo. XML is generally more verbose than JSON. Many existing integrations rely on it: check what happens to it in your version before building anything new on top of it. Odoo's official documentation announces its removal in Odoo 22 (fall 2028).

JSON-RPC: The Modern Alternative

JSON-RPC (Remote Procedure Call via JSON) is a more modern and often lighter alternative. It uses JSON (JavaScript Object Notation), which is more concise and generally easier to parse for modern web applications, especially those using JavaScript. Its removal is announced at the same time as XML-RPC's.

The JSON-2 API: the one to choose for a new project on Odoo 19 and later

Since Odoo 19, the official documentation describes the JSON-2 external API. You send a POST request to /json/2/<model>/<method>, with a JSON body containing the IDs of the records concerned (ids), an optional context and the method's parameters. Authentication uses an API key, sent in the Authorization header after bearer. The X-Odoo-Database header names the database to use when the server hosts several.

Odoo's documentation schedules the removal of XML-RPC and JSON-RPC in Odoo 22 (fall 2028), and as early as Odoo Online 21.1 (winter 2027). It provides a migration guide from the legacy services to JSON-2. On Odoo 19 or later, a new integration should therefore start directly on JSON-2, and an existing one should plan its migration.

What About a REST API?

If your project calls for a REST API, start by looking at what your version of Odoo offers. Modules developed by the Odoo community or by partners can also expose a REST API on top of the existing methods. They add one more component to maintain at every version upgrade.

Your Odoo Version Changes Everything

An integration written for one version of Odoo is not guaranteed to work on the next. If you are preparing a move to a more recent version of Odoo, list your existing integrations and check each one before the cutover: it is a point to scope in any Odoo migration. Still unsure about the scope of your ERP? Start from our Odoo agency and ERP integration page.

Is the Odoo API Available on Every Plan?

No. According to Odoo's documentation, access to data through the external API is only available on Custom plans, and is not available on One App Free or Standard plans. Before budgeting an integration, check your plan with Odoo.

A few limits to know, again according to the documentation:

  • The user's rights apply. Every operation is validated against the access rights, record rules and field accesses of the user who holds the key.
  • API keys are short-lived. Keys cannot last more than three months: plan their renewal in your operations.
  • Keys generated programmatically are capped. By default, a user can generate up to 10.

For your hosting mode (Odoo Online, Odoo.sh or your own server), the documentation for your version remains the reference: we check it with you during scoping.

Why Use the Odoo API? Key Benefits

Bringing the Odoo API into your digital strategy offers several benefits:

  • Task automation: Eliminate repetitive manual entry between Odoo and other systems (for example, automatic order creation from an e-commerce site).
  • Seamless integration: Connect Odoo to your preferred tools (external CRM, marketing platform, BI tools, etc.) for a unified view of your operations.
  • Data centralization: Keep your critical information (customers, products, inventory) consistent and up to date in real time across all platforms.
  • Advanced customization: Develop custom features or specific applications that interact directly with your Odoo data.
  • Greater efficiency: Optimize your workflows and reduce errors by getting your systems to communicate smoothly.

Getting Started with the Odoo API: A Practical Guide

Getting started with the Odoo API takes a few prerequisites and an understanding of some key concepts:

Prerequisites

You will need administrator or technical access to your Odoo instance and basic knowledge of a programming language that can make HTTP requests (Python, PHP, JavaScript, Java, etc.).

Authentication

The first step is to authenticate securely. Odoo offers several methods, the most common being:

  • Login / password: Using the credentials of an Odoo user dedicated to the API.
  • API keys: A more secure and recommended method, where a unique key is generated for the external application. With the JSON-2 API, login and password are replaced by an API key.

Common Operations (CRUD)

Once authenticated, you interact with Odoo 'models' (the equivalent of database tables, such as res.partner for contacts, sale.order for orders and product.product for products) through specific methods:

  • search_read: Search and read records based on specific criteria.
  • create: Create new records in a model.
  • write: Update existing records.
  • unlink: Delete records.

A Few Tips

  • Security first: Use API keys, limit the API user's rights to what is strictly necessary and use HTTPS.
  • Error handling: Implement robust logic to handle connection or processing errors returned by the API.
  • Documentation: Always refer to the official Odoo documentation for details on models and methods.
  • Testing: Test your integrations thoroughly in a development or staging environment before going live.

Practical Use Cases for the Odoo API

The Odoo API opens up many possibilities. Here are a few practical examples:

  • HubSpot connection: Sync companies, contacts and deals between HubSpot and Odoo, so sales and operations read the same customer data. Watch out for one thing: decide which tool is the source of truth for each field, to avoid duplicates.
  • Pennylane connection: Move invoices and customer information between Odoo and Pennylane, to cut re-keying between operations and accounting.
  • E-commerce sync: Automatically update orders, customers and stock levels between Odoo and your online store (PrestaShop, Shopify, WooCommerce...).
  • External CRM connection: Sync contacts, leads and opportunities between Odoo CRM and another CRM used by your sales team.
  • Accounting automation: Integrate Odoo with payment platforms or banking software to automate reconciliation.
  • Custom reporting: Extract specific data from Odoo to analyze it in external Business Intelligence tools (Power BI, Tableau...).
  • Custom mobile app: Build a mobile app for your employees or customers that interacts with Odoo data in real time (for example, order tracking or leave approval).

For a common case, see also how to connect Odoo to Shopify.

Market Connector or Custom Integration?

Our recommendation, depending on the situation:

  • A market connector is enough when the need is standard: same fields on both sides, one sync direction, few business rules. It is quicker to set up. Check that the vendor keeps up with Odoo version upgrades and that it is not built on XML-RPC or JSON-RPC, whose removal is announced.
  • A custom integration is justified when your rules are specific (deduplication, calculations, rights per team), when data flows both ways or between more than two tools, or when a sync error is costly (invoicing, stock).
  • In both cases, count the maintenance: API keys to renew, Odoo version upgrades, changes in the connected tool.

To choose, list your flows (which data, in which direction, how often): if a connector covers them all without workarounds, take it; otherwise, build on JSON-2 if your version is 19 or later.

Planning an Odoo integration project? Let's talk

Ready to get the most from the Odoo API? API integration may seem complex, but it is exactly turnK's core business: we design, integrate and operate Odoo ERPs connected to your CRM, your e-commerce and your business tools, from the initial audit to go-live.

the most common questions

What is the Odoo API?

It is the entry point that lets an external application read and write in Odoo (contacts, orders, invoices, products) without going through the interface. It relies on the same access rights as the user who calls it.

Which programming languages can you use with the Odoo API?

You can use practically any language that can make HTTP requests and handle XML or JSON, such as Python, PHP, Java, JavaScript (Node.js), Ruby or C#. Python is often preferred because Odoo itself is written in Python.

Is the Odoo API free?

Not necessarily. Odoo's documentation states that access to data through the external API is only available on Custom plans, not on One App Free or Standard plans. The cost of an integration then comes from its development, its maintenance and, where relevant, third-party modules. Check your plan with Odoo before starting a project.

How do you find Odoo model and field names for the API?

Enable developer mode in Odoo. Then, when you hover over fields in the user interface, a tooltip shows the technical name of the model (`object`) and the field (`field`). The Odoo documentation and introspection through the API are also key resources.

What is the main difference between XML-RPC and JSON-RPC for Odoo?

The main difference is the data format: XML for XML-RPC and JSON for JSON-RPC. JSON is generally lighter and easier to handle with modern web technologies. Before choosing, check the official Odoo documentation to see what applies to your version.

Should you use a market connector or a custom integration?

A market connector fits standard needs: same fields, one sync direction, few business rules. A custom integration is justified when your rules are specific (deduplication, calculations, rights) or when data must stay consistent across several tools. In both cases, check that the connector keeps up with Odoo versions.

Is it safe to use the Odoo API?

Yes, if you follow best practices. Use HTTPS to encrypt communication, prefer API key authentication over passwords, and set up an Odoo user dedicated to the API, with access rights strictly limited to the models and operations it needs.

A project involving your data?

CRM, ERP, data or AI: we'll look at your case with you, with no commitment.

Let's talk about your project