Workers KV API how to read values with metadata

With Workers KV API :

It is possible to :

But there is no mention about how I can :

  • read key-value pair with metadata

The Metadata is always returned when you do a listing of keys via the API.


But listing keys with a cursor does not help, as cursor means to not have a direct access. Plus it would require a second API call after the get.

I would more like to know how to make a get with metadata.

It would be useful for sure, but that’s not how it was “designed” to be used.

Metadata is there to store small amounts of data so that you don’t need to retrieve the full KV value, for example, to use for filtering a list of items with dates, ordering, categories, tags etc.

I know it’s miss-leading, since you can read a KV value with metadata in the workers.

Hopefully Cloudflare can expand the API to include metadata.

I cannot explain why there is get with metadata with bindings, but no one with API. This seems unbalanced.

1 Like


Still no public documentation on a “get key value with metadata” from the rest api?

I just poked around and found…
…will return the metadata for a given key as json:

  "errors": [],
  "messages": [],
  "result": {
    "myKey": "myValue"
  "success": true

I’d love to be able to get both a single key and its metadata in a single rest api call, though. Did anyone figure this out?