POST
/user/gpg_keysCreate a GPG key for the authenticated user
Adds a GPG key to the authenticated user's GitHub account.
OAuth app tokens and personal access tokens (classic) need the write:gpg_key scope to use this endpoint.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
namestringoptional
A descriptive name for the new key.
armored_public_keystringrequired
A GPG key in ASCII-armored format.
201Response
idintegerrequired
namestringoptional
primary_key_idintegerrequired
key_idstringrequired
public_keystringrequired
emailsarray<object>required
subkeysarray<object>required
can_signbooleanrequired
can_encrypt_commsbooleanrequired
can_encrypt_storagebooleanrequired
can_certifybooleanrequired
created_atstringrequired
expires_atstringrequired
revokedbooleanrequired
raw_keystringrequired
304Not modified
401Requires authentication
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
Error handling
A 401 is returned: Requires authentication. A 403 is returned: Forbidden. A 404 is returned: Resource not found. A 422 is returned: Validation failed, or the endpoint has been spammed.
Was this helpful?