(zettel (meta (back "00001012000000 00001012080100 00001018000000") (backward "00001012000000 00001012051400 00001012080100 00001018000000") (box-number "1") (created "20211230230441") (forward "00001004011200 00001004020000 00001004051100 00001010040100 00001010070300 00001012050600 00001012051400 00001012920000") (modified "20260702143501") (published "20260702143501") (role "manual") (syntax "zmk") (tags "#api #manual #zettelstore") (title "API: Refresh internal data")) (rights 4) (encoding "") (content "Zettelstore maintains internal data to make operations faster.\nThis allows it, for example, to quickly [[find occurrences of a word|00001012051400]] without checking every zettel individually.\nIt also avoids repeatedly scanning [[ZIP files|00001004011200]] containing zettel by remembering their metadata.\n\nIn rare cases, this internal data may become outdated.\nThis should not happen, but differences in file systems and operating systems can occasionally lead to inconsistencies.\nIt may also happen if certain [[system configuration settings|00001004020000]] have been changed.\n\nTo resolve such issues without restarting Zettelstore, you can trigger a refresh of the internal data.\nDuring a refresh, all zettel are read and processed again, and the internal data is updated accordingly.\n\nTo trigger a refresh, send an HTTP POST request to the ''/x'' [[endpoint|00001012920000]] with the query parameter ''cmd=refresh'':\n\n```sh\n# curl -X POST 'http://127.0.0.1:23123/x?cmd=refresh'\n```\n\nIf successful, the request returns HTTP status code 204 (No Content) with an empty body.\n\nThe request succeeds if one of the following conditions is met:\n* Authentication is not enabled, and Zettelstore was started with the [[''run-simple''|00001004051100]] command or [[''refresh-mode''|00001004010000#refresh-mode]] is set to \"\"true\"\"\n* [[Authentication is enabled|00001010040100]], and you [[provide a valid access token|00001012050600]], while your [[user role|00001010070300]] is not \"\"creator\"\"\n* Authentication is enabled, you are either an anonymous user or your user role is \"\"creator\"\", and Zettelstore was started with the ''run-simple'' command or ''refresh-mode'' is set to \"\"true\"\".\n\n=== HTTP Status codes\n; ''204''\n: Operation was successful, the body is empty.\n; ''400''\n: Request was not valid.\n There are several reasons for this.\n Most likely, no query parameter ''cmd'' was given, or it did not contain the value \"\"refresh\"\".\n; ''403''\n: You are not allowed to perform this operation."))