Emails

Management of email addresses via the API requires that you are authenticated through basic auth or OAuth with the user scope.

List email addresses for a user

GET /user/emails

This endpoint is accessible with the user:email scope.

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "email": "octocat@github.com",
    "verified": true,
    "primary": true
  }
]

Add email address(es)

If your GitHub Enterprise appliance has LDAP Sync enabled and the option to synchronize emails enabled, this API is disabled and will return a 403 response. Users managed in LDAP won’t be able to add an email address via the API with these options enabled.

POST /user/emails

Input

You can post a single email address or an array of addresses:

[
  "octocat@github.com",
  "support@github.com"
]

Response

Status: 201 Created
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "email": "octocat@github.com",
    "primary": false,
    "verified": false
  },
  {
    "email": "support@github.com",
    "primary": false,
    "verified": false
  }
]

Delete email address(es)

If your GitHub Enterprise appliance has LDAP Sync enabled and the option to synchronize emails enabled, this API is disabled and will return a 403 response. Users managed in LDAP won’t be able to remove an email address via the API with these options enabled.

DELETE /user/emails

Input

You can include a single email address or an array of addresses:

[
  "octocat@github.com",
  "support@github.com"
]

Response

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999