Home
Endpoints
- GET Search Records
- GETModel Schema
- GET View Record
- GETRecord Count
- POST Create Record
- POST Execute Method
- POST Generate Token
- PUT Update Record
- DELETE Record
Introduction
The Odoo REST API module enables seamless integration between Odoo and external platforms like mobile apps, websites, or third-party systems. It supports full CRUD operations on Odoo models using token-based authentication for secure access. Admins can generate and manage API keys, configure user authentication, and define fine-grained access rights for specific models or all resources. The module includes advanced features like throttling, key validity, and scoped access control (per model and operation). A dedicated User Authentication tab in the user profile allows generating login tokens for individual APIs. It offers developer-friendly OpenAPI (Swagger UI) and Postman Collection documentation for interactive API testing. All endpoints follow standard REST methods (GET, POST, PUT, DELETE) and respect Odoo's permission system.
REST API in Odoo!
The Odoo REST API module allows secure and flexible integration between Odoo and external platforms such as websites, mobile apps, or third-party tools.
It supports full CRUD operations (Create, Read, Update, Delete) through HTTP methods like GET, POST, PUT, and DELETE. Using API keys and user tokens, it ensures safe access to Odoo resources.
This module provides:
- Token-based authentication
- API key generation and access control
- OpenAPI (Swagger) and Postman Collection documentation
- Easy configuration and developer-friendly design
- Support for both all and specific Odoo models
It's ideal for connecting Odoo with any modern system, offering fine-grained control, secure data access, and real-time integration capabilities.
Purpose of REST API in Odoo
The Odoo REST API is a powerful tool that works independently of the Odoo interface. It enables integration with external applications, supports process customization, and allows for dynamic interaction with Odoo data. Below are some specific purposes of using the Odoo REST API:
- Reduces manual workload and minimizes the risk of human error, increasing operational efficiency.
- Enables fine-grained control over records using different HTTP methods like GET, POST, PUT, and DELETE.
User Authentication for REST API
The module supports user authentication to secure REST API operations in Odoo. User authentication plays a crucial role in identifying who is making the API request, the purpose behind it, and what level of access they are permitted. By introducing a strong validation layer, it ensures that only authorized users can access or manipulate the data through the API. This security mechanism not only protects sensitive business records but also helps in tracking API usage per user, ensuring transparency and accountability. Additionally, it helps prevent unauthorized access, data breaches, and other security risks such as fraud or tampering. In essence, user authentication strengthens the safety and control of REST API interactions within Odoo.
Creating API for All resources along with user authentication
Generate X-Login-Token
Search Request
GET /api/model_name/search
Header
| Key | Value |
|---|---|
| api-key | String |
| Login-Token | String |
Query Parameters
| Key | Value |
|---|---|
| domain | String |
| fields | String |
| limit | Integer |
| offset | Integer |
| order | String |
Response Example
This API allows searching records from a particular model and retrieving specified fields.
Domain filtering:
e.g.,
domain=[('id','in',[13,5,11,12,14])]
Fields selection:
e.g.,
fields=['name','description','product_variant_ids']
JSON Response
[
{
"id": 44,
"my_activity_date_deadline": false,
"message_ids": [
228
],
"has_message": true,
"message_needaction_counter": 0,
"website_message_ids": [],
"message_has_sms_error": false,
"price_extra": 0.0,
"lst_price": 750.0,
"default_code": "DESK0005",
"code": "DESK0005",
"partner_ref": "[DESK0005] Customizable Desk (Custom, White)",
"active": true,
"product_tmpl_id": [
9,
"Customizable Desk"
],
"barcode": false,
"product_template_attribute_value_ids": [
18,
3
],
"product_template_variant_value_ids": [
18,
3
],
"combination_indices": "3,18",
"is_product_variant": true,
"standard_price": 0.0,
"volume": 0.0,
"weight": 0.01,
"pricelist_item_count": 0,
"product_document_ids": [],
"product_document_count": 0,
"packaging_ids": [],
"additional_product_tag_ids": [],
"all_product_tag_ids": [],
"image_variant_1920": false,
"image_variant_1024": false,
"image_variant_512": false,
"image_variant_256": false,
"image_variant_128": false,
"can_image_variant_1024_be_zoomed": false,
....
}
]
Get Schema
GET
/api/{model_name}/schema
Header
| Key | Value |
|---|---|
| api-key | String |
| token | String |
Response Example
Example:
Get schema for table
product.product
Request Type: GET
Endpoint:
/api/product.product/schema
Header:
{"api_key": "xxxxxxxxxxxxxxxxxxx"}
{
"my_activity_date_deadline": {
"company_dependent": false,
"default_export_compatible": false,
"exportable": true,
"groupable": false,
"manual": false,
"name": "my_activity_date_deadline",
"readonly": true,
"required": false,
"searchable": true,
"sortable": false,
"string": "My Activity Deadline",
"type": "date"
},
"message_ids": {
"allow_hierachy_operators": true,
"company_dependent": false,
"context": {},
"default_export_compatible": false,
"domain": [
[
"message_type",
"!=",
"user_notification"
]
],
"exportable": true,
"groupable": false,
"manual": false,
"name": "message_ids",
"readonly": false,
"required": false,
"searchable": true,
"sortable": false,
"string": "Messages",
"type": "one2many"
},
"has_message": {
"company_dependent": false,
"default_export_compatible": false,
"exportable": true,
"groupable": false,
"manual": false,
"name": "has_message",
"readonly": true,
"required": false,
"searchable": true,
"sortable": false,
"string": "Has Message",
"type": "boolean"
},
"message_needaction_counter": {
"company_dependent": false,
"default_export_compatible": false,
"exportable": true,
"groupable": false,
"help": "Number of messages requiring action",
"manual": false,
"name": "message_needaction_counter",
"readonly": true,
"required": false,
"searchable": false,
"sortable": false,
"string": "Number of Actions",
"type": "integer"
},
"website_message_ids": {
"allow_hierachy_operators": true,
"company_dependent": false,
"context": {},
"default_export_compatible": false,
"domain": [
[
"model",
"=",
"product.product"
],
[
"message_type",
"in",
[
"comment",
"email",
"email_outgoing"
]
]
],
"exportable": true,
"groupable": false,
"help": "Website communication history",
"manual": false,
"name": "website_message_ids",
"readonly": false,
"required": false,
"searchable": true,
"sortable": false,
"string": "Website Messages",
"type": "one2many"
},
"message_has_sms_error": {
"company_dependent": false,
"default_export_compatible": false,
"exportable": true,
"groupable": false,
"help": "If checked, some messages have a delivery error.",
"manual": false,
"name": "message_has_sms_error",
"readonly": true,
"required": false,
"searchable": true,
"sortable": false,
"string": "SMS Delivery error",
"type": "boolean"
},
"price_extra": {
"company_dependent": false,
"default_export_compatible": false,
"digits": [
16,
2
],
"exportable": true,
"groupable": false,
"help": "This is the sum of the extra price of all attributes",
"manual": false,
"name": "price_extra",
"readonly": true,
"required": false,
"searchable": false,
"sortable": false,
"string": "Variant Price Extra",
"type": "float"
},
"lst_price": {
"company_dependent": false,
"default_export_compatible": false,
"digits": [
16,
2
],
"exportable": true,
"groupable": false,
"help": "The sale price is managed from the product template. Click on the 'Configure
Variants' button to set the extra attribute prices.",
"manual": false,
"name": "lst_price",
"readonly": false,
"required": false,
"searchable": false,
"sortable": false,
"string": "Sales Price",
"type": "float"
},
....
}
View Record
GET
/api/{model_name}/{record_id}
Header
| Key | Value |
|---|---|
| api-key | String |
| token | String |
Response Example
Example:
Get a record of
sale.order.line
Request Type: GET
Endpoint:
/api/sale.order.line/2
Header:
{"api_key": "xxxxxxxxxxxxxxxxxxx"}
{
"id": 4,
"my_activity_date_deadline": false,
"message_ids": [
284,
101
],
"has_message": true,
"message_needaction_counter": 0,
"website_message_ids": [],
"message_has_sms_error": false,
"price_extra": 0.0,
"lst_price": 38.25,
"default_code": false,
"code": false,
"partner_ref": "Virtual Home Staging",
"active": true,
"product_tmpl_id": [
4,
"Virtual Home Staging"
],
"barcode": false,
"product_template_attribute_value_ids": [],
"product_template_variant_value_ids": [],
"combination_indices": "",
"is_product_variant": true,
"standard_price": 25.5,
"volume": 0.0,
"weight": 0.0,
"pricelist_item_count": 0,
"product_document_ids": [],
"product_document_count": 0,
"packaging_ids": [],
"additional_product_tag_ids": [],
"all_product_tag_ids": [],
"image_variant_1920": false,
"image_variant_1024": false,
"image_variant_512": false,
"image_variant_256": false,
"image_variant_128": false,
"can_image_variant_1024_be_zoomed": false,
"image_1920": false,
"image_1024": false,
"image_512": false,
"image_256": false,
"image_128": false,
"can_image_1024_be_zoomed": false,
"write_date": "2025-07-16T11:51:36.122438",
"display_name": "Virtual Home Staging",
"create_uid": [
1,
"OdooBot"
],
"create_date": "2025-07-16T11:49:53.655615",
"write_uid": [
1,
"OdooBot"
],
"tax_string": "(= $ 43.99 Incl. Taxes)",
"sales_count": 30.0,
"product_catalog_product_is_in_sale_order": false,
"name": "Virtual Home Staging",
"sequence": 1,
"description": false,
"description_purchase": false,
"description_sale": false,
"type": "service",
"combo_ids": [],
"service_tracking": "no",
"categ_id": [
5,
"All / Saleable / Services"
],
"currency_id": [
1,
"USD"
],
"cost_currency_id": [
1,
"USD"
],
"list_price": 38.25,
"volume_uom_name": "m³",
"weight_uom_name": "kg",
"sale_ok": true,
"purchase_ok": true,
"uom_id": [
4,
"Hours"
],
"uom_name": "Hours",
"uom_category_id": [
3,
"Working Time"
],
"uom_po_id": [
4,
"Hours"
],
"company_id": false,
"seller_ids": [],
"variant_seller_ids": [],
"color": 0,
"attribute_line_ids": [],
"valid_product_template_attribute_line_ids": [],
"product_variant_ids": [
4
],
"product_variant_id": [
4,
"Virtual Home Staging"
],
"product_variant_count": 1,
"has_configurable_attributes": false,
"product_tooltip": "Invoice after delivery, based on quantities delivered, not
ordered.",
"is_favorite": false,
"product_tag_ids": [],
"product_properties": [],
"taxes_id": [
1
],
"supplier_taxes_id": [
2
],
"property_account_income_id": false,
"property_account_expense_id": false,
"account_tag_ids": [],
"fiscal_country_codes": "US",
"service_type": "manual",
"sale_line_warn": "no-message",
"sale_line_warn_msg": false,
"expense_policy": "no",
"visible_expense_policy": false,
"invoice_policy": "delivery",
"optional_product_ids": []
}
Record Count
GET
/api/{model_name}/record_count
Header
| Key | Value |
|---|---|
| api-key | String |
| token | String |
Response Example
Example: Get a record of res.partner
Request Type: GET
Endpoint:
/api/res.partner/record_count
Response
{
"model": "res.partner",
"domain": [],
"record_count": 5
}
Create Record
POST
/api/{model_name}/create
Header
| Key | Value |
|---|---|
| api-key | String |
| Token | String |
Body
{
"name": "chheez",
"list_price": 199.99,
"standard_price": 100.00,
"type": "consu"
}
Query Parameters
- model_name: Name of the model (e.g.,
res.partner)
Response Example
Example:
Create a record of
product.template
Request Type: POST
Endpoint:
/api/product.template/create
Header:
{"api_key": "xxxxxxxxxxxxxxxxxxx"}
{
"id": 49,
"message": "Record created successfully."
}
Execute Function Request
POST
/api/{model_name}/execute_kw
Header
| Key | Value |
|---|---|
| api-key | String |
| token | String |
Query Parameters
- model_name: Name of the model (e.g.,
res.partner)
Response Example
Example: Trigger your Odoo actions
Request Type: POST
Endpoint:
/api/res.partner/execute_kw
Header:
{"api_key": "xxxxxxxxxxxxxxxxxxx"}
Body:
{
"method": "search_read",
"args": [
[]
],
"kwargs": {
"fields": [
"id",
"name",
"email"
],
"limit": 10
}
}
Sample Response
[
{
"id": 3,
"name": "Administrator",
"email": "[email protected]"
},
{
"id": 1,
"name": "CandidRoot Solutions",
"email": false
},
{
"id": 11,
"name": "John Doe",
"email": "[email protected]"
},
{
"id": 9,
"name": "New Partner",
"email": "[email protected]"
},
{
"id": 8,
"name": "rajesh",
"email": "[email protected]"
}
]
Generate Token
POST
/api/{model_name}/generate_token
Header
| Key | Value |
|---|---|
| api-key | String |
Request Body
{
"user_id": 11,
"expiration_days": 10
}
Response Example
Example: Generate Login Token
Request Type: POST
Endpoint:
/api/generate_token
Header:
{"api_key": "xxxxxxxxxxxxxxxxxxxx"}
{
"login_token":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImFkbWluIiwid2Vic2VydmljZV9hY2NvdW50X2lkIjoyLCJ3ZWJzZXJ2aWNlX25hbWUiOiJuZXcgUmVzdCBmdWxsIGFwaSIsImlhdCI6MTc1NDM3ODMyMywiZXhwIjoxNzU1MjQyMzIzLCJqdGkiOiI5ZTYzYzQwMy02ZTE0LTRjNjYtYjQ1My1kYjgyY2I1YmZkNzMifQ.nOEjpJXWwYkwhEgJVmL1AgBFrKi7ft-WaXejFqc9fBo",
"message": "JWT Token generated successfully.",
"token_type": "JWT",
"expires_in_days": 10,
"expiration_date": "2025-08-15T07:18:43.743430",
"user_info": {
"user_id": 2,
"user_name": "Administrator",
"user_login": "admin"
}
}
Notes
- Use the returned token in all subsequent API requests for authentication.
- Token validity depends on your server’s expiration configuration.
- The token must be sent in the request header as:
token:
Update Record
PUT
/api/{model_name}/{record_id}
Header
| Key | Value |
|---|---|
| api-key | String |
| token | String |
Request Body
{
"name": "update method",
"list_price": 150.00
}
Response Example
Example:
Update a record of
product.product
Request Type: PUT
Endpoint:
/api/product.product/57
{
"message": "Record updated successfully."
}
Notes
- Provide the exact
record_idin the URL to identify the record you want to update. - Include only the fields you want to update in the request body.
- Ensure your authentication token is passed correctly in the headers.
Delete Record
DELETE
/api/{model_name}/{record_id}
Header
| Key | Value |
|---|---|
| api-key | String |
| token | String |
Response Example
Example:
Delete a record of
product.product
Request Type: DELETE
Endpoint:
/api/product.product/57
{
"message": "Record deleted successfully."
}
Notes
- Provide the exact
record_idin the URL to identify the record you want to Delete. - Ensure your authentication token is passed correctly in the headers.
Postman Collection
Postman Collection Json File : Download
- 1. Select "Import" in Postman
- 2. Choose the Postman collection Json file