Back

Odoo CRM API Essential Guide

Aug 18, 20246 minute read

What type of API does Odoo CRM provide?

API Types Supported

Odoo CRM supports multiple API types:

  • XML-RPC
  • RESTful API
  • GraphQL
  • JSON-RPC

Key Features of the API Framework

  • Supports multiple API specifications including RESTful, GraphQL, and JSON:API
  • Offers various authentication methods like API keys, Basic Auth, Standard User Credentials, and OAuth2
  • Provides dynamic connectivity to Odoo models and fields
  • Allows creation of multiple APIs and endpoints within a single Odoo environment
  • Includes comprehensive documentation and tools like Redoc for API documentation

Practical Applications

The API can be used for various purposes, including:

  • Integrating Odoo with external systems and applications
  • Automating tasks like financial reporting, inventory management, and HR processes
  • Building custom dashboards and mobile applications
  • Enhancing CRM functionalities and customer support
  • Facilitating data-driven decision making by connecting to BI tools

Considerations

  • Access to the external API is only available on Custom Odoo pricing plans, not on One App Free or Standard plans
  • The API Framework is a modular solution, allowing for flexible and customizable API development

Does the Odoo CRM API have webhooks?

The official Odoo CRM API does not natively include webhooks. However, there are third-party modules available that add webhook functionality to Odoo.

One such module is the "Odoo Webhooks" module, which allows you to set up webhooks for various events in Odoo. With this module, you can subscribe to events such as placing an order, changing a product's price, collecting data for data-warehousing, integrating accounting software, and filtering order items and informing shippers about orders.

Webhooks in Odoo can be used to execute code after specific events occur, such as creating a new product, updating stock quantities, or confirming a quotation. The webhook data can be stored as JSON or XML.

Webhooks are particularly useful when dealing with data that isn't easily searchable through the Odoo API, or when you would otherwise need to frequently poll for substantial amounts of data.

The "Odoo Webhooks" module depends on the "Odoo REST API" module, which needs to be installed separately. Webhook functionality can be configured either through the API or through the user panel in Odoo.

It's important to note that while these webhook capabilities are available through third-party modules, they are not part of the core Odoo CRM API. To implement webhooks in your Odoo instance, you would need to install and configure the appropriate modules.

Rate Limits and other limitations

Based on the search results, here are the key points about API rate limits for the Odoo CRM API:

No Explicit Rate Limits Mentioned

The search results do not mention any specific API rate limits for the Odoo CRM API. There is no information provided about maximum request sizes, number of requests allowed per time period, or costs per request.

Performance Limitations

While explicit rate limits are not mentioned, there are some performance limitations noted:

  • The standard Odoo API has difficulty handling large data flows and intensive activity. For example, creating more than 2-3 sales orders per second per worker is challenging even on the latest Enterprise versions.

  • The standard API approach can only accommodate a limited number of concurrent transactions and users without failure.

  • It cannot accept beyond a limited amount of data and is not very scalable.

Advanced API Solutions

To overcome the performance limitations of the standard API, more advanced solutions are suggested:

  1. Advanced API integration - Goes beyond standard ORM features to process more transactions.

  2. High-performance API solution - Uses a split architecture and technologies like multi-threading to handle much higher loads (e.g. 1500 inserts/sec, 10,000 downloads/sec).

Key Considerations

  • The standard API may be sufficient for basic integrations but has limitations for high-volume use cases.

  • More advanced API architectures may be needed for applications with thousands of concurrent users or large data volumes.

  • Proper assessment of volume and speed requirements is important when planning Odoo API integrations.

In summary, while no explicit rate limits are documented, there are practical performance limitations to consider when using the standard Odoo API for high-volume integrations. More advanced API solutions may be needed in those cases.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Odoo CRM API:

Latest Version

The most recent major version of Odoo is version 17.0, which was released in November 2023 [3].

Key Points

  • Odoo releases major versions annually, with version 17.0 being the latest [3].

  • Odoo provides support and bug fixing for the 3 most recent major versions [3].

  • For Odoo Online (SaaS) users, there are intermediary "Online versions" released every two months, with the latest being saas~17.2 released in April 2024 [3].

  • The Online versions (saas~X.X) are only available for Odoo Online hosting, not for Odoo.sh or On-Premise installations [3].

