Can the CLI be used to retrieve the notes or a custom field of an item?

I would like to be able to access the notes field or a custom field using the BitWarden CLI. Is this possible in some fashion I haven’t found in the documentation?

Yes it is possible, but also keep in mind that its functionality is aimed to users that are comfortable with a terminal.

Depending on the OS you’re working with there’s options for you to automate. For example (sorry if it feels like an ad, is not) I wrote a small app around the CLI to have KeePass-like functionality around Bitwarden.

Anyway, your best bet is if you pair the CLI with a scripting language or at very least a querying tool like jq. If you need further information or examples, please let me know.

Yes, please send the details of the script.

Which OS you work with?

4 x MacOS, 2 x Linux, 2 x Windows, 3 x Android

Oops, I guess Android doesn’t count!

Since I was asking about using the CLI, it is probably reasonable to assume I am comfortable with using a terminal. When I use bw get item <item-id> for an item which has a notes field entry, it always returns “null” for the notes field. Further, custom fields do not appear at all. So, since you say it is possible, please share how one does it.

@Kevin-Buchs

Perhaps I’m not that reasonable, given the fact that I employ a lot of my free time trying to help people on the internet… but hey! It is what it is.

This ID actually has notes, piping it though jq works like a charm.

bw get item f8bd7c65-6be7-4ec0-ac85-ad49009f923d | jq .notes

When you query an ID without notes it returns null. Since you’re comfortable with a terminal you can write alias/functions (depending on your OS/Shell) in order to automate further.

Good luck!

@dh024

I don’t know if you’re being serious or just trying something. I’ve seen that you’re a very active member of the forums and your answers doesn’t seem to be the ones from a newbie. Also having 8 computers, 6 of which uses *nix and specifically 2 with Linux means that you’re by no means a regular Joe.

If this is meant to be a pissing contest I forfeit, I’m glad just trying to help people. If you just wanted to let me know your economical situation is in good shape, from the bottom of my heart I congratulate you, hope everything keeps the same and even better.

If you’re serious, then excuse me. As every other human being in the planet I do make mistakes.


Given the fact that you have a complex ecosystem the best you can do is find a balance between them, that won’t be so easily accomplished without resorting to a scripting language at the very least (a programming language is the best option but also has the drawback of being time consuming and you need more than the light background needed for just scripting).

If you ever done Web (which is fairly common nowadays) you’re familiar with JavaScript and probably with something like PHP, Python or Ruby… that’s where this is headed. All of them are good choices and pretty much transparent in its usage, even in Windows.

As an example we’re gonna use PHP (if you already know JS, node should pose no problem):

  • macOS: use brew to install.
  • Linux: package manager of the distro.
  • Windows: here are some instructions.

If you’re not comfortable working with a scripting language, you can fallback to the more basic shell, it will be a breeze to get a WSL in Windows if you haven’t, my personal recommendation is Alpine as is super light (just watch out, uses busybox rather than GNU utils, meaning POSIX syntax). That is just not to write stuff for macOS/Linux and a Windows counterpart, whatever you write will work for the 3 OS’.

Now the BW CLI is somewhat limited but still can do a lot, depending on what you’re trying to accomplish are the following steps. The question is, what you want and how many time are you willing to spend working for it?

I’d say that you open a new thread where we can follow, since this has diverted from the OP. If you were just playing, please don’t reply.

Hey, @anonymous1184. I just legitimately wanted to see your code. Not sure what triggered the response I received, but I genuinely didn’t think I was asking anything offensive.

In which case I truly apologize, I saw you as a very capable individual and the request got me confused as weather it was real.

I do use Linux but only in VMs, which means CLI only. My main OS is Windows because of my job and macOS because most of what I do needs to run in it.

That said, I don’t have anything in particular and that’s why I asked what you wanted to achieve and a preference of language (I happen to have worked with the ones I spoke and some others as well in case you have other option).

What I do have is a small app written in AutoHotkey that provides a system-wide auto-type, it borrows lots of ideas and functionality from KeePass, the code is in GitHub if you’re interested in how to actually parse the JSON coming from the CLI.

If you want to learn something on that regard, hit me via PM. I even have talked via Discord with some users in the Subreddit of AutoHotkey to give them pointers on how and what the code does as is around a 1000 lines of code (libraries excluded).

Granted, there’s a lot of functionality baked into that application. However if we narrow the what you want to achieve with the CLI I can give you pointers an examples depending on the language of your preference.

Good luck and again, sorry for the misunderstanding.

No worries, man - all good. And thanks for sharing your app/Github page. I have not heard of AutoHotkey, to be honest, but I will certainly have a look when I get the chance.

BTW, thanks for the tip about using jq - I hadn’t used that before, but it is really handy.

And to respond back to the OP, I did get a chance to check for custom fields in the CLI, and I can access notes and custom fields no problem (look for the keys “notes” and “fields” in the JSON data returned by the list or get item commands).