Odoo JSON-2 API: authentication, requests and transactions

A practical guide to calling Odoo 19's JSON-2 API: bearer API keys, database selection, ORM calls such as search_read, error handling and per-call transactions. It also covers what to confirm on your plan and hosting before you build.

On this page

How the Odoo JSON-2 API lets your systems call Odoo

An integration team usually needs other systems to read and write Odoo records without a person logging in, and the JSON-2 API is Odoo's current route for that in Odoo 19. Each call is an HTTP request that runs an ORM method on a model, such as search_read or create, and the request is authenticated with an API key sent as a bearer token. The calls run with the permissions of the user who owns that key, so the access model you already have in Odoo, including access rights and record rules, decides what the integration can see and change. Before writing any code, confirm that your plan includes external API access. The pricing page places that feature in the Custom plan, and the hosting options differ by plan, so check this against your contract and hosting type first.

The API is usually the right choice when an external system needs to query or update Odoo data on demand, for example a billing platform reading open invoices or a warehouse system posting stock moves. A custom module makes sense when the logic must run inside Odoo's own transactions and user interface, and a workflow tool makes sense when many systems must be chained with retries and monitoring. The JSON-2 API sits between these options: it keeps the logic outside Odoo, and the code that calls it still needs its own error handling.

The exact endpoint names, request fields and the database selection header are not something to copy from examples or older articles. Each database publishes its own /doc page that lists the models and methods it exposes, and that page is the source of truth for the version you run. Read it on the database your integration will use, record the header name and the field names it shows, and recheck them after each upgrade. Odoo's JSON-2 documentation is the natural next read for the general reference.

How a JSON-2 request reaches the ORM and returns

The calling system starts the request on the integration host, which sits on the far side of the trust boundary from Odoo. The request carries a bearer API key and a header that names the target database, both of which Odoo checks before any model method runs. Odoo runs the named ORM method inside its own transaction on the selected database, then returns either a result or an error response. Check the header names and error shapes against the /doc page of your own database, because those details are not fixed in this diagram.

Request path from the integration host through key checks and the ORM to the database.

Which JSON-2 call pattern fits each integration

This table compares the common JSON-2 call patterns an integration team chooses between, with the typical use, the main risk and what to test first. Read each row against the business action the integration performs, then check the duplicate-database test before the pattern goes live.

PatternTypical useMain riskTest on a duplicate database first
Read with search_readPulling orders, partners or stock levels into another system on a scheduleHeavy queries on large models if domains are broad or fields are numerousRun the same domain on a copy of production volume and check response time and which fields are requested
Create or update through ORM methodsWriting invoices, contacts or delivery status from an external systemBusiness logic and automated actions may run on each write, causing side effects in other modulesConfirm which automated actions and access rules fire on create and write, and check the resulting records
Call a custom model method from a moduleRunning a multi-step business action such as confirming an order or reconciling a batchLogic changes in the module can break the integration, and error handling depends on how the method is writtenConfirm the method's input and return shape, its error messages, and that a repeat call does not duplicate work
One call per business actionActions that must succeed or fail as a unit, such as creating an order with its linesEach call commits on its own, so a failure midway can leave a partial recordForce a failure at each step and check which records remain, then decide how the integration cleans up or retries
Batched callsLoading or syncing many similar records, such as a nightly product updateOne bad record can fail a batch, and large batches increase timeouts and lock timeStart with small batches, time them on a copy, and check that a rerun of a failed batch is safe
Read-then-write sequencesUpdating a record only when its current state matches what the integration expectsAnother user or process may change the record between the read and the writeSimulate a concurrent change between the two calls and confirm the integration detects it

Setting up the first authenticated JSON-2 call

