Skip to main content
The REST API is now versioned. For more information, see "About API versioning."

Emails

Use the REST API to manage email addresses of authenticated users.

About email administration

If a request URL does not include a {username} parameter then the response will be for the signed-in user (and you must pass authentication information with your request). Additional private information, such as whether a user has two-factor authentication enabled, is included when authenticated through Basic Authentication or OAuth with the user scope.

Set primary email visibility for the authenticated user

Sets the visibility for your primary email addresses.

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Body parameters
Name, Type, Description
visibilitystringRequired

Denotes whether an email is publicly visible.

Can be one of: public, private

HTTP response status codes

Status codeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Code samples

patch/user/email/visibility