Skip to content

Delete data chunk

DELETE
/api/v1/storage/delete/{userAddr}/{chunkID}
curl --request DELETE \
--url http://localhost:8080/api/v1/storage/delete/example/1 \
--header 'Authorization: Bearer <token>'

Delete a data chunk from this node’s view of the distributed storage network.

Authentication: a JWT bearer token, and nothing else

The route is registered without auth middleware (storage.DELETE("/delete/:userAddr/:chunkID", s.handleDelete)), so the whole decision is made inside handleDelete (pkg/meshstorage/api/status.go). That handler reads exactly two request headers:

Header Required What it does
Authorization: Bearer <jwt> yes The only credential. The address in the token must match userAddr; the comparison is hash-aware, so a 0x… token may delete under the zh1_… form of the same address. A mismatch is 403, a missing or unverifiable token is 401.
X-Delete-Voucher no A chunk-scoped delete voucher, base64(JSON) or raw JSON, forwarded unverified to the shard-holding peers so that honest remote holders accept a zh1_ delete. It is not an alternative credential — the local authorisation is the JWT either way. An account-scoped voucher on this route is refused with 400; use DELETE /api/v1/storage/account for an account-wide purge.

The legacy signature path has been removed from this handler. A request carrying X-Signature, X-Timestamp, X-Public-Key and X-Nonce but no bearer token gets 401 — those four headers are not read here at all, and X-Nonce has no reader anywhere in the node. Do not build against them.

This endpoint takes no request body. A body, if sent, is never read.

userAddr
required
string

Ethereum address (0x…) or its hashed storage form (zh1_…). It is normalised before use and must resolve to the address in the token.

chunkID
required
integer

Chunk identifier

X-Delete-Voucher
string

Optional chunk-scoped delete voucher, base64(JSON) or raw JSON. Forwarded to the shard holders; an account-scoped voucher is rejected with 400 on this route.

This node reached its shard-deletion quorum for the chunk.

This is not a proof of removal, and a client must not present it to a user as one. The quorum is two thirds of the 15 shards — minRequired := (TotalShards * 2) / 3, i.e. 10 — it is counted on this node alone, and a shard arm that reports “row not present” counts towards it. When the holder list had to be recomputed instead of read back from the recorded placement, every one of those successes can come from the local arm while all 15 shards stay with the real holder; the node then logs meldet Erfolg, hat aber NICHTS entfernt and the response is still this 200 (open item F-3 in pkg/meshstorage/distributed.go).

Since node a7b669f (2026-10-15) the body distinguishes those cases in a field, and there are THREE forms of this 200, not two. confirmed is the only one of them a client may present to a user as removal:

  • confirmed: true — the holders that removed data reached the RECOVERY threshold, not merely the quorum. This is the one positive signal this endpoint has.
  • confirmed: false, message “…fewer holders removed data than the recovery threshold requires” — the quorum was reached but enough shards may still sit with the real holder to reconstruct the chunk.
  • confirmed: false, message “No copy of this data was found on this node; nothing was removed” — every success in the round was hollow.

The threshold for confirmed is deliberately the recovery threshold and not “at least one real removal”: one genuine deletion out of fifteen leaves 10 to 14 shards with the real holder, which is a fully reconstructable chunk.

confirmed is a *bool with omitempty, so it is omitted only when it is genuinely unset — a false never disappears. An OLDER node answers this route without the field at all; absent therefore means “this node cannot tell you”, which is not false and not true. A client that reads confirmed !== true as the condition for “not proven” is correct for all three; one that reads confirmed === false is not.

Media typeapplication/json
object
success
boolean
message

Success message

string
data

Optional response data

object
confirmed

true only when the recovery threshold was met. Absent on nodes older than a7b669f, which is a third state and not false.

boolean
Examples

removal reached the recovery threshold

{
"success": true,
"confirmed": true,
"message": "Data deleted successfully"
}

Bad Request - Invalid parameters

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Invalid request",
"message": "User address must be a valid Ethereum address (0x...)"
}

Unauthorized - Authentication failed

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Authentication failed",
"message": "Invalid signature or expired timestamp"
}

Forbidden - authenticated, but not the owner of the addressed data

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Ownership verification failed",
"message": "You can only delete your own data"
}

This node has no record of the chunk and removed nothing. It is a statement about the responding node, not about the network, and specifically not “the data never existed”.

Since a7b669f it is returned only when TWO independent pieces of evidence are missing: the round removed nothing anywhere (every success was hollow) and this node finds no DURABLE trace of the chunk. The volatile metadata cache is deliberately out of that condition — deciding on it was the defect, because the cache entry is cleared on the way and the second attempt was guaranteed to report “absent”. The path never asks the shard holders, so a 404 is compatible with the chunk still being there: a node that never saw the upload, whose remote arms all failed and whose placement had to be guessed, has neither a local row nor a vouched tombstone to go on.

Two different permissions follow from that, and keeping them apart is the point:

  • A purge loop may read 404 as “nothing to do here” and move on. That is the operational path and it is correct on this reading.
  • A deletion confirmation shown to a user — GDPR Art. 17 evidence, a badge, a receipt, the words “data deleted” — must not count a 404. Since a7b669f there IS a field it can rest on, and exactly one: confirmed: true on the 200 above. Nothing else on this endpoint — not success: true, not a 404, not an absent confirmed — carries that weight.

The full reasoning is written out at classifyDeleteArm in repo zentalk-web, file zentalk/src/api/mesh/delete-arm.ts.

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Data not found",
"message": "Requested data does not exist"
}

Too Many Requests - Rate limit exceeded

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Rate limit exceeded",
"message": "Maximum 100 requests per minute"
}

Internal Server Error

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Internal server error",
"message": "An unexpected error occurred"
}

Service Unavailable - this node cannot adjudicate the request and the client should retry against another mesh node.

Emitted by JWKSAvailabilityGate for a kid-bearing bearer token when this node has an issuer configured but holds zero issuer keys. It runs as global middleware, so it reaches every route including the storage delete route.

Media typeapplication/json
object
error

Error type

string
message

Human-readable error description

string
code

Optional error code

string
Example
{
"error": "Issuer key set unavailable",
"message": "This node cannot currently verify asymmetric tokens; retry against another mesh node."
}
Retry-After
integer
Example
30

Seconds to wait before retrying