xnatctl: a CLI for XNAT ops/admin tasks

15 views
Skip to first unread message

Ricky Wong

unread,
Feb 26, 2026, 3:36:35 PM (5 days ago) Feb 26
to xnat_discussion
Hi all,

I wanted to share an open-source tool I’ve been building: xnatctl, a command-line interface for XNAT administration and day-to-day ops from your terminal.

If you've ever found yourself writing one-off curl commands against the XNAT REST API, chaining together shell scripts for batch downloads, or wishing you had something like the AWS CLI but for XNAT -- this is for that.

xnatctl is CLI-first and organized around resource-centric commands with consistent output formats and safe batch operations, so you can script common workflows without hand-rolling REST calls each time.

What it does
  1. Resource-centric commands that match how you think about XNAT: xnatctl project list, xnatctl session download, xnatctl scan show, etc.
  2. Profile-based configuration to switch between dev/prod/collaboration servers
  3. Parallel batch uploads and downloads with progress tracking
  4. Script-friendly output: --output json|table, plus --quiet for IDs only
  5. Session token caching -- log in once with xnatctl auth login and reuse the session automatically
  6. Prearchive management, pipeline execution, raw API access as an escape hatch, and optional DICOM utilities

How it differs from pyxnat/xnatpy:

pyxnat and xnatpy are Python libraries designed to be imported into your own scripts and applications. They're the right choice when you're building a processing pipeline or need programmatic access to XNAT from Python. xnatctl is CLI-first -- it's for          
  interactive exploration, shell scripting, and day-to-day admin tasks without writing a Python program.

How it differs from xnatpy's CLI and xnatutils:

Both xnatutils and xnatpy ship their own command-line tools, and they work well for common tasks like downloading scans or listing projects. xnatctl aims to go further (thanks to the comprehensive API endpoints avilable) in two ways: broader scope (prearchive management, pipeline execution, admin operations, DICOM utilities) and UX consistency -- every command follows a uniform <resource> <action> pattern with the same --output json|table, --quiet, and --dry-run flags. It also supports named server profiles for switching between environments, parallel batch operations with progress tracking, and ships as a standalone binary (no Python required) and Docker image for CI.

The project is open source (MIT) and on GitHub: https://github.com/rickyltwong/xnatctl, build available across OS platforms.

It's early and under active development, so I'd really appreciate feedback, bug reports, and feature requests -- especially from folks doing a lot of command-line work with their XNAT instances.

Thanks,
Ricky W.

akluiber

unread,
Feb 26, 2026, 6:59:44 PM (5 days ago) Feb 26
to xnat_discussion
Great stuff! I've been bundling some functions that I commonly use in my containers into a utils.sh that I source in my bash scripts. This might make my life quite a bit easier.
Reply all
Reply to author
Forward
0 new messages