title: API: Refresh internal data
role: manual
tags: #api #manual #zettelstore
syntax: zmk
back: 00001012000000 00001012080100 00001018000000
backward: 00001012000000 00001012051400 00001012080100 00001018000000
box-number: 1
copyright: (c) 2020-present by Detlef Stern <ds@zettelstore.de>
created: 20211230230441
forward: 00001004011200 00001004051100 00001010040100 00001010070300 00001012050600 00001012051400 00001012920000
lang: en
license: EUPL-1.2-or-later
modified: 20260303122105
published: 20260303122105
visibility: public

Zettelstore maintains some internal data to allow faster operations.

One example is the [content search](00001012051400) for a term: Zettelstore does not need to scan all zettel to find all occurrences for the term.
Instead, all words are stored internally, with a list of zettel where they occur.

Another example is the way to determine which zettel are stored in a [ZIP file](00001004011200).
Scanning a ZIP file is a lengthy operation, therefore Zettelstore maintains a directory of zettel for each ZIP file.

All these internal data may become stale.
This should not happen, but when it comes e.g. to file handling, every operating system behaves differently in very subtle ways.

To avoid stopping and re-starting Zettelstore, you can use the API to force Zettelstore to refresh its internal data if you think it is needed.
To do this, you must send an HTTP POST request to the [endpoint](00001012920000) `/x` and you must specify the query parameter `cmd=refresh`.

    # curl -X POST 'http://127.0.0.1:23123/x?cmd=refresh'

If successful, you will get an HTTP status code 204 (No Content) with an empty HTTP body.

The request will be successful if either:

* Authentication is not enabled, and either Zettelstore was started with the [run-simple](00001004051100) command or [refresh-mode](00001004010000#refresh-mode) is set to &ldquo;true&rdquo;,
* [Authentication is enabled](00001010040100), you [provide a valid access token](00001012050600), and your [user role](00001010070300) is not &ldquo;creator&rdquo;,
* Authentication is enabled, you are either an anonymous user or your user role is &ldquo;creator&rdquo;, and either Zettelstore was started with the run-simple command or refresh-mode is set to &ldquo;true&rdquo;.

# HTTP Status codes

