Automating Orthanc with the REST API and jobs

Orthanc's REST API and job system can run routine archive work without manual clicks. This page explains what to automate, how to configure access and jobs safely, and what implementation involves.

On this page

Automating Orthanc with the REST API and jobs: when teams need it

Radiology IT and research teams often start by running routine archive tasks by hand in Orthanc Explorer: exporting a set of studies, pushing them to a modality or peer, or checking what arrived overnight. The Orthanc REST API and its asynchronous jobs let scripts and external schedulers run these tasks instead of a person clicking through the interface. The question for the team is not whether automation is possible but which tasks are repeated often enough, and carry enough risk of error, that they belong in a controlled script rather than in someone's browser session.

Tasks that fit well are the ones with a clear input, a repeatable outcome and a need for a record. Archive generation, sending studies to a DICOM modality or peer, bulk operations over a list of identifiers, and regular checks of server state are the usual candidates. Before automating, confirm in the Orthanc Book which REST routes and job types cover each task in the version you run, since routes and job behavior differ between releases. The Orthanc NEWS file records changes between versions and is the place to check before you depend on a route.

A team should stop running a task by hand when the work is recurring, when more than one person performs it differently, or when a missed run would delay clinical or research work. Manual steps also become a problem when they need an audit trail or when the operator leaves the task unattended. Write down who runs each task today, how often, and what happens if it fails. Those answers decide which tasks move into scripts first and how much monitoring and service account control the automation will need.

How a scheduler drives Orthanc through the REST API

The flow starts on an automation host, where a scheduler or script authenticates with a service account and submits a job through the REST API. A reverse proxy and authentication sit in front of Orthanc, and the trust boundary marks where requests cross into the Orthanc network. Orthanc runs the job asynchronously against its storage area and database, the client polls the job status, and results go to a modality, peer or output location. Check that the service account has only the permissions the job needs.

A scheduled job crosses one trust boundary, runs inside Orthanc and reports back by polling.

Which routine tasks to automate first

Zipped exports are usually the first task teams automate because they read data and write it to a location you control. A script selects studies by criteria, asks Orthanc to build a ZIP archive through the REST API, and then moves the file to storage for research sharing, offsite copies or hand-off to another team. Because the output is a new file, mistakes are easier to reverse than changes to stored instances.

  • Output location: Confirm where the archive is written and who can read it, since the file contains full patient data unless it has been anonymized first.
  • Naming and collisions: Decide how archive names are built so that a rerun does not silently replace an earlier export.
  • Job handling: Check how your version reports completion of asynchronous work, so the script does not fetch a partial file.
  • Disk use: Large selections can fill the temporary space on the server, so test with a bounded set of studies first.
  • Export route safety: Keep the export route disabled as the security FAQ recommends, and use only the archive generation calls your version documents.

Confirm the exact archive endpoints, job states and export settings against the documentation for your Orthanc release before relying on them in production.

Configuration options for automation and when each fits

This table compares the main ways to let automation reach Orthanc's REST API, from built-in authenticated users to external authorization and scheduler placement. Read each row against your network exposure, audit needs and the team that will run the scripts. Start with the simplest option that meets your access and audit requirements, and confirm exact configuration keys in the Orthanc Book before you rely on them.

OptionTrade-offWhen it fits
Authenticated API access with RegisteredUsers and AuthenticationEnabledSimple to set up, but every script shares the user list and audit trails show only the account nameSingle site, small team, scripts on a trusted internal network
Reverse proxy with HTTPS for remote callersAdds TLS and a single entry point, but adds proxy configuration and certificate upkeepCallers outside the local host or hospital segment that must reach the API
Dedicated service account with limited scopeClear audit trail per job and easy revocation, but needs a rotation and ownership processRecurring archive jobs, exports and sends that should not reuse an administrator login
External authorization plugin that checks each tokenFine-grained per-request decisions and central policy, but adds an external service to run and secureMultiple teams or systems share one Orthanc and need per-route or per-user control
Scheduler on the same host as OrthancFewest moving parts and lowest network exposure, but jobs compete for the same CPU, memory and diskLight job volume and a single server with spare capacity
Scheduler on a separate hostIsolates job load and failures, but requires network access and credentials between hostsHeavy archive generation or many scripts that must not slow clinical traffic

Setting up a safe automation path, step by step

