title: API: Update a 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: 20210713150005
forward: 00001006000000 00001006010000 00001006020000 00001006050000 00001012053200 00001012920000 00001012921200 00001012930500
lang: en
license: EUPL-1.2-or-later
modified: 20251219142233
published: 20251219142233
visibility: public

Updating metadata and content of a zettel is technically quite similar to [creating a new one](00001012053200).
In both cases, you must provide the data for the new or updated zettel in the body of the HTTP request.

One difference is the endpoint.
The [endpoint](00001012920000) to update a zettel is `/z/{ID}`, where `{ID}` is a placeholder for the [zettel identifier](00001006050000).
You must send an HTTP PUT request to that endpoint.

The zettel must be encoded in a [plain](00001006000000) format: first comes the [metadata](00001006010000) and the following content is separated by an empty line.
This is the same format used for storing zettel within a directory box. [directory box](00001006010000).

    # curl -X PUT --data $'title: Updated Note\n\nUpdated content.' http://127.0.0.1:23123/z/00001012054200

# Data input

Alternatively, you may encode the zettel as a parseable object / a [symbolic expression](00001012930500) by providing the query parameter `enc=data`.
The encoding is the same as the data output encoding when you [retrieve a zettel](00001012053300#data-output).

The encoding for [access rights](00001012921200) must be given, but is ignored.
You may encode computed or property [metadata keys](00001006020000), but these are also ignored.

# HTTP Status codes

