SaaS DiaryA solo developer's diary of building and running software

Home › Tech log

Tech log

Read-only Odoo API key for ChatGPT, Claude or an MCP server (Odoo 20)

What a key can do by default, what access rights cannot express, and the write values that silently delete lines

Published Author GRAMSHIFT4 min read

Contents
  1. What a key can do by default
  2. The free way: a dedicated user
  3. Why a read-only key has to check every write
  4. Per-key rules as a module
  5. Frequently asked questions

Odoo 20 has no read-only API key. A key can do everything its user can do, through any public method. Here is what that means when you hand a key to ChatGPT, Claude, an MCP server or an n8n flow, based on tests on a local Odoo 20 Community database on 2026-10-09.

  • A key has no permissions of its own. In Odoo 20 Community the only scope offered for a new key is RPC. The scope decides where the key may sign in, not what it may do.
  • The JSON-2 API calls any public method. /json/2/<model>/<method> runs unlink, action_confirm or action_cancel as readily as search_read, within the rights of the key's user.
  • The free way to limit a key is a dedicated user with minimal access rights, as Odoo's documentation recommends. Access rights work per model and per operation: they cannot say "may confirm but not cancel" or "at most 10 records per call".
  • An ordinary update can delete. When an agent edits a sales order, some of the values it may send for the order lines remove lines, with no delete call at all.
  • A truly read-only key must also stop the writes that buttons such as Confirm make behind the scenes.

What a key can do by default

A user creates a key in My Preferences > Security. The key signs in as that user, with all of that user's access rights. In Odoo 20 Community, the scope field of a new key offers a single choice, RPC. Odoo's documentation describes an MCP scope for Odoo's own MCP server, which is not part of Community; we did not test it.

The JSON-2 endpoint looks the method up by name and calls it. On 2026-10-09 one admin key read sales orders with search_read, then confirmed one with:

POST /json/2/sale.order/action_confirm
Authorization: bearer <key>
{"ids": [3]}

The answer was true and the order moved to Sales Order. Nothing in the key said it was meant for reading.

Two smaller facts about keys in Odoo 20: a user who is not an administrator must give a key an expiry date ("The API key must have an expiration date"), and every call to /xmlrpc, /xmlrpc/2 or /jsonrpc logs that these endpoints are "deprecated in Odoo 19 and scheduled for removal in Odoo 22". They still accept keys.

The free way: a dedicated user

Odoo's documentation on the JSON-2 API recommends dedicated bot users for integrations, with the minimum permissions they need. For an AI assistant that only answers questions:

  1. Create a user for the assistant and give it only read access to the models it needs (a group of your own with read rights works).
  2. Create the API key while signed in as that user.
  3. Give the assistant that key, never a password.

Where this stops:

  • Each integration needs its own user; check what an extra user costs on your plan.
  • Groups add up. If one group of the user grants delete on a model, no other group takes it away.
  • A user who may write to orders may also call every button on them. Access rights have no list of allowed methods.
  • Access rights have no limit on how many records one call may change.

Why a read-only key has to check every write

AI agents write JSON, and an ordinary update to a sales order can remove its lines. Buttons such as Confirm also write other records behind the scenes. So a key that should only read has to refuse every write made during its calls, not only the calls whose names sound like writes.

In our tests on 2026-10-09, a read-only key could still search and read records, and all five kinds of writes we tried were refused, including confirming an order.

Per-key rules as a module

We packaged these checks as a module for Odoo 19 and 20, AI API Key Permissions (paid, by GRAMSHIFT, which publishes this site). It adds a rule to each API key: read-only, no deletes, only the methods you list, and a limit on records per call. Its page lists exactly what each rule covers. A dedicated user for each tool, as above, works well together with it. It is listed for Odoo 20, Odoo 19.

How this was tested: on a local Odoo 20 Community database (Odoo source as of 2026-10-06) with test sales orders, over JSON-2, XML-RPC and JSON-RPC, on 2026-10-09. The order-line results were read back from the database after each call. Statements about Odoo's MCP server and about dedicated bot users come from Odoo's documentation; the MCP server was not tested. This page is not affiliated with Odoo S.A. On the use of AI: the test scripts, the module and this article were written by Claude, an AI model, working for GRAMSHIFT; the results quoted here were compared against the saved outputs of those scripts.

