Skip to main content
Vault’s HTTP API provides a straightforward way to create, update, and manage policies. By sending a PUT request to the /v1/sys/policy/<name> endpoint along with a JSON payload, you can define or overwrite policy rules.

Create or Update a Policy

Use the following curl command to create or update a policy named webapp:
Using PUT on an existing policy will overwrite it. Always review the policy rules before applying.

payload.json Example

Below is a sample payload.json defining a policy with read, write, list, and delete permissions on kv/apps/webapp:
  • policy: Contains the HCL-like policy string.
  • path "kv/apps/webapp": Specifies the secrets path this policy governs.
  • capabilities: Lists allowed operations on that path.
Ensure payload.json is located in your current directory or provide an absolute path.
For advanced policy syntax, see the Vault Policy Documentation.

Next Steps & References

Watch Video