Puntos de conexión de la API de REST para correos electrónicos
La API de REST permite administrar direcciones de correo electrónico de usuarios autenticados.
Acerca de la administración de correo electrónico
Si una dirección URL de solicitud no incluye un parámetro {username}, la respuesta será para el usuario que ha iniciado sesión (y debe pasar la información de autenticación con la solicitud). Información privada adicional, como si un usuario tiene habilitada la autenticación en dos fases, se incluye cuando se autentica a través de OAuth con el user ámbito.
Set primary email visibility for the authenticated user
Sets the visibility for your primary email addresses.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Email addresses" user permissions (write)
Parámetros para "Set primary email visibility for the authenticated user"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
visibility string ObligatorioDenotes whether an email is publicly visible. Puede ser uno de los siguientes: |
http_status_code
| status_code | Descripción |
|---|---|
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
request_example
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/user/email/visibility \
-d '{"visibility":"private"}'Response
Status: 200[
{
"email": "[email protected]",
"primary": true,
"verified": true,
"visibility": "private"
}
]List email addresses for the authenticated user
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.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Email addresses" user permissions (read)
Parámetros para "List email addresses for the authenticated user"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Valor predeterminado: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Valor predeterminado: |
http_status_code
| status_code | Descripción |
|---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/user/emailsResponse
Status: 200[
{
"email": "[email protected]",
"verified": true,
"primary": true,
"visibility": "public"
}
]Add an email address for the authenticated user
OAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Email addresses" user permissions (write)
Parámetros para "Add an email address for the authenticated user"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
emails array of strings ObligatorioAdds 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 |
http_status_code
| status_code | Descripción |
|---|---|
201 | Created |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
code_samples
request_example
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/user/emails \
-d '{"emails":["[email protected]","[email protected]","[email protected]"]}'Response
Status: 201[
{
"email": "[email protected]",
"primary": false,
"verified": false,
"visibility": "public"
},
{
"email": "[email protected]",
"primary": false,
"verified": false,
"visibility": null
},
{
"email": "[email protected]",
"primary": false,
"verified": false,
"visibility": null
}
]Delete an email address for the authenticated user
OAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Email addresses" user permissions (write)
Parámetros para "Delete an email address for the authenticated user"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
emails array of strings ObligatorioEmail addresses associated with the GitHub user account. |
http_status_code
| status_code | Descripción |
|---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
code_samples
request_example
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/user/emails \
-d '{"emails":["[email protected]","[email protected]"]}'Response
Status: 204List public email addresses for the authenticated user
Lists your publicly visible email address, which you can set with the Set primary email visibility for the authenticated user endpoint.
OAuth app tokens and personal access tokens (classic) need the user:email scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Email addresses" user permissions (read)
allows_public_read_access
Parámetros para "List public email addresses for the authenticated user"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Valor predeterminado: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Valor predeterminado: |
http_status_code
| status_code | Descripción |
|---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/user/public_emailsResponse
Status: 200[
{
"email": "[email protected]",
"verified": true,
"primary": true,
"visibility": "public"
}
]