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

Home › Tech log

Tech log

When was an Odoo API key last used? Find unused keys and limit API calls (Odoo 20)

What Odoo stores about a key, what Latest Login and the server log can tell you, and how to cap the calls of an AI agent

Published Author GRAMSHIFT5 min read

Contents
  1. What Odoo stores about an API key
  2. Latest Login: only some clients update it
  3. The server log: calls, but not keys
  4. Free ways to keep keys under control
  5. Limiting how many calls a key can make
  6. What each option gives you
  7. Last use, IP and calls of every key, with a limit per key
  8. Frequently asked questions

Odoo 20 does not record when an API key was last used. A key stores its description, its user, its scope, its creation date and its expiration date, and nothing about its use: no last call, no IP address, no number of calls. Odoo also has no limit on how many calls a key may make. Below: what you can still find out with standard Odoo, free ways to keep keys under control, and how to see the use of every key, checked against the Odoo 20 source.

  • The key record (res.users.apikeys) has a description, a user, a scope, a creation date and an expiration date. There is no "last used" field.
  • Latest Login, a column of the Users list, changes when someone logs in to the web client, and when an XML-RPC or JSON-RPC script calls authenticate. It does not change for JSON-2 calls, and it belongs to the user, not to the key.
  • The server log has one line per call with the time, the IP address, the model and the method, but not the key.
  • Expiration dates make old keys stop working on their own, and administrators can cap how long a key may live.

What Odoo stores about an API key

In Odoo 20 an API key is a row of res.users.apikeys with five things you can see: the description you typed ("Claude Desktop", "n8n sync"), the user it belongs to, its scope, its creation date and its expiration date. The secret itself is stored hashed. When a call arrives, Odoo checks the key and runs the call as that user. Nothing is written to the key: you cannot tell from it whether it was used this morning or never.

Users see their own keys under My Preferences, Security, where the button is Create API Key. Administrators see every key, with its user and creation date, and can delete it, under Settings, Permissions, Manage API Keys.

Latest Login: only some clients update it

The Users list has a Latest Login column (hidden by default: switch it on from the optional columns), taken from res.users.log. Odoo adds a row there when a login goes through its login method: a person signing in to the web client, or a script calling XML-RPC common.authenticate (or login) with the key as password, which many XML-RPC clients do once before their calls.

Calls signed with the key directly do not go through that method. A JSON-2 call with Authorization: Bearer, and an execute_kw call that passes the key, are checked without adding a login row. So an AI tool that only uses JSON-2 can work all day and leave Latest Login unchanged. And because the field belongs to the user, three keys of one user share it.

The server log: calls, but not keys

If you run Odoo yourself, its log has one line per HTTP request, with the time, the database, the client IP address and, for API calls, the model and method (for example POST /json/2/res.partner/search_read, or /xmlrpc/2/object#res.partner.write for XML-RPC). The request lines do not name the key or the user (only authenticate calls write a line with the login name). You can see that something read contacts at 03:00 from a given IP address; you cannot see which of your keys it was. Behind a reverse proxy, turn on Odoo's proxy mode so that the address is the client's and not the proxy's.

Free ways to keep keys under control

  • One user per tool. Create the key of each AI tool or integration under its own user. Latest Login, Last Updated by and the chatter then name the tool, and you can limit what it may do with access rights (see Read-only Odoo API key for ChatGPT, Claude or an MCP server).
  • Expiration dates. In Odoo 20 every key can get an expiration date, and each user group has an API Keys maximum duration days setting that caps how far in the future it may be for users of that group. Keys that nobody renews stop working on their own. Keys created by an administrator can have no expiration date at all.
  • A list of keys with owners. Keep, outside Odoo, which key belongs to which tool and who set it up. When a tool is retired, remove its key.

Limiting how many calls a key can make

Odoo has no rate limit. An AI agent that retries a failing call in a loop can send thousands of requests in a few minutes, and Odoo serves them all.

With nginx in front of Odoo, limit_req can cap requests. It is usually keyed on the client IP address, so every tool running on the same server shares one limit. For JSON-2 you can key it on the Authorization header instead (limit_req_zone $http_authorization ...), which gives each key its own limit; requests without that header are then not limited by that zone, so keep an IP-based limit as well. For XML-RPC and JSON-RPC the key travels inside the request body, where nginx cannot see it.

What each option gives you

Key recordLatest LoginServer lognginx limit_req
Last use of each keyNoPer user, some clientsNo (no key)No
IP addressNoNoYes, per callNo
Calls per keyNoNoNoNo
Limit per keyNoNoNoJSON-2 only, with the Authorization header

Last use, IP and calls of every key, with a limit per key

For Odoo 20 we built AI API Key Usage & Rate Limit (paid, by GRAMSHIFT, which publishes this site). It lists every API key of the database with the time of its last call, the IP address and channel of that call (JSON-2, XML-RPC or JSON-RPC), and its calls today, in 7 days and in 30 days, with filters for keys that made no call for 30 days. Give any key a limit in calls per minute, or set a default for every key: calls above it get HTTP 429 with Retry-After on JSON-2, and an error with the same message on XML-RPC and JSON-RPC, while every other key keeps working. It counts from the day it is installed, works with the keys you already have, and its page lists exactly what is covered.

To see what a key changed, see How to see what ChatGPT, Claude or an MCP server changed in Odoo.

How this was checked: the key fields, the login log, the maximum key duration and the way calls are authenticated were read in the Odoo 20 source (as of 2026-10-06); the log lines come from a local Odoo 20 Community server. The module's behaviour was tested on a local Odoo 20 Community server on 2026-10-10. This page is not affiliated with Odoo S.A. On the use of AI: this article and the module were written by Claude, an AI model, working for GRAMSHIFT; the quoted code paths were compared against the source.

Frequently asked questions

Does Odoo show when an API key was last used?

No. In Odoo 20 an API key stores its description, user, scope, creation date and expiration date, and nothing about its use. Latest Login in the Users list changes only for web logins and for XML-RPC or JSON-RPC clients that call authenticate, not for JSON-2 calls, and it belongs to the user, not to the key. A module that records each call is needed to see the last use of every key.

How do I find unused API keys in Odoo?

Standard Odoo cannot tell you which keys are unused. Give keys expiration dates so that forgotten keys stop working on their own, keep a list of which key belongs to which tool, or install a module that records the last call of every key and filter on keys with no call for 30 days.

How do I rate limit the Odoo API per API key?

Odoo 20 has no rate limit. nginx limit_req can cap requests per IP address, or per key for JSON-2 by keying it on the Authorization header; for XML-RPC and JSON-RPC the key is inside the request body, out of nginx's reach. A module that limits each Odoo API key itself covers all three APIs.

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 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 logRead-only Odoo API key for ChatGPT, Claude or an MCP server (Odoo 20)In Odoo 20 Community the only scope a new API key can get is RPC, and a key acts with every right of its user: on 2026-10-09 the same key that read orders also confirmed them through /json/2/sale.order/action_confirm. The free way to limit an AI agent is a dedicated user; where that stops, and why an ordinary update from an agent can remove order lines. 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