This sequence takes an Orthanc server from an unreviewed version to scheduled automation that runs under a dedicated account, with restricted access, disabled risky routes, a tested job and alerting on failures. Each step closes with a check so the team knows it can move on.

  1. Confirm the target version and release notes

    Choose the Orthanc version you will run and read its release notes in the project's NEWS file before changing anything. Check that the version supports the database plugin and Docker image you already use, and note any changes to storage access or DICOM parsing that could affect your scripts. Record the version and the notes you reviewed in your change ticket. Done when a named engineer has signed off the version against your current plugins and scripts.

  2. Enable authentication before any remote access

    By default Orthanc accepts HTTP connections only from localhost. Before you allow any remote client, set RemoteAccessAllowed to true only if you need it, and set AuthenticationEnabled to true with at least one user defined in RegisteredUsers. Keep the REST API behind HTTPS and a reverse proxy if the server is reachable from outside your network. Check it by sending a request without credentials from a remote host and confirming it is refused.

  3. Create a dedicated automation user

    Create a separate account for the scheduler rather than reusing an administrator or clinical user. Give it a strong, unique password stored in your secrets manager, not in the script file. If you use the advanced authorization plugin, define the permissions this account needs and nothing more. Check it by logging in as this user and confirming it can run the intended job endpoints but cannot reach administrative routes.

  4. Restrict network access to the scheduler

    Limit which hosts can reach the Orthanc REST port to the scheduler and the operators who manage it. Apply the rule at the host firewall, the reverse proxy or the network layer, whichever your team controls. Confirm the scheduler's address is the only automation source allowed, and document the rule with the owner. Check it by connecting from an address outside the allowed list and confirming the connection fails.

  5. Disable risky routes

    Disable the /tools/execute-script route, which the Orthanc security FAQ warns can let a malicious user run system commands, and disable the export route that can overwrite files. Confirm no script you rely on needs them, and if one does, redesign it to use a safer path first. Verify by calling each route with the automation account and confirming it is refused. Keep the configuration change in version control so the state is auditable.

  6. Submit a test job against a non-production copy

    Copy a small, de-identified set of studies into a non-production Orthanc instance that uses the same version and configuration. Submit one representative job, such as an archive generation or a send to a peer, through the REST API using the automation account, and set a priority that reflects the job's urgency. Confirm the job is accepted and runs to completion. The step is done when the test run completes without errors on the copy.

  7. Verify job status, output and logs

    Poll the job status endpoint until the test job reports completion, then inspect the output files or the target system to confirm the expected studies arrived or were generated. Review the Orthanc logs for warnings and errors tied to the job ID. Compare the result against a manual run to confirm the automated output matches. The step is done when status, output and logs all agree and the team has written down the expected results for the production check.

  8. Schedule production runs with alerts on failure

    Move the verified job into your scheduler, pointing at production with the same account and restricted network path. Configure the scheduler to alert the owning team whenever a job reports failure or does not complete within the window you set. Run the first production job while watching its status and logs, then confirm the alert fires by triggering a controlled failure in a test. The setup is complete when a failed job produces an alert that reaches a named responder.

Securing service accounts and automation endpoints

Automation scripts call the same REST API that clinical and administrative users reach, so every route, credential and log entry matters. The cards below cover the Orthanc settings that decide who can call the API, which routes must stay closed, and how automated actions are traced.

Remote access is off by default

Orthanc accepts HTTP connections only from localhost unless RemoteAccessAllowed is enabled. Automation running on another host therefore needs that setting, and enabling it without authentication exposes the whole API. When you turn it on, set AuthenticationEnabled to true and define each automation user in RegisteredUsers. Confirm the setting in the configuration file on every node, including test and staging copies.

Security FAQ

Keep script execution disabled

The Security FAQ warns that the /tools/execute-script route can let a malicious user run any system command on the server. Automation that needs file or system work should run from a separate job host or pipeline, not through this route. Check that no script in your scripts folder or proxy rules reaches this path, and verify the route stays closed after each upgrade.

Keep the export route closed

The same FAQ notes that the export route can overwrite files on the server. Archive generation should use the supported job and transfer routes, with output written to a directory your automation owns. Block the export route at the reverse proxy as well as in Orthanc, and review any custom plugin that writes files on request.

Encrypt traffic beyond localhost

Any exposure beyond localhost should go through a reverse proxy that terminates HTTPS, so API credentials and patient identifiers are not sent in clear text. Orthanc's security guidance recommends this setup for Internet exposure. Ask your network team to confirm that certificates, proxy timeouts for long jobs and internal network paths meet your policy before automation goes live.

Scope and rotate service accounts

Give each automation job its own registered user with only the rights its task needs, such as read access for a reporting script or write access for a routing job. Rotate its password on a schedule you set and on staff changes, and avoid sharing one account across scripts. Record the owner and purpose of each account so that retired jobs lose access.

