(zettel (meta (box-name "manual") (created "20220304164242") (modified "20261119141919") (role "manual") (syntax "zmk") (tags "#api #manual #zettelstore") (title "API: Zettelstore readiness")) (rights read) (content "" "Zettelstore starts its web service before the initial indexing of all zettel is complete.\nUntil then, search results and some calculated metadata may be incomplete.\nZettel metadata evaluated in this phase contains the key [[''index-state''|00001006020000#index-state]] with the value ''incomplete''.\n\nTo find out whether the box service is completely ready, send an HTTP GET request to the endpoint ''/x'' with the query parameter ''data=ready''.\n\nThis request does not require authentication, even if [[authentication is enabled|00001010040100]].\nIt does not provide any information about the content of the Zettelstore.\n\n````sh\n# curl -i 'http://127.0.0.1:23123/x?data=ready'\nHTTP/1.1 503 Service Unavailable\nCache-Control: no-store\nRetry-After: 1\nContent-Type: text/plain; charset=utf-8\n\nincomplete\n````\n\n````sh\n# curl -i 'http://127.0.0.1:23123/x?data=ready'\nHTTP/1.1 200 OK\nCache-Control: no-store\nContent-Type: text/plain; charset=utf-8\n\nready\n````\n\nThe body contains a plain text value for human readers, followed by a newline:\n; ''ready''\n: The box service is started, and the initial indexing is complete.\n; ''incomplete''\n: The box service is started, but the initial indexing is not complete yet.\n\nThe HTTP status code is authoritative.\nClients must treat the status codes ''200'' and ''204'' as \"\"ready\"\".\nCurrently, only ''200'' is used, with the body ''ready''.\nFuture versions may respond with ''204'' and an empty body.\nStatus ''503'' means \"\"incomplete\"\".\nThe body is informational only and should not be evaluated by clients.\nIntermediate components, such as reverse proxies, may replace the body of a ''503'' response.\n\nOnce ''ready'' is reported, the state does not change back during the lifetime of the Zettelstore process, even if the index is rebuilt later.\nDuring a rebuild, the previous index continues to serve requests.\n\nClients should poll this endpoint until it reports ''ready''.\nThe value of the ''Retry-After'' header is a hint for the polling interval in seconds.\n\n==== HTTP Status codes\n; ''200'', ''204''\n: The box service is ready.\n Currently, only ''200'' is used.\n; ''400''\n: The value of the query parameter ''data'' is unknown.\n; ''503''\n: The box service is running, but the initial indexing is not complete.\n Try again after the number of seconds given in the ''Retry-After'' header."))