Connecting to the XNAT REST API

There are a number of different options for connecting to the XNAT REST API, ranging from your a web browser to basic access tools like curl, wget, etc to custom Java, Perl or Python solutions.


XNAT installations are preconfigured to have the REST API accessible under the /data folder from the server URL. Your individual site may need the port, or the webapp name (depending on how you configured it), or neither. The REST api is accessible using the same URL as you would use to access your site through a web browser.

If your site is accessible at http://machine101:8080/xnat then you would need to prefix your REST urls with http://machine101:8080/xnat/data/.... Similarly, if your site is addressable at, then you would prefix it with

Connection tools

The XNAT team has some developed some simple java based tools which can be used as command prompt tools to access the REST API.

  • XNATRestClient
    The XNATRestClient is built specifically to facilitate user interaction with the REST API from the command prompt.
XNATRestClient -host -u USER -p PASS -m GET|POST|DELETE|PUT -remote "/data/archive/projects?format=xml"

Most UNIX operating systems come pre-installed with 'Curl' which is a tool for transferring data to or from a server. Because XNAT Servers are secured, you will need to provide a username and password to access the api.


For more information on using curl, please review its documentation.

Wget is an additional UNIX tool for retrieving files from a remote server.

wget --http-user=USER --http-user=PASS --auth-no-challenge

If your server is not configured appropriately, you may need the --auth-no-challenge attribute for the login to proceed normally.