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

ECOSIRE Team

March 5, 20264 min read891 Words

Odoo API Integration Guide: Connect Odoo to Any System

Odoo rarely operates in isolation. Businesses need it connected to eCommerce platforms, payment processors, shipping carriers, marketing tools, and custom applications. The Odoo External API provides two protocols — XML-RPC and JSON-RPC — that enable any system to read, create, update, and delete records in Odoo programmatically.

Authentication

API Key Authentication

Generate an API key in Odoo: navigate to your user profile, then Account Security, then API Keys. Create a key with a descriptive label. Use this key instead of your password for API authentication — it can be revoked independently without changing your login credentials.

Connection Parameters

Every API call requires: the Odoo server URL, the database name, your username (login email), and the API key. Store these securely — never hardcode credentials in source code.

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.

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.

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

JSON-RPC Protocol

Why JSON-RPC

JSON-RPC is generally preferred for modern integrations: it uses JSON (more developer-friendly than XML), works better with JavaScript/TypeScript applications, and offers slightly better performance for large payloads.

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.

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

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

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

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. Handle rate limits — batch operations instead of individual calls
  5. Use idempotent operations to safely retry failed calls

Performance Optimization

  • Batch reads: Use search_read instead of separate search + read calls
  • Limit fields: Request only the fields you need, not all fields on the model
  • Pagination: Use limit and offset for large result sets
  • Caching: Cache slowly-changing data (product catalogs, currency rates) locally

Webhook Patterns

Odoo does not have native outbound webhooks in all versions. 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)

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

Which protocol should I use — XML-RPC or JSON-RPC?

JSON-RPC for new projects. It is more developer-friendly, works better with modern tools, and is the direction Odoo is heading. XML-RPC for legacy systems or languages with better XML-RPC library support.

Is there a REST API?

Odoo 17+ includes a REST API alongside the RPC endpoints. It follows standard REST conventions with JSON payloads and is generally easier to work with for web applications.

How do I handle large data migrations?

For initial data loads, use the CSV import feature or write a migration script that creates records in batches (100-500 records per batch) with error handling for each batch.

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.

E

Written by

ECOSIRE Research and Development Team

Building enterprise-grade digital products at ECOSIRE. Sharing insights on Odoo integrations, e-commerce automation, and AI-powered business solutions.

Chat on WhatsApp