How to share data#

AiiDA offers two avenues for sharing data with others: archive files and the REST API.

Sharing AiiDA archives#

You have performed your calculations with AiiDA and you would like to share your AiiDA provenance graph, for example to make your scientific study reproducible.

Since AiiDA keeps track of the provenance of every computed result, this step is easy: Tell AiiDA the final results you would like to be reproducible, and AiiDA will automatically include their entire provenance using the Traversal Rules.

Exporting individual nodes#

Let’s say the key results of your study are contained in three AiiDA nodes with PKs 12, 123, 1234. Exporting those results together with their provenance is as easy as:

$ verdi archive create my-calculations.aiida --nodes 12 123 1234

As usual, you can use any identifier (label, PK or UUID) to specify the nodes to be exported.

The resulting archive file my-calculations.aiida contains all information pertaining to the exported nodes. The default traversal rules make sure to include the complete provenance of any node specified and should be sufficient for most cases. See verdi archive create --help for ways to modify the traversal rules.


To see what would be exported, before exporting, you can use the --test-run option:

$ verdi archive create --test-run my-calculations.aiida

Please remember to use UUIDs when pointing your colleagues to data inside an AiiDA archive, since UUIDs are guaranteed to be universally unique (while PKs aren’t).

Exporting large numbers of nodes#

If the number of results to be exported is large, for example in a high-throughput study, use the QueryBuilder to add the corresponding nodes to a group my-results (see How to group nodes). Then export the group:

$ verdi archive create my-calculations.aiida --groups my-results

Alternatively, export your entire profile with:

$ verdi archive create my-calculations.aiida --all

Publishing AiiDA archive files#

AiiDA archive files can be published on any research data repository, for example the Materials Cloud Archive, Zenodo, or the Open Science Framework. When publishing AiiDA archives on the Materials Cloud Archive, you also get an interactive EXPLORE section, which allows peers to browse the AiiDA provenance graph directly in the browser.

Inspecting an archive#

In order to get a quick overview of an archive file without importing it into your AiiDA profile, use verdi archive info:

$ verdi archive info --detailed test.aiida
    export_version: main_0001
    aiida_version: 2.0.0
    key_format: sha256
    compression: 6
    ctime: '2022-03-06T23:50:57.964429'
        - 6af3f8a0-cf0d-4427-8472-f8907acfc87a
        include_authinfos: false
        include_comments: true
        include_logs: true
        input_calc_forward: false
        input_calc_backward: true
        create_forward: true
        create_backward: true
        return_forward: true
        return_backward: false
        input_work_forward: false
        input_work_backward: true
        call_calc_forward: true
        call_calc_backward: true
        call_work_forward: true
        call_work_backward: true
        count: 1
        count: 2
        - computer1
        - computer2
        count: 53
        - data.core.array.trajectory.TrajectoryData.
        - data.core.cif.CifData.
        - data.core.code.Code.
        - data.core.dict.Dict.
        - data.core.folder.FolderData.
        - data.core.remote.RemoteData.
        - data.core.singlefile.SinglefileData.
        - data.core.structure.StructureData.
        - process.calculation.calcfunction.CalcFunctionNode.
        - process.calculation.calcjob.CalcJobNode.
        - aiida.calculations:codtools.ciffilter
        count: 0
        type_strings: []
        count: 0
        count: 0
        count: 59
        count: 71

You can also use the Python API to inspect the archive file as a profile, see How to inspect an archive.

Importing an archive#

Use verdi archive import to import AiiDA archives into your current AiiDA profile. verdi archive import accepts URLs, e.g.:

$ verdi archive import ""

During import, AiiDA will avoid identifier collisions and node duplication based on UUIDs (and email comparisons for User entries). By default, existing entities will be updated with the most recent changes. Node extras and comments have special modes for determining how to import them - for more details, see verdi archive import --help.

To see what would be imported, before importing, you can use the --test-run option:

$ verdi archive import --test-run my-calculations.aiida


The AiiDA archive format has evolved over time, but you can still import archives created with previous AiiDA versions. If an outdated archive version is detected during import, the archive file will be automatically migrated to the newest version (within a temporary folder) and the import retried.

You can also use verdi archive migrate to create updated archive files from existing archive files (or update them in place).

Serving data through the REST API#

The AiiDA REST API allows to query your AiiDA database over HTTP(S) and returns results in JSON format.


As of October 2020, the AiiDA REST API only supports GET methods (reading); in particular, it does not yet support workflow management. This feature is, however, part of the AiiDA roadmap.


To ensure that when serving orm.ArrayData one always obtains a valid JSON compliant with the ECMA-262 standard, any np.nan, np.inf and/or -np.inf entries will be replaced by None which will be rendered as null when getting the array via the API call.

