Skip to main content

Odoo API Integration Guide: Connect Odoo to Any System

Technical guide to Odoo API integration — XML-RPC and JSON-RPC protocols, authentication, CRUD operations, field mapping, error handling, webhook patterns, and real-world integration examples.

E
ECOSIRE Research and Development Team
March 5, 2026Updated November 10, 202613 min read2.6k Words

On Odoo 19 and 20, connect other systems through the JSON-2 API: a POST to /json/2/ plus the model and method name, authenticated by an API key sent as a bearer token. XML-RPC and JSON-RPC are deprecated since Odoo 19 and scheduled for removal in Odoo 22, so keep them for Odoo 18 and earlier.

Odoo rarely operates in isolation. Businesses need it connected to eCommerce platforms, payment processors, shipping carriers, marketing tools, and custom applications. Odoo's external API lets any system that can send HTTP requests read, create, update, and delete records in Odoo programmatically.

If you would rather have specialists scope and build the connection, see our Odoo integration services for systems that need more than a script.

Which API your Odoo version uses

Odoo 20 is the latest major version: Odoo dated its Odoo 20 release notes September 2026 (read 2026-11-10). Which external API you build on depends on the version your database runs.

Odoo versionBuild onStatus of XML-RPC and JSON-RPC
19 and 20JSON-2, at /json/2/Deprecated since 19.0. The db service was removed in Odoo 20 (fall 2026); common and object are scheduled for removal in Odoo 22 (fall 2028)
18 and earlierXML-RPC at /xmlrpc/2/ or JSON-RPC at /jsonrpcThe external API these versions offer; JSON-2 starts at 19.0

The dates come from Odoo's JSON-2 API reference, which marks JSON-2 "New in version 19.0" (read 2026-11-10). On Odoo 19, each call to the old endpoints also logs a warning that they are "deprecated in Odoo 19 and scheduled for removal in Odoo 22" (Odoo source code, read 2026-11-10). If you can read your server log, it shows which integrations still use them.

Check your plan before you write code: the same reference states that access to data through the external API is only available on Custom Odoo pricing plans, not on One App Free or Standard (JSON-2 API reference, read 2026-11-10).

Build it yourself, use a ready connector, or hire an integrator

The API call is the easy part. The work is deciding which system owns each record, mapping fields, and recovering when a sync fails halfway.

RouteFits whenCheck first
Build it yourselfData flows one way, touches a few models, and a developer on your team will maintain itYour Odoo plan includes external API access, and you target JSON-2 on Odoo 19 or later
Use a ready connectorThe other system is a common platform and your process matches what the connector doesOdoo's own apps first, then the module's supported Odoo version and edition
Hire an integratorData flows both ways, the flow moves money or reserves stock, several systems are involved, or an RPC integration must move to JSON-2Which system owns each record, and what happens when a call fails

Build it yourself when the integration is small and someone on your team will own it. JSON-2 calls are POST requests with a JSON body, so any language with an HTTP client can make them. Spend your estimate on field mapping, error handling and safe retries, not on the calls.

Use a ready connector when someone already maintains the connection you need. Check Odoo's own apps first: Odoo 20 added Lazada and TikTok marketplace integrations that fetch orders and delivery slips, and a ShipStation integration (Odoo 20 release notes, read 2026-11-10). For other platforms, browse our Odoo app catalogue; each app page shows its availability and delivery option. From any seller, confirm the module supports your Odoo version and edition.

Hire an integrator when the integration must stay correct when something fails. Odoo's JSON-2 reference states that every call runs in its own SQL transaction and that several calls cannot share one. It calls this "especially dangerous when performing operations related to reservations, payments, and such". Its fix is one method that does all the related work, created "in a dedicated module" when none exists (JSON-2 API reference, read 2026-11-10). That is module development. Our Odoo integration service starts with an audit of your tools and data flows, then designs the mappings and sync frequency before building.

Authentication

API Key Authentication

In Odoo 19 and 20, create an API key from Preferences, then Account Security, then New API Key, with a description and a duration. Keys cannot last more than three months, so a long-running integration must rotate its key at least that often (JSON-2 API reference, read 2026-11-10). Use this key instead of your password for API authentication — it can be revoked independently without changing your login credentials. Create it on a dedicated integration user, because the API acts as the key's user.

Connection Parameters

JSON-2 needs the server URL and the API key, sent in the Authorization header as bearer followed by the key. Add an X-Odoo-Database header when one server hosts several databases. JSON-2 uses neither the user ID nor the password (JSON-2 API reference, read 2026-11-10). XML-RPC and JSON-RPC need the server URL, the database name, your login, and the API key in place of the password (External RPC API reference, read 2026-11-10). Store these securely — never hardcode credentials in source code.

JSON-2 API (Odoo 19 and later)

Request Format

Send a POST request to /json/2/<model>/<method>. The model and method go in the URL; the arguments go in a JSON body. All arguments are named, because JSON-2 cannot pass positional arguments. Pass ids for methods that act on existing records, and an optional context, for example a language (JSON-2 API reference, read 2026-11-10).

