Skip to main content

External API

Odoo is usually extended internally via modules, but many of its features and all of its data are also available from the outside for external analysis or integration with various tools. Part of the Models API is easily available over XML-RPC_ and accessible from a variety of languages.

Starting with PHP8, the XML-RPC extension may not be available by default. Check out the manual for the installation steps.

Connection

Configuration

If you already have an Odoo server installed, you can just use its parameters.

Python

url = <insert server URL>
db = <insert database name>
username = 'admin'
password = <insert password for your admin user (default: admin)>

Ruby

url = <insert server URL>
db = <insert database name>
username = "admin"
password = <insert password for your admin user (default: admin)>

PHP

$url = <insert server URL>;
$db = <insert database name>;
$username = "admin";
$password = <insert password for your admin user (default: admin)>;

Java

final String url = <insert server URL>,
db = <insert database name>,
username = "admin",
password = <insert password for your admin user (default: admin)>;

Go

var (
url = <insert server URL>
db = <insert database name>
username = "admin"
password = <insert password for your admin user (default: admin)>
)

API Keys

Odoo has support for api keys and (depending on modules or settings) may require these keys to perform webservice operations.

The way to use API Keys in your scripts is to simply replace your password by the key. The login remains in-use. You should store the API Key as carefully as the password as they essentially provide the same access to your user account (although they can not be used to log-in via the interface). Alt text In order to add a key to your account, simply go to your Preferences (or My Profile), then open the Account Security tab, and click New API Key.

Input a description for the key, this description should be as clear and complete as possible: it is the only way you will have to identify your keys later and know whether you should remove them or keep them around.

Click Generate Key, then copy the key provided. Store this key carefully: it is equivalent to your password, and just like your password the system will not be able to retrieve or show the key again later on. If you lose this key, you will have to create a new one (and probably delete the one you lost).

Once you have keys configured on your account, they will appear above the New API Key button, and you will be able to delete them:

A deleted API key can not be undeleted or re-set. You will have to generate a new key and update all the places where you used the old one.