Launching the REST API#

Start serving data from your default AiiDA profile via the REST API:

$ verdi restapi
 * REST API running on
 * Serving Flask app "aiida.restapi.run_api" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on (Press CTRL+C to quit)

The REST API is now running on port 5000 of your local computer.

Like all verdi commands, you can select a different AiiDA profile via the -p PROFILE option:

verdi -p <another_profile> restapi


REST API version history:

  • aiida-core >= 1.0.0b6: v4. Simplified endpoints; only /nodes, /processes, /calcjobs, /groups, /computers and /servers remain.

  • aiida-core >= 1.0.0b3, <1.0.0b6: v3. Development version, never shipped with a stable release.

  • aiida-core <1.0.0b3: v2. First API version, with new endpoints added step by step.

Querying the REST API#

A URL to query the REST API consists of:

  1. The base URL, by default:

    Querying the base URL returns a list of all available endpoints.

  2. The path defining the requested resource, optionally followed by a more specific endpoint. For example:


    If no endpoint is appended, the API returns a list of objects of that resource. In order to request a specific object of a resource, append its UUID.


    As usual, you can use partial UUIDs as long as they are unique.

    In order to query by PK you need to use the id filter (see below). This also applies to User s, which don’t have UUIDs (but instead uses email).

  3. (Optional) The query string for filtering, ordering and pagination of results. For example:


Here are some examples to try:"slurm">45&node_type=like="data%"


The interactive EXPLORE sections on Materials Cloud are all powered by the AiiDA REST API and you can query the underlying API, either using your web browser or using a tool like curl:

$ curl

For an extensive user documentation of the endpoints, the query string as well as the format of the responses, see the AiiDA REST API reference.

Added in version 2.1.0.

It is possible to allow a request to declare a specific profile for which to run the profile. This makes it possible to use a single REST API to serve the content of all configured profiles. The profile switching functionality is disabled by default but can be enabled through the config:

verdi config set rest_api.profile_switching True

After the REST API is restarted, it will now accept the profile query parameter, for example:

If the specified is already loaded, the REST API functions exactly as without profile switching enabled. If another profile is specified, the REST API will first switch profiles before executing the request.


If the profile parameter is specified in a request and the REST API does not have profile switching enabled, a 400 response is returned.

Deploying a REST API server#

The verdi restapi command runs the REST API through the werkzeug python-based HTTP server. In order to deploy production instances of the REST API for serving your data to others, we recommend using a fully fledged web server, such as Apache or NGINX, which then runs the REST API python application through the web server gateway interface (WSGI).


One Apache/NGINX server can host multiple instances of the REST APIs, e.g. serving data from different AiiDA profiles.

A myprofile-rest.wsgi script for an AiiDA profile myprofile would look like this:

# wsgi script for AiiDA profile 'myprofile'
from aiida.manage.configuration import load_profile
from aiida.restapi.run_api import configure_api


api = configure_api()
application =


See the documentation of configure_api() for all available configuration options.

In the following, we explain how to run this wsgi application using Apache on Ubuntu.

  1. Install and enable the mod_wsgi WSGI module module:

$ sudo apt install libapache2-mod-wsgi-py3
$ sudo a2enmod wsgi
  1. Place the WSGI script in a folder on your server, for example /home/ubuntu/wsgi/myprofile-rest.wsgi.

  2. Configure apache to run the WSGI application using a virtual host configuration similar to:

    # Apache virtual host configuration file for AiiDA REST API
    # Copy to /etc/apache2/sites-enabled/aiida-rest.conf
    <VirtualHost *:80>
        LogLevel debug
        # Let the app do authorization
        WSGIPassAuthorization On
        # Require privileges on the wsgi directory
        <Directory "/home/ubuntu/wsgi">
            Require all granted
        # BEGIN SECTION for "myprofile" AiiDA profile
        # Use 5 threads and "aiida" virtual python environment
        WSGIDaemonProcess rest-myprofile \
            user=ubuntu group=ubuntu \
            threads=5 \
            python-home=/home/ubuntu/.virtualenvs/aiida \
        # REST API will be served on <host>/myprofile/api/v4
        WSGIScriptAlias /myprofile /home/ubuntu/wsgi/myprofile-rest.wsgi
        <Location /myprofile>
            WSGIProcessGroup myprofile
        # END SECTION for "myprofile" AiiDA profile

    Place this aiida-rest.conf file in /etc/apache2/sites-enabled

  3. Restart apache: sudo service apache2 restart.

You should now be able to reach your REST API at localhost/myprofile/api/v4 (Port 80).