In today’s fast-paced digital world, businesses use different tools and software to manage their operations. But when these tools cannot talk to each other, things get messy. That’s where Odoo API comes in.
Odoo is a powerful and flexible ERP software used by companies to manage their business activities like sales, inventory, HR, accounting, and more. One of the best things about Odoo is that it can be integrated with other applications using Odoo API.
In this blog, we will explain everything you need to know about how to use Odoo API for external integrations in simple and easy English.

What is Odoo API?
An API (Application Programming Interface) allows two software applications to communicate with each other. In simple terms, it’s like a waiter in a restaurant who takes your order (request) to the kitchen (server) and brings back your food (response).
The Odoo API helps you connect Odoo with other systems like websites, mobile apps, eCommerce platforms, CRMs, third-party tools, etc. So, if you want to integrate Odoo with any external system, you can use the Odoo API.
There are mainly two types of APIs available in Odoo:
- XML-RPC API
- JSON-RPC API
Both APIs offer similar features, but JSON-RPC is more modern and preferred for web applications.
XML-RPC vs JSON-RPC: Which Should You Use?
Odoo gives you two ways to talk to it from outside: XML-RPC and JSON-RPC. Both reach the same data and do the same job - the difference is in the format and the use case.
XML-RPC is the older, most widely supported method. It's built into Python (xmlrpc.client), so there's nothing extra to install, and it works reliably across almost every Odoo version. Most Python-based backend integrations still default to XML-RPC because of this simplicity.
JSON-RPC communicates using JSON instead of XML, which makes it lighter and easier to work with from web browsers, JavaScript, and mobile apps. If you're building a web or mobile-first integration, JSON-RPC usually feels more natural.
| Feature | XML-RPC | JSON-RPC |
|---|---|---|
| Data format | XML | JSON |
| Best for | Python scripts, server-to-server jobs | Web apps, JavaScript, mobile apps |
| Setup | Built into Python (xmlrpc.client) |
Needs a JSON/HTTP request library |
| Readability | Verbose | Lightweight |
| Version support | Very broad, works on old Odoo versions too | Broad, standard on modern versions |
| Future direction | Being phased out in favor of the JSON-2 API | Being phased out in favor of the JSON-2 API |
Which One Should You Choose?
If you're maintaining an existing Python-based Odoo integration, XML-RPC can still be practical where it is supported. Its built-in Python support makes it straightforward for existing server-side integrations.
If your application already communicates through JSON and HTTP, JSON-RPC may fit naturally into the existing architecture.
However, if you're starting a new Odoo integration, check your Odoo version and evaluate the JSON-2 API before choosing XML-RPC or JSON-RPC. Odoo introduced JSON-2 in version 19 and positions it as the replacement for the older RPC APIs
Why Use Odoo API for External Integration?

- To sync data between Odoo and other software.
- To automate business processes.
- To reduce manual data entry.
- To connect Odoo with mobile apps or eCommerce stores.
- To improve productivity and accuracy.
Using Odoo API, you can create, read, update, or delete records in Odoo from an external application.
Real-Life Examples of Odoo API Integration

- Shopify/Magento Integration: Connecting Odoo with Magento or Shopify can help synchronize products, customers, inventory, and orders between the systems. For example, when a customer places an order on an eCommerce platform, the integration can send the order and customer details to Odoo for further processing. Businesses can build a customized Odoo eCommerce integration based on their specific sales, inventory, and order-management workflows.
- CRM Lead Synchronization: Connecting Odoo with an external website, lead-generation platform, or marketing system can automatically send new leads to Odoo CRM. Customer details and relevant fields can also be synchronized between systems, reducing manual data entry and helping sales teams manage leads from a centralized platform. Businesses with more advanced requirements can explore Odoo CRM software solutions tailored to their workflows.
- Integrating Odoo with WhatsApp API for sending messages to customers.
- Connecting Odoo with a mobile app to manage sales or inventory.
- Sending Odoo invoices to Google Sheets using API.
- Integrating Odoo with a biometric attendance system.
Prerequisites to Use Odoo API
- Odoo Instance: Self-hosted or Odoo.sh or Odoo Online.
- Odoo Access: You need your Odoo database URL, user email, password, and database name.
- Knowledge of Programming: Python is commonly used, but you can also use other languages.
- API Library: For example,
xmlrpc.clientin Python orrequestsfor JSON-RPC.
How to Connect to Odoo API Using Python (Step-by-Step)