This example reads confirmed sales orders:

curl -X POST "https://mycompany.example.com/json/2/sale.order/search_read" \
  -H "Authorization: bearer $ODOO_API_KEY" \
  -H "X-Odoo-Database: mycompany" \
  -H "Content-Type: application/json" \
  -d '{"domain": [["state", "=", "sale"]], "fields": ["name", "partner_id", "amount_total"], "limit": 50}'

The models, fields and methods you can call differ from one database to the next. Odoo's documentation says each database lists them on its own /doc page, for example https://mycompany.example.com/doc (JSON-2 API reference, read 2026-11-10).

Responses

A successful call returns status 200 with the method's return value as JSON. A failed call returns a 4xx or 5xx status with a JSON error object. That object holds name (the exception's full Python name), message, arguments, context and debug, which is the traceback (JSON-2 API reference, read 2026-11-10).

Transactions

Each JSON-2 call runs in its own SQL transaction, committed on success and discarded on error. Between two of your calls, other users and processes can change the same records (JSON-2 API reference, read 2026-11-10). When several steps must succeed or fail together, put them in one server-side method, as described in the integrator route above.

XML-RPC Protocol

Connection Setup

XML-RPC uses two endpoints: /xmlrpc/2/common for authentication and /xmlrpc/2/object for data operations. Authenticate first to get a user ID, then use that ID for subsequent calls. Data calls go through the execute_kw function (External RPC API reference, read 2026-11-10). On Odoo 19 and later, use XML-RPC only for integrations you have not yet moved to JSON-2.

CRUD Operations

Search and Read: Query records with domain filters (similar to SQL WHERE clauses). Domains use tuples: [('state', '=', 'sale'), ('amount_total', '>', 1000)] finds confirmed sales orders over $1,000.

Create: Pass a dictionary of field values. The API returns the new record ID. Required fields must be included or the call fails with a validation error.

Write: Update existing records by passing the record IDs and a dictionary of changed values. Only include fields you want to modify. Every record in one write call receives the same values (External RPC API reference, read 2026-11-10).

Unlink: Delete records by ID. Use with caution — some records cannot be deleted if they have dependent records.

JSON-RPC Protocol

Where JSON-RPC Stands

JSON-RPC carries the same API as XML-RPC in a different encoding. Both expose the same three services, common, db and object, and both follow the same deprecation timeline (JSON-2 API reference, read 2026-11-10). JSON-RPC is convenient for JavaScript and TypeScript clients on Odoo 18 and earlier. On Odoo 19 and later, new work belongs on JSON-2.

Request Format

JSON-RPC calls go to a single endpoint: /jsonrpc. Each request includes the service name, method, and arguments in a standard JSON-RPC 2.0 envelope. In Odoo 19 the /jsonrpc route takes service, method and args (Odoo source code, read 2026-11-10). Odoo's JSON-RPC handler accepts parameters by name only, so params must be a JSON object, not an array (Odoo HTTP layer source, read 2026-11-10).

Common Integration Patterns

eCommerce Order Sync

Sync orders from Shopify or WooCommerce to Odoo:

  1. Listen for order webhooks from the eCommerce platform
  2. Map customer data to Odoo partner records (create or match existing)
  3. Create a sale order with line items mapped to Odoo products
  4. Confirm the order to trigger fulfillment workflows
  5. Sync tracking information back to the eCommerce platform

For a Shopify store, our Odoo Shopify integration guide sets out which system should own orders, stock, customers and accounting.

Payment Processor Integration

Connect Stripe, PayPal, or other processors:

  1. Receive payment confirmation webhooks
  2. Match payments to Odoo invoices by reference number
  3. Register the payment in Odoo Accounting
  4. Reconcile with bank statements automatically

Payments are one of the cases Odoo's JSON-2 reference names: if steps 2 and 3 run as separate calls, a failure between them leaves the books half-updated. Run them in one server-side method.

CRM Synchronization

Keep Odoo CRM in sync with external marketing tools:

  1. New leads from marketing platforms create Odoo leads
  2. Lead scoring updates flow bidirectionally
  3. Won opportunities trigger follow-up campaigns in the marketing tool
  4. Contact information stays synchronized across systems

Error Handling

Common Errors

  • Access denied: Invalid credentials or insufficient permissions
  • Validation error: Required fields missing or invalid values
  • Record not found: Referencing an ID that does not exist
  • Concurrent update: Another user modified the record simultaneously

On JSON-2, read the HTTP status first, then the name field of the error object. It carries the exception's full Python name (JSON-2 API reference, read 2026-11-10), so your code can branch on the error type instead of parsing the message text.

Best Practices

  1. Implement retry logic with exponential backoff for transient failures
  2. Validate data before sending to catch errors early
  3. Log all API calls for debugging and audit purposes
  4. Batch where the API allows it — one write call can update many records with the same values (External RPC API reference, read 2026-11-10)
  5. Use idempotent operations to safely retry failed calls. Each JSON-2 call commits on its own, so a create that timed out may have succeeded. Store the other system's ID on the Odoo record and search for it before you create again.

