Skip to content

vault token create use-limit/num_uses not shown in format=json #31198

@cocoon

Description

@cocoon

Describe the bug
vault token create with use-limit and format to json is not showing the num_uses.

but with vault token lookup -format=json -accessor ... it is shown

To Reproduce
Steps to reproduce the behavior:

  1. Run vault token create -use-limit=1 -format=json
  2. no num_uses is shown
  3. Run vault token lookup -format=json -accessor <accessor>
  4. See num_uses

Expected behavior
I would expect to see all fields.

Environment:

  • Vault Server Version (retrieve with vault status): 1.20.0
  • Vault CLI Version (retrieve with vault version): Vault v1.20.0 (6fdd6b5), built 2025-06-23T10:21:30Z
  • Server Operating System/Architecture: Docker Ubuntu 24.04 x64

Vault server configuration file(s):

Additional context

vault token create -use-limit=1 -format=json
{
  "request_id": "0bf855b5-75e6-281e-fc1f-9a368fd2bcc1",
  "lease_id": "",
  "lease_duration": 0,
  "renewable": false,
  "data": null,
  "warnings": null,
  "auth": {
    "client_token": "hvs.FOLL2PPSAIJhV3fWIwm5ePz6",
    "accessor": "WlAszJUpfkuhBKQVCiUgz7Dh",
    "policies": [
      "root"
    ],
    "token_policies": [
      "root"
    ],
    "identity_policies": null,
    "metadata": null,
    "orphan": false,
    "entity_id": "",
    "lease_duration": 0,
    "renewable": false,
    "mfa_requirement": null
  },
  "mount_type": "token"
}
vault token lookup -format=json -accessor WlAszJUpfkuhBKQVCiUgz7Dh
{
  "request_id": "8c2a2752-21d8-9495-0b37-c5d0e5eeb070",
  "lease_id": "",
  "lease_duration": 0,
  "renewable": false,
  "data": {
    "accessor": "WlAszJUpfkuhBKQVCiUgz7Dh",
    "creation_time": 1751532990,
    "creation_ttl": 0,
    "display_name": "token",
    "entity_id": "",
    "expire_time": null,
    "explicit_max_ttl": 0,
    "id": "",
    "issue_time": "2025-07-03T08:56:30.301592143Z",
    "meta": null,
    "num_uses": 1,
    "orphan": false,
    "path": "auth/token/create",
    "policies": [
      "root"
    ],
    "renewable": false,
    "ttl": 0,
    "type": "service"
  },
  "warnings": null,
  "mount_type": "token"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions