[#wallet-DescriptorScriptPubKeyMan-GetKey] = xref:wallet.adoc[wallet]::xref:wallet/DescriptorScriptPubKeyMan.adoc[DescriptorScriptPubKeyMan]::GetKey :relfileprefix: ../../ :mrdocs: Retrieve the particular key if it is available. Returns nullopt if the key is not in the wallet, or if the wallet is locked. == Synopsis Declared in `<wallet/scriptpubkeyman.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[requires_capability(0x7f2e1dcac758), requires_capability(0x7f2e111ba978), requires_capability(0x7f2e15ef1938), requires_capability(0x7f2e23730798), requires_capability(0x7f2e26613358), requires_capability(0x7f2e2357e248)]] std::optional<CKey> GetKey(xref:CKeyID.adoc[CKeyID] const& keyid) const; ---- == Return Value The private key, or nullopt if it is unavailable or the wallet is locked. == Parameters [cols="1,4"] |=== | Name| Description | *keyid* | The key id to retrieve. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#