HashiCorp Vault KV V2 API

Key/Value version 2 secrets engine

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 12

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /{mount}/config Read the KV v2 secrets engine config · HashiCorp Vault Read KV v2 engine configuration #
Ask an LLM
“What max versions and cas requirement does my KV v2 mount have?”
“How long are KV v2 secret versions kept before deletion?”
Tell an agent
Show the KV v2 configuration for mount {mount}.
Get the max versions setting of the {mount} KV v2 engine.
POST /{mount}/config Configure the KV v2 secrets engine · HashiCorp Vault Configure KV v2 engine #
Ask an LLM
“How do I raise the max versions on a KV v2 mount?”
“Can I require check-and-set on all writes to a KV v2 engine?”
Tell an agent
Set max versions to {max_versions} on the {mount} KV v2 mount.
Require check-and-set for {mount} KV v2 writes.
GET /{mount}/data/{path} Read a KV v2 secret · HashiCorp Vault Read KV v2 secret #
Ask an LLM
“What is the current value of a KV v2 secret?”
“Can I read an older version of a KV v2 secret?”
Tell an agent
Read the {mount} KV v2 secret at {path}.
Get version {version} of the {mount} secret {path}.
POST /{mount}/data/{path} Create or update a KV v2 secret · HashiCorp Vault Create or update KV v2 secret #
Ask an LLM
“How do I store a new secret in a KV v2 mount?”
“Does writing a KV v2 secret create a new version?”
Tell an agent
Store {data} as a new version of the {mount} secret {path}.
Create or overwrite the {mount} KV v2 secret {path} with {data}.
DELETE /{mount}/data/{path} Soft delete the latest version of a KV v2 secret · HashiCorp Vault Delete latest version of KV v2 secret #
Ask an LLM
“How do I soft delete the newest version of a KV v2 secret?”
“Can a deleted KV v2 version be recovered?”
Tell an agent destructive · confirm first
Soft delete the latest version of the {mount} secret {path}.
Remove only the newest version of {path} in {mount}.
POST /{mount}/delete/{path} Soft delete specific versions of a KV v2 secret · HashiCorp Vault Delete specific versions of KV v2 secret #
Ask an LLM
“How do I soft delete several old versions of a KV v2 secret?”
“Can I remove specific versions from a KV v2 secret?”
Tell an agent destructive · confirm first
Soft delete versions {versions} of the {mount} secret {path}.
Remove the old {versions} versions of {path} in {mount}.
POST /{mount}/undelete/{path} Restore soft-deleted versions of a KV v2 secret · HashiCorp Vault Undelete versions of KV v2 secret #
Ask an LLM
“How do I restore versions of a KV v2 secret I soft deleted?”
“Can I bring back deleted KV v2 versions?”
Tell an agent
Undelete versions {versions} of the {mount} secret {path}.
Restore the soft-deleted {versions} of {path} in {mount}.
POST /{mount}/destroy/{path} Permanently destroy versions of a KV v2 secret · HashiCorp Vault Destroy versions of KV v2 secret #
Ask an LLM
“How do I permanently destroy old versions of a KV v2 secret?”
“Is destroying KV v2 versions reversible?”
Tell an agent destructive · confirm first
Permanently destroy versions {versions} of the {mount} secret {path}.
Erase the {versions} versions of {path} in {mount} for good.
GET /{mount}/metadata/{path} Read KV v2 secret metadata and version history · HashiCorp Vault Read KV v2 secret metadata #
Ask an LLM
“What is the version history of a KV v2 secret?”
“Which versions of a KV v2 secret exist?”
Tell an agent
Show metadata and version history for the {mount} secret {path}.
List the versions of {path} in {mount}.
POST /{mount}/metadata/{path} Update KV v2 secret metadata · HashiCorp Vault Update KV v2 secret metadata #
Ask an LLM
“How do I change the max versions on a single KV v2 secret?”
“Can I set a custom metadata field on one KV v2 secret?”
Tell an agent
Set max versions to {max_versions} on the {mount} secret {path}.
Set custom metadata {custom_metadata} on {path} in {mount}.
DELETE /{mount}/metadata/{path} Permanently delete a KV v2 secret and all its versions · HashiCorp Vault Delete KV v2 secret metadata and all versions #
Ask an LLM
“How do I permanently delete a KV v2 secret and every version of it?”
“Is deleting KV v2 secret metadata reversible?”
Tell an agent destructive · confirm first
Permanently delete the {mount} secret {path} and all its versions.
Erase {path} in {mount} for good, including every version.
GET /{mount}/metadata/ List keys in a KV v2 mount · HashiCorp Vault List KV v2 secrets #
Ask an LLM
“Which secret keys are stored in a KV v2 mount?”
“What secrets does my KV v2 mount hold?”
Tell an agent
List the secret keys in the {mount} KV v2 mount.
Show every secret path under {mount}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/hvault:hvault-kv-v2-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

