Skip to main content

emails

Creates, updates, deletes, gets or lists an emails resource.

Overview​

Nameemails
TypeResource
Idgithub.users.emails

Fields​

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
emailstring (email) (example: octocat@github.com)
primaryboolean
verifiedboolean
visibilitystring (example: public)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_emails_for_authenticated_userselectper_page, pageLists all of your email addresses, and specifies which one is visible
to the public.

OAuth app tokens and personal access tokens (classic) need the user:email scope to use this endpoint.
add_email_for_authenticated_userinsertemailsOAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.
set_primary_email_visibility_for_authenticated_userupdatevisibilitySets the visibility for your primary email addresses.
delete_email_for_authenticated_userdeleteOAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples​

Lists all of your email addresses, and specifies which one is visible
to the public.

OAuth app tokens and personal access tokens (classic) need the user:email scope to use this endpoint.

SELECT
email,
primary,
verified,
visibility
FROM github.users.emails
WHERE per_page = '{{ per_page }}'
AND page = '{{ page }}'
;

INSERT examples​

OAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.

INSERT INTO github.users.emails (
emails
)
SELECT
'{{ emails }}' /* required */
RETURNING
email,
primary,
verified,
visibility
;

UPDATE examples​

Sets the visibility for your primary email addresses.

UPDATE github.users.emails
SET
visibility = '{{ visibility }}'
WHERE
visibility = '{{ visibility }}' --required
RETURNING
email,
primary,
verified,
visibility;

DELETE examples​

OAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.

DELETE FROM github.users.emails
;