title: API: Retrieve metadata and content of an existing zettel
role: manual
tags: #api #manual #zettelstore
syntax: zmk
back: 00001006000000 00001012000000
backward: 00001006000000 00001012000000 00001012920000
box-number: 1
copyright: (c) 2020-present by Detlef Stern <ds@zettelstore.de>
created: 20211004093206
forward: 00001006050000 00001010040100 00001012050200 00001012053400 00001012920000 00001012920800 00001012921200 00001012930500
lang: en
license: EUPL-1.2-or-later
modified: 20251215173023
published: 20251215173023
visibility: public

The [endpoint](00001012920000) to work with metadata and content of a specific zettel is `/z/{ID}`, where `{ID}` is a placeholder for the [zettel identifier](00001006050000).

For example, to retrieve some data about this zettel you are currently viewing, just send an HTTP GET request to the endpoint `/z/00001012053300`.

    # curl 'http://127.0.0.1:23123/z/00001012053300'
    The [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].
    For example, to retrieve some data about this zettel you are currently viewing, just send an HTTP GET request to the endpoint ''/z/00001012053300''[^If [[authentication is enabled|00001010040100]], you must include a valid [[access token|00001012050200]] in the ''Authorization'' header].
    ```sh
    ...

Optionally, you may provide which parts of the zettel you are requesting.
In this case, add an additional query parameter `part=PART`.
Valid values for [`PART`](00001012920800) are &ldquo;zettel&rdquo;, &ldquo;[meta](00001012053400)&rdquo;, and &ldquo;content&rdquo; (the default value).

    # curl 'http://127.0.0.1:23123/z/00001012053300?part=zettel'
    title: API: Retrieve metadata and content of an existing zettel
    role: manual
    tags: #api #manual #zettelstore
    syntax: zmk
    The [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].
    For example, to retrieve some data about this zettel you are currently viewing, just send an HTTP GET request to the endpoint
    ...

# Data output

Alternatively, you may retrieve the zettel as a parseable object / a [symbolic expression](00001012930500) by providing the query parameter `enc=data`:

    # curl 'http://127.0.0.1:23123/z/00001012053300?enc=data&part=zettel'
    (zettel (meta (back "00001006000000 00001012000000 00001012053200 00001012054400") (backward "00001006000000 00001012000000 00001012053200 00001012054400 00001012920000") (box-number "1") (created "20211004093206") (forward "00001006020000 00001006050000 00001010040100 00001012050200 00001012053400 00001012920000 00001012920800 00001012921200 00001012930500") (modified "20230703174152") (published "20230703174152") (role "manual") (syntax "zmk") (tags "#api #manual #zettelstore") (title "API: Retrieve metadata and content of an existing zettel")) (rights 62) (encoding "") (content "The [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\n\nFor example, ...

If you print the result a little bit nicer, you will see its structure:

    (zettel (meta (back "00001006000000 00001012000000 00001012053200 00001012054400")
                  (backward "00001006000000 00001012000000 00001012053200 00001012054400 00001012920000")
                  (box-number "1")
                  (created "20211004093206")
                  (forward "00001006020000 00001006050000 00001010040100 00001012050200 00001012053400 00001012920000 00001012920800 00001012921200 00001012930500")
                  (modified "20230703174152")
                  (published "20230703174152")
                  (role "manual")
                  (syntax "zmk")
                  (tags "#api #manual #zettelstore")
                  (title "API: Retrieve metadata and content of an existing zettel"))
            (rights 62)
            (encoding "")
            (content "The [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\n\nFor example, ...

* The result is a list, starting with the symbol `zettel`.
* Then, some key/value pairs are following, also nested.
* Nested in `meta` are the metadata, each as a key/value pair.
* `rights` specifies the [access rights](00001012921200) the user has for this zettel.
* `"encoding"` states how the content is encoded.
  Currently, only two values are allowed: the empty string (`""`) that specifies an empty encoding, and the string `"base64"` that specifies the [standard Base64 encoding](https://www.rfc-editor.org/rfc/rfc4648.txt).
* The zettel contents is stored as a value of the key `content`.
  Typically, text content is not encoded, and binary content is encoded via Base64.

# HTTP Status codes