Per-request decisions with an external service

When a role list is too coarse, the advanced authorization plugin forwards each REST request's token to an external web service that allows or denies it, returning HTTP 403 when access is refused. This suits policies such as limiting a job to specific modalities or studies. Plan the service, its availability and its failure behavior, because automation will stop if that service is unreachable.

Authorization plugin docs

Log automation actions for audit

Automated changes such as deletions, transfers and anonymization leave no clear trail unless you record which account made them. Pair each service account with a documented log review, and confirm that Orthanc logs and your proxy logs are kept centrally with the retention your policy requires. Test a sample job and check that the log names the account, the route and the affected resource.

Questions teams ask before automating Orthanc

What does automating Orthanc with the REST API cost, and what drives it?

Cost depends on how many routine tasks you want automated, how many Orthanc instances are involved, how your access model is set up, and how much testing you need before jobs touch production studies. Most of the spend is one-time: scoping, writing and testing scripts, and setting up service accounts and monitoring. Recurring costs are the time your team or a partner spends maintaining scripts after Orthanc upgrades and when workflows change. Ask any quote to itemize these components, state whether it is fixed-scope, and list what is excluded, such as dedicated support hours. Orthanc itself has no paid edition, and Orthanc Team SRL quotes deployment and development services on request.

How long does a first Orthanc automation take to build?

The timeline depends on the environment more than on the scripting itself. The main variables are how many distinct jobs you need, whether the Orthanc version in use matches the version you develop against, how quickly your team can get API access to a test system, and how many review rounds your compliance or clinical stakeholders require. Ask for a schedule that separates scoping, build, a test window against a copy of production-like data, and cutover. Do not accept a duration that is not tied to a written list of jobs and an agreed test environment.

What does our team need to provide before an automation project starts?

Plan to provide four things: API access to a non-production Orthanc instance, representative sample data that covers your modalities and study types, a named owner for each schedule and job, and an agreed account for the automation to run under. Sample data should be de-identified or handled under your own approval process. Ownership matters because someone must decide when a scheduled job runs, when it is paused, and who responds when it fails. Confirm these items in the written scope so that delays in access or data do not surface as unplanned change requests.

Can our in-house team automate Orthanc without an outside partner?

Yes, a team with working knowledge of the Orthanc REST API and DICOM concepts such as studies, series, instances and query/retrieve can build and run routine automation in-house. The skills needed are usually an engineer comfortable with HTTP calls and authentication, someone who understands how DICOM objects are grouped, and an operator who can read job status and logs. A partner adds value when the team lacks that DICOM background, needs a second review of security settings, or wants a fixed-scope delivery with a retest. Decide based on the skills you have, not on the size of the task.

What changes when automation runs against a multi-instance Orthanc cluster?

Orthanc supports multiple instances reading and writing the same database since version 1.9.2 with PostgreSQL or MySQL plugin 4.0, so a cluster can serve a shared archive. For automation, this means you must confirm which instance receives each job, how job queues and priorities behave across nodes, and whether a scheduled task could run twice if two schedulers point at the cluster. Check the version and plugin pairing before you design the job layout, and test failover while a long job is running. Confirm these behaviors against the official Orthanc documentation for your release.

Which security settings matter before scripts call the REST API?

Orthanc only accepts HTTP connections from localhost by default. If remote access is enabled, the documentation says authentication should be on with users defined in the registered user list, and recommends HTTPS and a reverse proxy for any Internet exposure. Automation accounts should be separate from people accounts, with the narrowest permissions the jobs need. Keep the script-execution and export routes disabled, because the Orthanc security FAQ warns that the script route can run system commands and the export route can overwrite files. Advanced authorization can forward each request token to an external service for access decisions if your policy requires per-request checks.

What should we ask for in a written quote for Orthanc automation?

Ask for a list of each automated job with its trigger, input, output and owner, the Orthanc version and plugins the work targets, and the test environment used for acceptance. Request the assumptions behind the effort, including the number of review rounds, what is out of scope, and how upgrades after handover are handled. Confirm who holds the source code and documentation, how credentials are passed over, and what a retest or handover session includes. If pre-paid support hours are part of the offer, ask for their validity period and what they cover. Any quote should tie each line to a deliverable you can check.

Limits to confirm in your environment

The REST API and job behavior described for Orthanc depend on the exact release, the database back end and the load your scripts create. The cards below list the points to test in your own environment rather than assume, and they connect to the same question: does the scripted workflow still hold on the version and data volume you will run.

Job and priority behavior

