Advanced REST API: JSON CRUD, OpenAPI Swagger Docs, API Keys, OAuth2, Webhooks with HMAC
by Viyug Infotech https://viyuginfotech.com$ 86.56

A secure REST API for Odoo, configured in minutes
Publish the models you choose as JSON resources with scoped API keys or OAuth2, let integrators explore an interactive documentation page, push changes to other systems with signed webhooks and follow every call in the request log.
REST API OpenAPI / Swagger docs API keys OAuth2 Webhooks Rate limits
Free setup call with every purchase
After you buy, book a free 30-minute online call: we install the app with you and set it up for your company. Questions are answered within 24 hours, Monday to Saturday, at support@viyuginfotech.com or on WhatsApp (QR code at the end of this page).
Before and after
For companies connecting webshops, mobile apps, BI, automation tools (Zapier, Make, n8n) or partners to Odoo.
Before
- Integrators get an all-or-nothing login and call any model through XML-RPC
- Passwords or long-lived tokens copied into scripts, no expiry, no limits
- Polling Odoo every few minutes to find out what changed
- No trace of who called what when an integration breaks
After
- Each partner gets a key for the resources, fields and operations you chose
- Hashed, expiring keys or short-lived OAuth2 tokens, rate limits and IP allow-lists
- Signed webhooks push creates, updates and deletes the moment they happen
- A request log with bodies, timing and replay, and a request id in every answer
What you get
Any model as a resource
List, read, create (one or a batch), update, delete and upsert any business model, with field selection, JSON domains, simple filters, sorting, paging links and total count.
Scoped, hashed, expiring keys
Keys per user, per resource and per operation, hashed at rest, shown once, with expiry, rotation, revocation, rate limit and IP allow-list.
OAuth2 client credentials
Client ID and secret for server integrations, short-lived tokens, scope narrowing, revocation endpoint and Basic or form client authentication.
Works with Odoo API keys
Users can also call the REST API with the API key from their Odoo preferences, the same key used for XML-RPC and JSON-RPC. Switch it off in the settings.
Security first
Never sudo for data: access rights, record rules, field groups and companies of the key user apply. No session cookies, no passwords in requests, failed-login throttle per IP.
Methods, files and reports
Call allowed public methods on records or on the model, upload and download binary fields and attachments, print published reports as PDF.
Aggregates
Group by up to three fields (dates by day, week, month, quarter or year) with sum, average, minimum, maximum and distinct counts.
OpenAPI 3 and docs page
The specification is generated from your configuration and served with an interactive documentation page by Odoo itself. Import openapi.json into Postman, Insomnia or a code generator.
Webhooks with HMAC
Create, update and delete events with trigger fields, filters, payload fields, signatures, retries with back-off, dead letters, resend and a private-network guard.
Request log and replay
Status, timing, key, IP, redacted bodies, request id in every answer, graph and pivot analysis, one-click replay, retention period.
Retry-safe writes
Idempotency-Key on create returns the first answer to a retried request; upsert finds an existing record by a key field such as a reference.
Multi-company
Keys work in their main company and the other companies you allow; clients pick one with the X-Company-Id header. Keys, clients, webhooks and logs follow company rules.
How it works
Publish resources
Pick models, fields, records and operations.
Hand out keys
API keys or OAuth2 clients scoped to those resources.
Clients call /rest/v1
JSON in and out, documented by the OpenAPI file.
Odoo pushes events
Webhooks deliver signed changes with retries.
Setup in 5 steps
1. Install and open REST API
The menu shows the overview, resources, keys, webhooks and the log.
2. Run Quick Setup
Choose models, access level and the user the key acts as; copy the secret.
3. Refine the resources
Fields, record filter, methods, reports and upsert key per resource.
4. Share the documentation
Send the docs page or openapi.json to the integration developer.
5. Add webhooks
Point events at the other system and give it the signing secret.
Workflow walkthrough
From publishing a resource to a signed webhook arriving at the other system.
Quick setup in one dialog
Pick the models to publish (here contacts and sales orders), the access level and the Odoo user the key acts as. Each model becomes a resource with suggested response fields; nothing is exposed that you did not choose.

The secret is shown once
The key is stored only as a SHA-256 hash. Copy the secret and the ready-to-run curl command now; a lost secret is rotated, never displayed again.

Resources: fields, records and operations
A resource maps one model to /rest/v1/<path>. Choose the fields clients may read and write, the fields returned by default, a record filter (for example only companies), list/create/update/delete, attachments and an upsert key. Passwords, tokens and secrets are never exposed, whatever you select.

Business methods and PDF reports
Allow public methods such as action_confirm or action_post, and printable reports. Clients confirm an order with POST /sales-orders/<id>/call/action_confirm and download the quotation PDF from /report/<name>.

API keys scoped per resource and operation
Each key acts as one Odoo user and reaches only the listed resources with at most the ticked operations. Expiry date, rate limit per minute, IP allow-list, other companies, usage counter and rotate or revoke in one click.

OAuth2 client credentials
For server-to-server integrations: a client ID and a hashed secret exchanged at /rest/v1/oauth/token for short-lived bearer tokens, optionally narrowed with scope. Rate limit and IP allow-list apply to all tokens of the client; revoke all tokens at once.