hvault-kv-v2-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: HashiCorp Vault Vault Secrets Engines KV V2 API
  description: APIs for various Vault secrets engines including the KV (Key/Value) v1 and v2 engines, AWS dynamic credentials, database dynamic credentials, PKI certificate management, SSH certificate signing, and Transit encryption-as-a-service.
  version: '1.0'
  contact:
    name: HashiCorp Support
    email: support@hashicorp.com
    url: https://support.hashicorp.com/
  license:
    name: Business Source License 1.1
    url: https://github.com/hashicorp/vault/blob/main/LICENSE
servers:
- url: https://vault.example.com/v1
  description: Vault Server
security:
- vaultToken: []
tags:
- name: KV V2
  description: Key/Value version 2 secrets engine
paths:
  /{mount}/config:
    get:
      operationId: readKvV2Config
      summary: HashiCorp Vault Read KV v2 engine configuration
      description: Retrieves the configuration for the KV v2 secrets engine at the given mount path.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      responses:
        '200':
          description: Configuration returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/KvV2Config'
        '403':
          description: Permission denied
    post:
      operationId: updateKvV2Config
      summary: HashiCorp Vault Configure KV v2 engine
      description: Configures backend-level settings for the KV v2 secrets engine.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KvV2Config'
      responses:
        '204':
          description: Configuration updated
        '403':
          description: Permission denied
  /{mount}/data/{path}:
    get:
      operationId: readKvV2Secret
      summary: HashiCorp Vault Read KV v2 secret
      description: Reads the value of the secret at the specified path. Returns the current version by default, or a specific version if the version parameter is provided.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      - name: version
        in: query
        description: Version number to read
        schema:
          type: integer
      responses:
        '200':
          description: Secret data returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KvV2ReadResponse'
        '403':
          description: Permission denied
        '404':
          description: Secret not found
    post:
      operationId: createOrUpdateKvV2Secret
      summary: HashiCorp Vault Create or update KV v2 secret
      description: Creates a new version of a secret at the specified path. If the secret does not exist, it will be created.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - data
              properties:
                options:
                  type: object
                  properties:
                    cas:
                      type: integer
                      description: Check-and-set value for optimistic concurrency
                data:
                  type: object
                  additionalProperties: true
                  description: The secret data to store
      responses:
        '200':
          description: Secret created or updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/KvV2VersionMetadata'
        '403':
          description: Permission denied
    delete:
      operationId: deleteLatestKvV2Secret
      summary: HashiCorp Vault Delete latest version of KV v2 secret
      description: Performs a soft delete of the latest version of the secret at the specified path. The data can be recovered using the undelete endpoint.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      responses:
        '204':
          description: Secret version soft-deleted
        '403':
          description: Permission denied
  /{mount}/delete/{path}:
    post:
      operationId: deleteKvV2SecretVersions
      summary: HashiCorp Vault Delete specific versions of KV v2 secret
      description: Performs a soft delete of the specified versions of a secret. The data can be recovered using the undelete endpoint.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - versions
              properties:
                versions:
                  type: array
                  items:
                    type: integer
                  description: Versions to soft-delete
      responses:
        '204':
          description: Secret versions soft-deleted
        '403':
          description: Permission denied
  /{mount}/undelete/{path}:
    post:
      operationId: undeleteKvV2SecretVersions
      summary: HashiCorp Vault Undelete versions of KV v2 secret
      description: Restores soft-deleted versions of a secret.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - versions
              properties:
                versions:
                  type: array
                  items:
                    type: integer
                  description: Versions to undelete
      responses:
        '204':
          description: Secret versions restored
        '403':
          description: Permission denied
  /{mount}/destroy/{path}:
    post:
      operationId: destroyKvV2SecretVersions
      summary: HashiCorp Vault Destroy versions of KV v2 secret
      description: Permanently destroys the specified versions of a secret. This action is irreversible.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - versions
              properties:
                versions:
                  type: array
                  items:
                    type: integer
                  description: Versions to permanently destroy
      responses:
        '204':
          description: Secret versions permanently destroyed
        '403':
          description: Permission denied
  /{mount}/metadata/{path}:
    get:
      operationId: readKvV2Metadata
      summary: HashiCorp Vault Read KV v2 secret metadata
      description: Returns metadata and version history for the secret at the specified path.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      responses:
        '200':
          description: Metadata returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KvV2MetadataResponse'
        '403':
          description: Permission denied
        '404':
          description: Secret not found
    post:
      operationId: updateKvV2Metadata
      summary: HashiCorp Vault Update KV v2 secret metadata
      description: Updates metadata settings for the secret at the specified path.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                max_versions:
                  type: integer
                  description: Maximum number of versions to keep
                cas_required:
                  type: boolean
                  description: Whether check-and-set is required
                delete_version_after:
                  type: string
                  description: Duration after which versions are deleted (e.g., 30d)
                custom_metadata:
                  type: object
                  additionalProperties:
                    type: string
                  description: Custom key-value metadata pairs
      responses:
        '204':
          description: Metadata updated
        '403':
          description: Permission denied
    delete:
      operationId: deleteKvV2Metadata
      summary: HashiCorp Vault Delete KV v2 secret metadata and all versions
      description: Permanently deletes the secret metadata and all version data for the specified path. This is irreversible.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      - $ref: '#/components/parameters/secretPath'
      responses:
        '204':
          description: Metadata and all versions permanently deleted
        '403':
          description: Permission denied
  /{mount}/metadata/:
    get:
      operationId: listKvV2Secrets
      summary: HashiCorp Vault List KV v2 secrets
      description: Returns a list of secret keys at the specified path.
      tags:
      - KV V2
      parameters:
      - $ref: '#/components/parameters/kvMountPath'
      responses:
        '200':
          description: Secret keys listed
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      keys:
                        type: array
                        items:
                          type: string
                        description: List of secret keys
        '403':
          description: Permission denied
