title: API: Retrieve references of an existing zettel
role: manual
tags: #api #manual #zettelstore
syntax: zmk
back: 00001012000000
backward: 00001012000000 00001012920000
box-number: 1
copyright: (c) 2020-present by Detlef Stern <ds@zettelstore.de>
created: 20250415154139
forward: 00001006000000 00001006030000 00001006035000 00001006050000 00001007031100 00001007040310 00001007040320 00001008010500 00001010040100 00001012050200 00001012920000 00001012930500
lang: en
license: EUPL-1.2-or-later
modified: 20251215173137
published: 20251215173137
visibility: public

The [endpoint](00001012920000) to retrieve references of a specific zettel is `/r/{ID}`, where `{ID}` is a placeholder for the [zettel identifier](00001006050000).

A zettel may contain references to external material, in the form of an URI.
External material may be referenced via Zettelmarkup [links](00001007040310), [inline embedding](00001007040320), or a [block transclusion](00001007031100).
It may also be referenced within the [metadata](00001006000000) of a zettel, when a key of [type](00001006030000) [URL](00001006035000) is given.

To calculate the references of a zettel, its [parsed](00001006000000) form is used.

For example, to retrieve references of the zettel about [CommonMark](00001008010500), just send an HTTP GET request to the endpoint `/r/00001008010500`:

    # curl 'http://127.0.0.1:23123/r/00001008010500'
    https://commonmark.org/
    https://commonmark.org/
    https://xkcd.com/927/
    https://github.github.com/gfm/
    https://spec.commonmark.org/0.31.2/
    https://github.com/yuin/goldmark

If you just want metadata external references, add a query parameter `part=meta`:

    # curl 'http://127.0.0.1:23123/r/00001008010500?part=meta'
    https://commonmark.org/

Similarly, to retrieve only references of the zettel content, use the query parameter `part=content`:

    # curl 'http://127.0.0.1:23123/r/00001008010500?part=content'
    https://commonmark.org/
    https://xkcd.com/927/
    https://github.github.com/gfm/
    https://spec.commonmark.org/0.31.2/
    https://github.com/yuin/goldmark

These examples illustrate that the data remains unsorted and that duplicates are preserved.
The client must handle this, e.g.:

    # curl 'http://127.0.0.1:23123/r/00001008010500' | sort -u
    https://commonmark.org/
    https://github.com/yuin/goldmark
    https://github.github.com/gfm/
    https://spec.commonmark.org/0.31.2/
    https://xkcd.com/927/

If you add the query parameter `enc=data`, the result will be encoded as a [symbolic expression](00001012930500):

    # curl 'http://127.0.0.1:23123/r/00001008010500?enc=data'
    ("https://commonmark.org/" "https://commonmark.org/" "https://xkcd.com/927/" "https://github.github.com/gfm/" "https://spec.commonmark.org/0.31.2/" "https://github.com/yuin/goldmark")

Of course, you can combine the different query parameters, e.g. to retrieve an Sx list of all metadata URIs.

# HTTP Status codes

