Skip to content

JSON Output

Cristhian Melo edited this page Jul 20, 2026 · 1 revision

JSON Output

All read commands accept --json. Use this for scripts, launchers (Raycast, Vicinae), and CI pipelines.

rpass show <entry> --json

{
  "entry": "email/work",
  "password": "s3cr3t",
  "fields": [
    { "name": "username", "value": "alice" },
    { "name": "url", "value": "https://mail.example.com" }
  ],
  "otp": null,
  "extra_lines": []
}
Field Description
password First line of the decrypted entry
fields name: value lines
otp Present if the entry has an otpauth:// URI
extra_lines Lines that are not name: value and not otpauth://

rpass otp <entry> --json

{
  "entry": "email/work",
  "otp": "123456",
  "period": 30,
  "expires_in": 14
}

rpass list --json

{
  "entries": [
    "email/work",
    "email/personal",
    "bank/checking"
  ]
}

rpass init --json

{
  "path": ".gpg-id",
  "recipients": ["you@example.com"],
  "removed": false
}

rpass recipients --json

{
  "path": ".gpg-id",
  "recipients": ["you@example.com", "teammate@example.com"]
}

Errors

On failure, rpass exits with a non-zero code and writes to stderr:

{
  "error": {
    "code": "gpg_decrypt_failed",
    "message": "gpg: decryption failed: No secret key"
  }
}

Error codes

Code Meaning
store_not_found Store directory does not exist
entry_not_found Requested entry does not exist
gpg_not_found gpg binary not found
gpg_passphrase_required GPG needs a passphrase; use --passphrase-stdin
gpg_decrypt_failed GPG decryption failed (wrong key, corrupt file)
gpg_encrypt_failed GPG encryption failed
gpg_id_not_found No .gpg-id file found for the entry
recipient_not_found Recipient not in .gpg-id
otp_not_found Entry has no otpauth:// line
entry_already_exists Use --force to overwrite
invalid_entry_name Entry name contains invalid characters

Non-interactive use

printf 'my-passphrase\n' | rpass show email/work --json --passphrase-stdin
printf 'my-passphrase\n' | rpass otp email/work --json --passphrase-stdin

The passphrase is read from stdin before GPG is invoked. Combine with jq for scripting:

PASSWORD=$(printf 'passphrase\n' | rpass show email/work --json --passphrase-stdin | jq -r '.password')

Clone this wiki locally