This sequence takes a team from a plan that allows external API access to one verified read-only call, with a tested bad-key and wrong-database error path. Each step closes with a check, so the integration does not reach production until the basics behave as expected.

  1. Confirm the plan and hosting allow API access

    The owner of the Odoo subscription checks the plan and hosting type before any design work. Per Odoo's pricing page, external API access is included only in the Custom plan, so a Standard or One App Free subscription cannot make these calls. Confirm the hosting type too: Odoo Online, Odoo.sh and on-premise are each documented separately, and a self-hosted Community install has no Odoo subscription behind it. Done when the owner can name the plan, the hosting type and the Odoo version in writing, and the version matches the one whose /doc page you will read in a later step.

  2. Create a dedicated integration user

    An Odoo administrator creates a separate user for the integration, not a personal account or an existing admin. Give it only the access groups the first call needs, such as read rights on the one model you will query. Name the user so audit logs show which system acted. Done when the user can sign in to the interface, is not an administrator, and can open the records the test call will read, while being denied the models it should not touch.

  3. Generate a bearer API key for that user

    Sign in as the integration user, open the account security settings and create an API key. Store it in your secrets manager straight away, because the key value is shown only at creation. Record the key's name, the creation date and the expiry you chose, so rotation is scheduled rather than forgotten. Done when the key is stored under a name the team can find, and no copy of it exists in a ticket, chat or source repository.

  4. Identify the target database and its name

    Confirm the exact database name the integration must address. On Odoo Online and Odoo.sh, the database name is part of the instance address, and on-premise installs often run several databases on one server. The integration team writes the name into its configuration as a value, not a guess. Done when the database name is recorded next to the environment it belongs to, and someone other than the author has checked it against the Odoo database selector.

  5. Read the /doc page for the installed version

    Open the /doc page of the target database in a browser while signed in as the integration user. Use it to confirm the endpoint format, the database selection header and the ORM method names supported by that version, including search_read. Do not copy method names from older examples or from another database running a different version. Done when the team has written down the endpoint, the header name and the exact model and method pair for the first call, with the database and version noted beside them.

  6. Run one read-only search_read on a duplicate

    Make the first real request against a duplicate of the production database, not production itself. Use a single search_read on a small model with a small field list and a low record limit, sending the bearer key and the database header from the previous steps. Keep the call read-only, with no create, write or unlink. Done when the call returns a well-formed list of records and the team can match one returned record to the same record in the Odoo interface.

  7. Check the bad key and wrong database errors

    Repeat the same request twice on the duplicate: once with a deliberately wrong bearer key, and once with a database name that does not exist. Capture the status codes and error bodies each time, and store them with the test notes so the integration's error handling can be built against real responses. Done when both failures return a clear error rather than data, and the team has confirmed that a revoked or mistyped key is refused on the same endpoint used for the successful call.

Protecting API keys and limiting what a key can do

An API key carries the rights of the user it belongs to, so the security of a JSON-2 integration depends on the integration user's groups, record rules, storage and network path. The cards below cover the controls to set and the checks to run before the key goes into production.

Scope the integration user's access

Create a dedicated internal user for each integration and give it only the access groups its calls need. Odoo applies access rights per model and record rules per record, so a user with broad groups can read far more than the integration requires. Review the groups on the user form and confirm which models the integration actually touches. Grant rights per model, not per application.

Odoo on-premise docs

Limit scope with record rules

Access rights decide whether a model can be read, but record rules decide which records. Add record rules to the integration user so that a call to search_read on a sales or partner model returns only the companies, teams or records the integration is meant to see. Test the rules with a sample call before go-live, because a missing rule usually fails silently by returning more data, not less.

Store keys outside code

Keep each API key in a secrets manager or the runtime's encrypted secret store, never in source code, configuration files committed to Git, or chat logs. Pass the key as a bearer token from the secret at call time and make sure build logs and error traces do not echo the Authorization header. Confirm with your security team which secrets platform the integration runtime is allowed to read from.

Plan rotation and revocation

Decide how long a key lives and who replaces it before the first key is issued. Check the key duration and rotation options available on your Odoo version and hosting type, and confirm them in the product documentation. Write a runbook that creates the new key, updates the secret, verifies a read call, and then revokes the old key, so a leaked key can be disabled without stopping the integration for long.

Audit which key made each call

Odoo records changes made through the ORM against the user who made them, so each integration should appear as its own user in the chatter and audit trail. Keep your reverse proxy and application logs for the JSON-2 endpoints, including timestamp, source address, database and response code, and correlate them with Odoo's record history. Confirm your retention period with the team that owns the logs.

Restrict network paths and test scope

Allow calls to the JSON-2 endpoints only from the systems that run the integration, using firewall rules or a reverse proxy allow list, and keep the database manager off public networks. After scoping is in place, run a test that uses the key against records outside its scope and confirm that Odoo returns no data and no write succeeds. Repeat this test after each upgrade or group change.

What a per-call transaction means for multi-step writes

Each JSON-2 call runs as its own transaction, so a sequence that creates a sales order, adds its lines and then confirms it can leave partial data behind if a later step fails. The first call may commit while the second fails, and nothing in the API rolls the earlier records back for you. Treat every multi-step write as a process that can stop at any point, and design the integration so that a rerun or a recovery job brings the database to a known state. Before building, confirm with your own version whether each call commits on success and what a failed call leaves behind.

That behavior forces three design choices. First, give every record a stable external identifier written at creation, so a retry can find what the previous attempt made instead of creating a duplicate. Second, define compensating steps for the cases you cannot avoid, such as cancelling or archiving an order whose lines never arrived, and record which step you are on so the compensation knows what to undo. Third, run reconciliation queries on a schedule that look for orders without lines, lines without parents and confirmed records missing expected fields. Place retries in the integration layer, with backoff and a cap, and retry only calls you have proven to be idempotent.