Frequently asked questions

Can I make an Odoo API key read-only?

Not with standard Odoo 20: every key carries all the rights of its user, and the only scope offered in Community is RPC, which says where the key may sign in, not what it may do. The free way is to create the key for a dedicated user that only has read access rights. To make the key itself read-only, a per-key rule is needed: AI API Key Permissions does this, and in our tests on 2026-10-09 reads such as search_read and web_search_read worked with a read-only key while every write we tried, including action_confirm, was refused.

How do I stop an AI agent from deleting records in Odoo?

Give the agent a key whose user has no delete right on the models it uses. If the user may delete order lines, as most sales users may in order to edit quotations, an ordinary update from the agent can still remove lines. A no-delete rule on the key, such as the one in AI API Key Permissions, refuses every delete made during the agent's calls, including deletes inside an update or a button.

Does an MCP server limit what an Odoo API key can do?

An MCP server that connects with a standard Odoo API key can do whatever the key's user can do, unless the server itself restricts its tools. According to Odoo's documentation, Odoo's own MCP server uses a key with the MCP scope and the permissions of its user, and the tools it offers are set per database; we did not test it. Check what your MCP server exposes, and give it a key of a user with minimal rights.

Is AI API Key Permissions available for Odoo 19?

Yes. AI API Key Permissions is listed separately for Odoo 20 and Odoo 19 on the Odoo Apps Store, with the same per-key rules: read-only, no deletes, allowed methods and a limit on records per call.

Related articles

Tech logMake AI agent changes in Odoo wait for approval (ChatGPT, Claude, MCP, n8n, Odoo 20)Odoo 20 has no approval step for API calls outside purchases: JSON-2, XML-RPC and JSON-RPC run the method as soon as the key is checked, and confirming an order or posting an invoice needs no more than ordinary Sales or Billing rights. What standard Odoo offers, free ways to limit an AI agent, and how to make its changes wait for a person. Tech logWhen was an Odoo API key last used? Find unused keys and limit API calls (Odoo 20)An Odoo 20 API key stores its description, user, scope, creation date and expiration date, and nothing about its use. Latest Login on the user changes only for some clients, the server log does not name the key, and Odoo has no limit on calls per key. What each source shows, free ways to keep keys under control, and how to see the last call, IP address and daily calls of every key. Tech logHow to see what ChatGPT, Claude or an MCP server changed in Odoo (Odoo 20)Standard Odoo 20 keeps three traces of an API change: the Last Updated by field, chatter tracking on tracked fields, and one line per call in the server log. None of them names the API key, and deleting a record also deletes its chatter. What each trace shows, a free setup that makes them more useful, and how to keep the previous values of the changes an AI agent makes. Tech logSeparate inventory adjustment gains and losses in Odoo 19 and 20 (Stock Valuation Account Incoming and Outgoing are gone)Odoo 19 and 20 have one Loss Account on the Inventory adjustment location, so counts that find stock and counts that lose stock both post there and the profit and loss shows only the net. What changed from Odoo 18, the debit and credit of each case, the manual workaround, and a Gain Account next to the Loss Account. Tech logKPI dashboard for Odoo Community 20: shared dashboards from any list or pivot, where each user sees only their own numbersOn Odoo 20 Community you can view ready-made dashboards but not build your own or share one with your team. An add-on turns any list, pivot or graph into a number card or chart from the gear menu, and counts every card with the viewer's own access rights, so salespeople see only their own totals. Tech logAI assistant for Odoo Community: ask your Odoo data in plain English with your own OpenAI, Claude or Gemini key (Odoo 20)Odoo 20 Community has no AI assistant that answers questions about your records. To ask "What were confirmed sales per month this year?" inside Odoo, you need an add-on that uses your own OpenAI, Claude, Gemini or Ollama key. What to check first: read-only, the asking user's rights, no SQL, and answers you can open in Odoo.
All English articles