<@ULVA73B9P> is there a way to .save(name, overwri...
# ask-marvin
t
@Marvin is there a way to .save(name, overwrite=True) for a block via cli
m
thought for 172.2 seconds
Short answer: not currently. In Prefect 3.x there isn’t a CLI command that’s equivalent to calling
block.save(name, overwrite=True)
. The
prefect block
CLI supports listing, inspecting, deleting, generating a UI link to create, and registering block types—but not creating/updating block documents directly. Verified CLI commands: - List:
prefect block ls
- Inspect:
prefect block inspect <BLOCK_TYPE_SLUG>/<BLOCK_NAME>
- Delete:
prefect block delete <BLOCK_TYPE_SLUG>/<BLOCK_NAME>
- Create (generates UI link):
prefect block create <BLOCK_TYPE_SLUG>
- Register block types:
prefect block register -m <module> | -f <file.py>
Docs: CLI: prefect block Workarounds you can use today: - Python API (recommended for automation)
Copy code
from prefect.blocks.system import Secret

  # create or overwrite
  Secret(value="shh").save("my-secret", overwrite=True)

  # later update
  s = Secret.load("my-secret")
  s.value = "new-secret"
  s.save(overwrite=True)
Concepts: Blocks concepts - One-liner from your shell
Copy code
python -c "from prefect.blocks.system import Secret; Secret(value='shh').save('my-secret', overwrite=True)"
- REST API (if you need pure HTTP) - Create/update block documents via the server API - REST reference: Create Block Document and Update Block Document If you tell me which block type you’re managing, I can give you a ready-to-run snippet (or a small script) that mimics
save(..., overwrite=True)
.