The sibling topic on migrating Odoo XML-RPC and JSON-RPC integrations to JSON-2 covers where transaction behavior differs from the older protocols, so read it before reusing code that depended on the old model. Do not rely on this page or on general assumptions for commit behavior. Check the exact semantics against the /doc page of each database you use, and prove them with tests that create a deliberately failing sequence on a duplicate database. Repeat those tests whenever you change Odoo version, because the behavior you verify on one release is the behavior you must confirm again on the next.

How the API setup differs on Odoo Online, Odoo.sh and on-premise

Odoo Online is hosted by Odoo, so Odoo sets the database address, the network path and the environments available for testing. Your team plans the integration around those settings and confirms them in writing before it configures any client.

  • Database URL and network: Odoo provides the database address on its hosting. Confirm the address format and any allow-listing or private connectivity options with Odoo before you configure callers.
  • Plan condition: External API access is listed only on the Custom plan, so confirm that the subscription includes it before you design calls. The Odoo pricing page lists the plan conditions.
  • Test databases: Ask Odoo which test or duplicate database options your plan includes, how they are named and whether they can be refreshed from production.
  • Upgrade dates: Major version upgrades are mandatory every two years on Odoo Online, and SaaS versions ship every two to three months without extended support, so regression test API calls after each update.
  • Support window: Standard support covers the first three years after a major release on Odoo Online, including security updates and bug fixes.

Before building, confirm the plan, the test database options and the update calendar for your database with Odoo in writing.

Limits to confirm in your environment before you build

Odoo's API surface, deprecation dates and hosting rules depend on the exact version and plan you run. The cards below list what to confirm on your own installation before you write any code, so the design reflects your environment rather than general assumptions.

Endpoints and method signatures

Confirm the exact JSON-2 endpoints, model names and method signatures on the /doc page of your own database, not on a generic example. The page reflects the installed version, and parameters for calls such as search_read can differ between releases. Record the version and the date you checked, and re-check after every upgrade. Treat any signature copied from a blog post or older documentation as unverified until it matches your /doc page.

Odoo upgrade docs

XML-RPC and JSON-RPC removal timing

Confirm when XML-RPC and JSON-RPC stop working for the version and hosting type you run, because the removal date is tied to the release line, not to your calendar. List every existing integration that uses them before setting a migration deadline. A migration date set from a release note you have not checked is the most common planning error. Ask Odoo or your partner to confirm the removal release for your hosting in writing before you commit a cutover window.

Hosting rate and payload limits

Confirm any request rate, payload size, timeout or worker limits applied by your hosting, reverse proxy or load balancer. These limits sit in front of Odoo and can reject large search_read calls or bulk writes even when the API itself accepts them. Ask your host for the documented values and test your heaviest call on a duplicate database. Retries from an integration can multiply load, so agree the limits before the integration goes live.

Standard support window for your release

Confirm the standard support end date for the Odoo release you run, because security updates for the API layer stop when standard support ends. Odoo's support documentation sets these windows per major release, and extended support is limited to Odoo.sh for select versions and on-premise. Map the end date against your integration's expected lifetime, and plan the next upgrade before the window closes rather than after.

Odoo support docs

API behavior across Odoo Online upgrades

Confirm how your integration behaves when Odoo Online applies its mandatory major upgrades, which occur every two years on Odoo Online and Odoo.sh. Check whether method signatures, field names and API key behavior change between versions, and whether your test database is upgraded before production. Run your regression tests against the upgraded test copy as part of every upgrade cycle, not only when a failure appears.

Upgrade documentation

Plan, modules and access rights

Confirm that your plan allows external API access and that the models and modules your calls depend on are installed and licensed. Odoo's pricing page ties external API access and custom modules to the Custom plan, so an integration built on a lower plan may not work at all. Also confirm that the integration user holds the access rights needed for each model, since a missing group returns errors that look like code faults.

Odoo pricing

What teams ask before building on the JSON-2 API

What drives the cost of an Odoo JSON-2 integration?

The main drivers are how many Odoo models the integration touches, how many external systems it talks to, and how many business rules must be reproduced on the Odoo side. A read-only report pull is a small job. A two-way sync of orders, stock and invoices, with error handling and reconciliation, is a much larger one. Cost usually splits into design, build, testing against a duplicate database, deployment and monitoring after go-live. Recurring costs come from maintenance, credential rotation and the retesting that each Odoo version change requires. Ask for a written scope that lists each entity, the direction of data flow, error and retry rules, test cases and who owns the credentials.