We will use the XML-RPC API for this example.
Step 1: Import Required Libraries
import xmlrpc.client
Step 2: Define Connection Variables
url = "https://your-odoo-instance.com"
db = "your-database-name"
username = "your-email@example.com"
password = "your-password"
Step 3: Authenticate the User
common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common")
uid = common.authenticate(db, username, password, {})
Step 4: Access the Object Endpoint
models = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/object")
Step 5: Read Data from Odoo (Example: Fetch Customers)
customers = models.execute_kw(db, uid, password,
'res.partner', 'search_read',
[[['customer', '=', True]]],
{'fields': ['name', 'email']})
for customer in customers:
print(customer['name'], customer['email'])
That’s it! You have successfully connected to Odoo using API and fetched customer data.
What You Can Do with Odoo API?
1. Create a Record
You can create a new customer, product, order, or any other record.
customer_id = models.execute_kw(db, uid, password, 'res.partner', 'create', [{
'name': "John Doe",
'email': "john@example.com",
'customer_rank': 1,
}])
2. Read Records
Fetch specific records with filters.
orders = models.execute_kw(db, uid, password,
'sale.order', 'search_read',
[[['state', '=', 'sale']]],
{'fields': ['name', 'amount_total']})
3. Update a Record
models.execute_kw(db, uid, password, 'res.partner', 'write', [[customer_id], {
'email': "john.doe@example.com"
}])
4. Delete a Record
models.execute_kw(db, uid, password, 'res.partner', 'unlink', [[customer_id]])
Using JSON-RPC for Web Integration
JSON-RPC is another way to connect with Odoo using HTTP requests. It’s commonly used in web apps or JavaScript-based systems.
import requests
import json
url = "https://your-odoo-instance.com/jsonrpc"
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"method": "call",
"params": {
"service": "common",
"method": "login",
"args": ["your-database-name", "user@example.com", "password"]
},
"id": 1,
}
response = requests.post(url, data=json.dumps(data), headers=headers)
print(response.json())
Once you're authenticated, you can call the same models and methods as XML-RPC — just formatted as JSON. Here's how you'd fetch customer records:
data = {
"jsonrpc": "2.0",
"method": "call",
"params": {
"service": "object",
"method": "execute_kw",
"args": [db, uid, password, "res.partner", "search_read",
[[["customer_rank", ">", 0]]],
{"fields": ["name", "email"]}]
},
"id": 2,
}
response = requests.post(url + "/jsonrpc", data=json.dumps(data), headers=headers)
print(response.json())
Handling Errors and Troubleshooting
- Authentication failed /
uidreturnsFalse— usually a wrong database name, username, or password, or the user lacks API access. xmlrpc.client.Fault— Odoo raises this for server-side issues (validation rule, permission, missing field). Read the fault message; it tells you exactly what failed.- Access rights errors — the API user needs the same permissions as they'd need in the Odoo interface itself.
- Timeouts on large pulls — batch large fetches into a few hundred records at a time instead of one massive call.
try:
result = models.execute_kw(db, uid, password, 'res.partner', 'create', [{'name': 'Test'}])
except xmlrpc.client.Fault as e:
print(f"Odoo error: {e.faultString}")
Security Tips While Using Odoo API
- Always use HTTPS to secure your API communication.
- Never expose your API credentials in public code.
- Use access control and proper user roles in Odoo.
- Limit access only to required models and fields.
Benefits of Using Odoo API for External Integration
- Flexibility: Connect Odoo with any external app.
- Automation: Reduce manual effort.
- Real-time sync: Keep systems up to date.
- Scalability: Connect multiple systems as your business grows.
- Custom Workflows: Automate specific business processes.
Frequently Asked Questions
Is XML-RPC or JSON-RPC better for Odoo integration?
Neither is strictly "better" - XML-RPC is simpler to set up in Python and works across almost every Odoo version, while JSON-RPC is lighter and easier to use from web or mobile apps. Choose based on where your integration is running, not which is newer.
Do I need to know Python to use the Odoo API?
No. Python is the most common choice because Odoo's own libraries make it simplest, but the API can be called from any language that supports XML-RPC or JSON-RPC/HTTP requests, including PHP, Java, and JavaScript.
Can I use an API key instead of my Odoo password?
Yes, and it's the recommended approach on Odoo 14 and later. Generate one under Settings → My Profile → Account Security, and use it in place of your password in the same authentication call.
What's the difference between the Odoo API and the newer REST/JSON-2 API?
XML-RPC and JSON-RPC are Odoo's long-standing integration methods and remain fully supported today. Odoo has also introduced newer REST-style APIs in recent versions for teams that prefer standard HTTP conventions. For most existing integrations, XML-RPC/JSON-RPC is still the practical choice; for brand-new projects on the latest Odoo version, check whether the newer API already covers your needs.
Why is my Odoo API authentication returning False?
This almost always means an incorrect database name, username, or password, or that the user account doesn't have API access permissions.
Is the Odoo API free to use?
Using the API itself doesn't cost extra on self-hosted or Odoo.sh instances. On Odoo Online, external API access is tied to your pricing plan, so confirm your plan includes it before building - verify current terms before publishing, as pricing pages change.
How Odiware Can Help You with Odoo API Integration
At Odiware, we are experts in Odoo implementation and custom integration using the Odoo API. Whether you want to connect your Odoo with a website, mobile app, or any third-party system, we can help you with smooth and secure integration.
We also provide complete support and documentation so that your business runs without any technical hiccups.
Conclusion
Odoo API is a powerful way to connect your ERP system with the outside world. Whether you are syncing customer data, automating sales orders, or integrating with a mobile app, the Odoo API makes it all possible.

If you’re planning to integrate Odoo with your existing systems or need help with Odoo implementation, get in touch with Odiware today. We provide professional Odoo services tailored to your business needs.
>