invalid_public_key
HTTP 422 Public key is not a valid WireGuard key
What happened
The public key has the right shape - 44 characters of base64 - but is not a canonical WireGuard key (its last character carries bits a real key never has). A key of any other length or alphabet is refused earlier as invalid_request naming the public_key field.
What to do
Send the public key exactly as `wg pubkey` prints it and repeat with a new idempotency key.
Retrying
Fix the request and send it again.
How it arrives
{
"type": "https://docs.fiberax.com/errors/invalid_public_key",
"title": "Public key is not a valid WireGuard key",
"status": 422,
"code": "invalid_public_key",
"request_id": "a277dcd1ca652c65"
}
Branch your code on code, never on the wording of title.