How long does a first working JSON-2 integration usually take?

No fixed duration applies, because the answer depends on scope. A single read call against one model can be prototyped quickly, while a production integration that writes data, handles failures and passes business testing takes considerably longer. The drivers are access to a non-production database, the number of models and fields involved, the availability of process owners to confirm rules, and how much existing data needs cleaning. Internal access approvals often set the pace more than the code does. Ask for a timeline tied to milestones: prototype, test database run, business sign-off and production cutover.

Can our internal developers build a JSON-2 integration without a partner?

Yes, if the team has experience with HTTPS APIs, access to Odoo's API documentation for its exact version and a test database. JSON-2 uses bearer authentication over plain HTTP requests, so the transport is rarely the hard part. The difficulty lies in understanding the Odoo data model, access rights, per-call transaction behavior and how each upgrade changes results. Teams usually need someone who knows the business processes and an owner for credentials and monitoring. A partner adds the most value when the team lacks Odoo model experience, when timelines are tight, or when the design must pass a security review before production. Decide by listing the skills the scope requires and comparing them with what the team already has.

What does the business need to provide for an integration project?

The business side makes most of the decisions that code cannot make. Plan for:

  • Process owners who can state which records should sync, in which direction, and what happens when two systems disagree.
  • Test data that covers normal cases and the awkward ones, such as partial shipments, refunds and duplicate customers.
  • A duplicate database, created from production and neutralized, so writes can be tested without touching live records.

Name a business approver for each data flow as well. Without these inputs, testing stalls and the build team guesses at rules. Ask the partner to list the duplicate database step and the data sign-off as named deliverables in the written scope.

How do Odoo upgrades affect an existing JSON-2 integration?

Upgrades can change model fields, method behavior, access rules and default values, so an integration that worked on one version needs retesting on the next. Odoo standard support covers the first three years after a major release, and the upgrade documentation describes moving a database through an upgraded test copy that should be tested before production. On Odoo Online and Odoo.sh, major version upgrades are mandatory every two years, and SaaS versions arrive every two to three months. Keep a regression suite of API calls, run it on the upgraded test database each cycle, and treat fixes as planned work. Ask for upgrade testing to appear as a named, recurring line in the scope or retainer.

Does Odoo's Custom plan change whether we should build this integration?

Yes, the plan is a gating question before design starts. According to Odoo's pricing page, only the Custom plan includes external API access, and only Custom can be hosted on Odoo.sh or on-premise. An integration over JSON-2 therefore depends on a Custom subscription, and the per-user prices and yearly discount on that page drive the recurring cost. Check the current figures on the pricing page rather than relying on older quotes. Self-hosted Community is a separate case, so confirm which edition and hosting your environment uses. Ask the partner to state in writing which plan, hosting type and edition the scope assumes.

Who should own the API keys and the integration user?

A dedicated integration user should own the key, with only the access rights the integration needs. Named ownership matters because keys carry the permissions of the user they belong to, and an integration that runs under a person's account breaks when that person leaves. Store keys in a managed secrets store, record who created each key and for what purpose, and plan rotation and revocation before go-live. Security review should cover the user's groups, record rules and the logs that show which key made which call. Ask the partner to deliver a credential register and a rotation procedure as part of the scope, and confirm with your security team which storage system they will accept.

How DeployOpen scopes and supports Odoo API integrations

DeployOpen treats Odoo JSON-2 API work as a defined integration scope: which Odoo database, which API key and bot user, which ORM methods and which transaction boundaries. We agree that scope in writing, build and test it against a duplicate database, then hand over the code, configuration and runbook so your team can operate it.

How we scope

  • Inventory every system calling Odoo and the model and method each call uses, such as search_read or create.
  • Confirm the Odoo plan and hosting type allow external API access before the design is fixed.
  • Agree in writing which databases, bot users, API key lifetimes and error handling rules are in scope.

How we build

  • Create dedicated integration users with minimum rights and API keys stored in your secrets manager, not in code.
  • Write JSON-2 requests with database selection headers and bearer keys, and test each ORM call on a duplicate database.
  • Design per-call transactions and handle error responses with retries that do not duplicate records.

How we hand over

  • Deliver source code, configuration, and a record of each endpoint, method and permission the integration uses.
  • Document the /doc page for each database that your developers should use as the reference for available methods.
  • Walk your engineers through key rotation, revocation and the audit steps for finding which key made a change.

How we support

  • Offer ongoing support and continuous testing as a retainer, with the scope and response terms agreed in writing.
  • Retest the integration after each Odoo upgrade or change to the API surface before it reaches production.
  • Plan the move off XML-RPC and JSON-RPC alongside your Odoo upgrade schedule so deadlines are not missed.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.