Performance Optimization

  • Batch reads: Use search_read instead of separate search + read calls. It does both in one request (External RPC API reference, read 2026-11-10)
  • Limit fields: Request only the fields you need, not all fields on the model. Without a field list, read returns every field the user can read, which the same reference warns "tends to be a huge amount"
  • Pagination: Use limit and offset for large result sets
  • Caching: Cache slowly-changing data (product catalogs, currency rates) locally
  • Initial data loads: Use the CSV import feature, or a migration script that creates records in batches with error handling for each batch. Our ERP data migration guide covers load order and reconciliation

Webhook Patterns

Native webhooks depend on your version. Odoo's 17.0 documentation describes an "On webhook" trigger for automation rules and a Send Webhook Notification action that sends "a POST request with the values of the Fields to the URL specified in the URL field" (Automation rules, Odoo 17.0, read 2026-11-10). The 16.0 page lists no webhook trigger or action (Automated actions, Odoo 16.0, read 2026-11-10). Common approaches:

  • Automated actions: Server actions that trigger on record changes and call external URLs
  • Custom controllers: Build an Odoo module that exposes webhook endpoints for external systems
  • Polling: External systems poll Odoo at intervals for changes (simpler but less real-time)

Odoo's webhook documentation says an incoming webhook URL "is confidential and should be treated with care", and advises testing a new webhook on a duplicate database first (Webhooks, Odoo 20.0, read 2026-11-10).

Security Considerations

  • Use API keys instead of passwords
  • Restrict API access by IP address at the network level
  • Use HTTPS for all API communication
  • Implement proper access rights — API users should have minimum necessary permissions
  • Rotate API keys regularly and revoke compromised keys immediately

Our Odoo integration service builds production-grade integrations with proper error handling, monitoring, and security.

Frequently Asked Questions

Should I build an Odoo integration myself or hire an integration service?

Build it yourself when data flows one way, touches a few models, and someone on your team will maintain it. Hire an integrator when data flows both ways, moves money or stock, or must leave XML-RPC and JSON-RPC before Odoo 22 removes them (JSON-2 API reference, read 2026-11-10). Money and stock flows may need a server-side method in a custom module, which is Odoo development rather than scripting. Our Odoo integration service scopes that work.

Which protocol should I use: XML-RPC, JSON-RPC or JSON-2?

On Odoo 19 or 20, use JSON-2 for anything new. Odoo's documentation calls it the replacement for XML-RPC and JSON-RPC, which are deprecated and scheduled for removal in Odoo 22 (fall 2028) and Odoo Online 21.1 (winter 2027) (External RPC API reference, read 2026-11-10). On Odoo 18 or earlier, JSON-2 is not available, so use XML-RPC or JSON-RPC and plan the switch into your next upgrade. The two older protocols expose the same services, so choose by the libraries your language has.

Does Odoo have a REST API?

Not in the usual sense of resources and HTTP verbs. The closest is JSON-2, new in Odoo 19.0: every call is a POST to /json/2/ followed by the model and method name, with named arguments in a JSON body and an API key as a bearer token (JSON-2 API reference, read 2026-11-10). Odoo 17 and 18 do not have it; they offer XML-RPC and JSON-RPC.

Can I use the Odoo API for accounting data?

Yes. Accounting models are reached through the same external API as every other app, within the access rights of the API key's user, and on Odoo 19 and later your database's /doc page lists them. Odoo's JSON-2 reference names payments as a case where separate calls are "especially dangerous", so post an invoice and register its payment in one server-side method (JSON-2 API reference, read 2026-11-10).

Can I connect Odoo to a marketplace such as Temu or Home24 through the API?

Yes, if the marketplace gives sellers an API. The connection is a middleware job: read orders from the marketplace, create them in Odoo through the external API, and send stock and tracking back. Odoo ships some marketplace connectors itself, such as the Lazada and TikTok integrations added in Odoo 20 (Odoo 20 release notes, read 2026-11-10). For others, check our Odoo app catalogue and our guide to integrating marketplaces with Odoo.

Can I extend the API with custom endpoints?

Yes. Create custom Odoo modules with controller classes that expose additional HTTP endpoints for specialized operations not covered by the standard API. Odoo states that controllers declared with type='jsonrpc' are not subject to the XML-RPC and JSON-RPC deprecation notice (JSON-2 API reference, read 2026-11-10).

Next step

If a script will not cover it, our Odoo integration service scopes and builds the connection, or contact us with the systems you need Odoo to talk to.

E

Written by

ECOSIRE Research and Development Team

Technical Writing

The ECOSIRE technical writing team covers Odoo ERP, Shopify eCommerce, AI agents, Power BI analytics, GoHighLevel automation, and enterprise software best practices. Our guides help businesses make informed technology decisions.

ECOSIRE

Transform Your Business with Odoo ERP

Expert Odoo implementation, customization, and support to streamline your operations.