Documentation page served by Odoo
An interactive documentation page generated from the live OpenAPI 3 file: authentication, filters, paging, idempotency, errors and webhook verification code. It loads nothing from external sites.

Try requests from the documentation
Paste a key, fill fields, domain, order or limit and send the request. The answer shows status, time, total count, remaining rate limit and request id, with curl, Python and JavaScript snippets for the same call.

From any client: list, filter, create
A real exchange: list companies with selected fields, a JSON domain and paging links, then create a contact with an Idempotency-Key. The retry with the same key returns the first answer instead of creating a duplicate.

Token, method call and PDF in three calls
Get an OAuth2 token, confirm a quotation through its business method, read the order back and download its PDF. Every step runs with the access rights of the key user.

Outgoing webhooks on create, update and delete
Pick the model, the events, the fields that trigger an update, a record filter and the payload fields. Here the warehouse is told about confirmed orders only. Extra headers, timeout and attempts per webhook.

Signed deliveries on the receiving side
Each delivery carries the event, a delivery id and an HMAC-SHA256 signature over the time stamp and the raw body. The receiver verifies it with the shared secret in a few lines of code, shown in the documentation.

Retries, dead letters and resend
Deliveries are queued in the same transaction as the change, sent by a background job and retried after 1 minute, 5 minutes, 30 minutes, 2, 6 and 12 hours. Failures end as dead letters you can retry or resend.

Request log with replay
Every call is logged with status, duration, key, user, resource, IP and the request and response bodies (secrets masked). Administrators replay a call with the same key to reproduce an integration problem.

Overview of every resource
Requests, errors and average response time per resource for the last seven days, with graph and pivot views of the traffic in the Monitoring menu.

Compared with typical alternatives
| Feature | This app | Typical alternatives |
|---|---|---|
| Fields, record filter and operations chosen per resource | Yes | Whole models exposed, per-model switches |
| Keys hashed, shown once, expiring, scoped per resource and operation | Yes | Plain tokens, model-level rights |
| OAuth2 client credentials with scoped short-lived tokens | Yes | Missing, or extra Python libraries needed |
| Accepts the Odoo API keys users already have | Yes | Separate credentials only |
| Rate limit per key with standard headers, failed-login throttle | Yes | One global limit or none |
| IP allow-list per key and client | Yes | Rarely available |
| Idempotency-Key on create, upsert and batch create | Yes | Duplicates on network retries |
| Aggregates, files, attachments and PDF reports | Yes | Partly, often separate endpoints to code |
| OpenAPI 3 file and docs page without external CDN | Yes | Docs loaded from a public CDN or a code generator site |
| Webhooks with HMAC signature, retries, dead letters and resend | Yes | A separate paid module, or none |
| Request log with masked bodies and replay | Yes | Log only, or nothing |
| Quick setup wizard with a ready curl command | Yes | Configuration by hand |
Questions
Does it replace the API that comes with Odoo?
No. It runs next to XML-RPC and JSON-RPC and adds what those do not: resource-level field and record control, scoped keys, OAuth2, rate limits, documentation, webhooks and a request log. Users can keep using their Odoo API keys with this API too.
Can a key read more than its user?
No. Requests run as the key user with their access rights, record rules, field groups and companies. The resource and the key can only narrow that further.
Are passwords or tokens ever returned?
No. Fields whose names hold passwords, tokens, secrets or API keys are refused in the configuration and filtered from answers, filters, sorting and webhook payloads.
How do I call it on a server with several databases?
Set dbfilter so that the host name selects one database, as on Odoo.sh. The address is shown in the settings.
Does it work behind nginx or a load balancer?
Yes. Run Odoo with proxy_mode so that the real client address is used for IP allow-lists, throttling and the log.
Can webhooks call services inside my network?
Only if you allow private network targets in the settings. It is off by default to prevent server-side request forgery.
Can browser applications call it?
Yes, list the allowed origins in the CORS setting. Keys travel in the Authorization or X-API-Key header, never in a cookie.
How do I import it into Postman or generate a client?
Import /rest/v1/openapi.json. Postman, Insomnia and OpenAPI code generators read it directly.
What do clients see when something is wrong?
A JSON error with status, code, message and request id, and the matching HTTP status: 400, 401, 403, 404, 409, 422 or 429 with Retry-After.
Who can configure it?
REST API administrators publish resources, clients and webhooks and read the full log. REST API users manage their own keys and see the log of their keys.
Need a hand?
Questions about connecting a system to Odoo, keys, OAuth2 or webhooks? Write to us and Viyug Infotech will get back to you.
Email support: support@viyuginfotech.com
Website: viyuginfotech.com
Scan with your phone to chat on WhatsApp or write us an email:

+91 83207 42187

Send us an email
Release notes
Initial release
- Resources with field, record and operation control; batch create, upsert, aggregates, methods, files, attachments and reports
- API keys, OAuth2 client credentials and Odoo API keys; rate limits, IP allow-lists, failed-login throttle
- OpenAPI 3 file and interactive documentation page served by Odoo
- Webhooks with HMAC signatures, retries, dead letters and resend; request log with replay
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 4068 |
| Technical Name |
viyug_rest_api |
| License | OPL-1 |
| Website | https://viyuginfotech.com |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module