API Access

  • Access to data via the external API is only available on Custom Odoo pricing plans. It is not available on One App Free or Standard plans [2].

  • Part of the Models API is accessible over XML-RPC from various programming languages [2].

Best Practices

  • Odoo Online users are encouraged to upgrade their databases regularly to benefit from the latest features [3].

  • For developers working with the API, it's recommended to refer to the latest documentation, which is available for version 17.0 [2].

In summary, while the most recent major version is Odoo 17.0, Odoo Online users may have access to even more recent features through the saas~17.2 release. For API development, it's best to refer to the documentation for version 17.0, which represents the latest stable major release.

How to get a Odoo CRM developer account and API Keys?

To get a developer account for Odoo CRM and create an API integration, here are the key steps:

  1. Sign up for an Odoo account:
  • Go to odoo.com and sign up for an account if you don't already have one.
  • You'll need a paid plan that includes API access - the free and standard plans do not include external API access.
  1. Enable API access:
  • Log into your Odoo instance as an administrator
  • Go to Settings > Users & Companies > Users
  • Select the user you want to use for API access
  • Click "Action" and select "Change Password"
  • Set a new password for this user - this will be used for API authentication
  1. Get your API credentials:
  • The server URL will be your Odoo instance URL (e.g. https://mycompany.odoo.com)
  • The database name is your instance name (e.g. mycompany)
  • Username is the login of the user you set up
  • Password is the new password you set
  1. Generate an API key (optional but recommended):
  • Go to your user Preferences
  • Open the "Account Security" tab
  • Click "New API Key"
  • Enter a description and generate the key
  • Copy and securely store the key - it will only be shown once
  1. Use the credentials to authenticate API requests:
  • Use the URL, database, username, and password/API key in your API requests
  • API requests are made via XML-RPC or JSON-RPC
  1. Review the API documentation:
  • Check the Odoo documentation for details on available endpoints and methods
  • The External API section has examples for different programming languages

What can you do with the Odoo CRM API?

Here's a breakdown of the data models you can interact with using the Odoo CRM API, along with what is possible for each data model:

CRM Lead/Opportunity Model (crm.lead)

  • Create, read, update, and delete leads and opportunities
  • Convert leads to opportunities
  • Mark opportunities as won or lost
  • Assign leads/opportunities to salespeople
  • Update stage of leads/opportunities in the pipeline
  • Add notes and activities to leads/opportunities
  • Attach documents to leads/opportunities

CRM Stage Model (crm.stage)

  • Create, read, update, and delete pipeline stages
  • Configure stage properties like probability and requirements

CRM Team Model (crm.team)

  • Create, read, update, and delete sales teams
  • Assign members to sales teams
  • Set team targets and quotas

CRM Tag Model (crm.tag)

  • Create, read, update, and delete tags for leads/opportunities
  • Assign tags to leads/opportunities

CRM Activity Model (mail.activity)

  • Schedule activities for leads/opportunities
  • Mark activities as done
  • Reschedule activities

Partner Model (res.partner)

  • Create, read, update, and delete customer/prospect records
  • Associate partners with leads/opportunities

User Model (res.users)

  • Assign salespeople to leads/opportunities
  • Manage user permissions for CRM access

Product Model (product.template)

  • Associate products with opportunities
  • Manage product catalog

Currency Model (res.currency)

  • Set currency for opportunity expected revenue

Company Model (res.company)

  • Manage multi-company CRM settings

Mail Thread Model (mail.thread)

  • Send messages related to leads/opportunities
  • Track changes on lead/opportunity records

Key points to consider:

  • The main model for CRM operations is crm.lead, which represents both leads and opportunities.
  • Many models are related, allowing you to link data across the CRM system.
  • Access to these models via the API depends on user permissions and security settings.
  • The API allows for complex operations like converting leads to opportunities or progressing deals through pipeline stages.

When interacting with these models via the API, you'll typically use methods like create(), read(), write(), and unlink() to perform CRUD operations, as well as specialized methods for CRM-specific actions.