POST/user/emails

Add email addresses to the authenticated user's account

Adds one or more email addresses to the authenticated user's account. Supply at least one address in emails; the request can also be a direct email string or array instead of an object. OAuth app tokens and personal access tokens (classic) need the user scope.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 body field

Email addresses to add. Send an object with an emails array, a direct array, or a single email string.

emailsarray<string>required
Adds one or more email addresses to your GitHub account. Must contain at least one email address. **Note:** Alternatively, you can pass a single email address or an `array` of emails addresses directly, but we recommend that you pass an object using the `emails` key.

6 status codes
201Returns an array of email objects, including each address and its primary, verified, and visibility values.
emailstringrequired
primarybooleanrequired
verifiedbooleanrequired
visibilitystringrequired
304Indicates that the resource has not changed.
401Returned when authentication is required but missing or invalid.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when access to the operation is forbidden.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the resource is not found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 401 is returned when authentication is missing or invalid. A 403 is returned when access is forbidden, including when an OAuth app token or personal access token (classic) lacks the user scope. A 404 indicates the resource was not found, and a 422 is returned when validation fails or the endpoint has been spammed; provide at least one address in emails when using the object form.