components:
  schemas:
    KvV2MetadataResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            cas_required:
              type: boolean
            created_time:
              type: string
              format: date-time
            current_version:
              type: integer
            custom_metadata:
              type: object
              additionalProperties:
                type: string
            delete_version_after:
              type: string
            max_versions:
              type: integer
            oldest_version:
              type: integer
            updated_time:
              type: string
              format: date-time
            versions:
              type: object
              additionalProperties:
                $ref: '#/components/schemas/KvV2VersionMetadata'
    KvV2VersionMetadata:
      type: object
      properties:
        created_time:
          type: string
          format: date-time
          description: When this version was created
        custom_metadata:
          type: object
          additionalProperties:
            type: string
          description: Custom metadata key-value pairs
        deletion_time:
          type: string
          description: When this version was deleted (empty if not deleted)
        destroyed:
          type: boolean
          description: Whether this version has been permanently destroyed
        version:
          type: integer
          description: Version number
    KvV2ReadResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            data:
              type: object
              additionalProperties: true
              description: The secret key-value data
            metadata:
              $ref: '#/components/schemas/KvV2VersionMetadata'
    KvV2Config:
      type: object
      properties:
        cas_required:
          type: boolean
          description: Whether check-and-set is required for all writes
        max_versions:
          type: integer
          description: Maximum number of versions to keep per key
        delete_version_after:
          type: string
          description: Duration after which versions are automatically deleted
  parameters:
    kvMountPath:
      name: mount
      in: path
      required: true
      description: Mount path for the secrets engine (e.g., secret, kv)
      schema:
        type: string
        default: secret
    secretPath:
      name: path
      in: path
      required: true
      description: Path to the secret within the secrets engine
      schema:
        type: string
  securitySchemes:
    vaultToken:
      type: apiKey
      in: header
      name: X-Vault-Token
      description: Vault authentication token
externalDocs:
  description: Vault Secrets Engines API Documentation
  url: https://developer.hashicorp.com/vault/api-docs/secret