Confirm how the installed version queues, prioritizes and reports asynchronous jobs before you build monitoring on top of them. Check whether job status routes return the states your scripts expect, how failed jobs are retried or left in place, and whether priority values change ordering when several long transfers compete. Run a representative batch on a staging copy and record the actual sequence, since job order is not guaranteed by the documentation alone.

Plugins docs

Route availability by release

Check that every REST route your automation calls exists in the target release and behaves as the version you tested. Routes for jobs, archive generation and peer transfers can be added, renamed or changed between versions, so a script that works on a development server may fail on production. Pin the Orthanc version in your deployment and keep a route inventory tied to that pin.

Concurrent scripts and shared queues

Test how job queues behave when several scripts, a viewer and DICOM peers all send work to the same instance at once. Measure queue wait times, whether a long archive generation delays urgent transfers, and how locks affect scripts that modify the same studies. Record the concurrency level you validated so the same limit is enforced in production.

Behavior after upgrades

Re-run your job, priority and route tests after each core upgrade, including the move to 1.13.0, before the new version receives production traffic. Release notes describe rewrites of storage access and DICOM parsing and transcoding, so timing, memory use and output details can shift even when the API looks unchanged. Keep the previous version available for rollback during the first production window.

Orthanc NEWS file

Database engine at scale

Orthanc's documentation recommends replacing the built-in SQLite index with an enterprise database engine, and suggests the PostgreSQL plugin for large datasets. The SQLite index should be replaced once several hundred thousand DICOM instances are stored, so plan the switch before automation volume grows. Ask your team to confirm index performance, lock behavior and backup timing on the chosen engine with a dataset similar in size to your archive.

Instances before switching
Several hundred thousand
Scalability FAQ

Performance on large datasets

Load test archive generation, bulk sends to modalities and peers, and status polling against a dataset close to your real size, not a sample. Measure memory use, disk I/O and job completion time at the peak hour your archive will see. Ask the vendor or Orthanc Team to confirm published sizing for your storage and database choices, since performance depends on hardware, network paths and instance counts.

Licensing and who maintains your automation

The Orthanc core is licensed under GPLv3 or later, and the scalability and cloud plugins are licensed under AGPLv3 or later. Automation built on the REST API is not the same as linking code into the server, but the way your scripts and plugins are built, deployed and shared can still create obligations. A Lua script that stays inside your own network and calls the REST API has different exposure from a Python or Java plugin that is compiled into a binary, bundled into a container image, or distributed to another organization. Before you rely on any of these arrangements, confirm your position with counsel, and record which components you wrote, which you adapted, and which you received from a third party, so the review has a clear starting point.

Ownership is a separate question from licensing and deserves an explicit decision in the project plan. Decide who owns the job definitions, the scripts that drive them, the service account configuration, the monitoring checks and the recovery runbooks, and make sure the contract or internal policy assigns that ownership to your organization. Store this material in version control that your team controls, and document how each job is started, what it touches, and who can change it. If a partner writes the automation, ask for the source, the runbooks and the handover notes as deliverables, and confirm that your team can run and modify them without the partner present.

Orthanc Team SRL sells deployment, configuration and development services, and it offers pre-paid dedicated support hours that are valid for 12 months. These hours are quoted on request, so ask for a written quote that states what the hours cover, how they are drawn down, and what happens to unused hours at expiry. Compare that with the internal effort of maintaining the automation after each Orthanc release, and name who will track the release notes and retest the jobs when the core changes. Details are on the Orthanc Team website.

How DeployOpen scopes and delivers Orthanc automation

DeployOpen plans, builds, tests and documents REST API automation for Orthanc inside the client's own infrastructure, so the archive team can run jobs, exports and sends under its own access controls. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • We list every routine archive task to automate, such as anonymization batches, archive generation and scheduled sends.
  • We record which Orthanc hosts, peers and modalities each job will call, with their addresses and owners.
  • We agree in writing which service accounts, roles and permissions the automation will hold and why.

How we build

  • We write job scripts against the REST API with retries, timeouts and clear handling of failed or partial jobs.
  • We set job priorities and concurrency limits so routine work does not starve interactive clinical use.
  • We test each workflow on a non-production Orthanc instance with representative data before any live run.

How we hand over

  • We deliver runbooks covering job schedules, monitoring checks, failure responses and how to rotate service credentials.
  • We document the configuration, scripts and version of Orthanc each automation was tested against.
  • We walk your operations and archive staff through the monitoring signals and the steps for stopping a job.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • We retest automation after each Orthanc upgrade, since REST behavior and plugin interfaces can change between releases.
  • Support scope, response expectations and fees are set in the written agreement, and we quote them from your scope.

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.