# Is there a way to change or delete the secondary email

**URL:** https://meta.discourse.org/t/is-there-a-way-to-change-or-delete-the-secondary-email/162933
**Category:** Development
**Created:** [September 3, 2020, 2:39pm UTC](https://meta.discourse.org/t/is-there-a-way-to-change-or-delete-the-secondary-email/162933 "2020-09-03T14:39:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mpemburn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpemburn/32/178585_2.png) [@mpemburn](https://meta.discourse.org/u/mpemburn)
#### Post date: [September 3, 2020, 2:39pm UTC](https://meta.discourse.org/t/is-there-a-way-to-change-or-delete-the-secondary-email/162933/1 "2020-09-03T14:39:45Z")

</div>

Hi,

I searched here and in the API docs, but I can’t see any way to affect the secondary email. My primary need is to delete it, but we may want to change it as some point.

Thanks in advance,

Mark

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 3, 2020, 5:06pm UTC](https://meta.discourse.org/t/is-there-a-way-to-change-or-delete-the-secondary-email/162933/2 "2020-09-03T17:06:03Z")

</div>

The easiest way to figure out how to make an API request to remove the secondary email would be to create a test user with a secondary email address, then remove the email address through the UI with your browser’s inspector opened to its Network tab. That method is outlined here: [How to reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576).

It looks like you need to make a `DELETE` request to `/u/<discourse_username>/preferences/email.json`

The email you are wanting to delete should be passed as form data. For example, `email=simon%40foo.com`

---

<div class="post-metadata">

### Author: ![mpemburn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpemburn/32/178585_2.png) [@mpemburn](https://meta.discourse.org/u/mpemburn)
#### Post date: [September 3, 2020, 6:06pm UTC](https://meta.discourse.org/t/is-there-a-way-to-change-or-delete-the-secondary-email/162933/3 "2020-09-03T18:06:52Z")

</div>

Thanks Simon,

I actually knew this, but for some reason, I hit the wrong “wrench” on the User Profile, and it didn’t show me the delete option. Once had the correct option I inspected it found what I needed. I tried it in Postman, it worked!

The curl for this is:

```
curl --location --request DELETE 'https://[discourse_url]/u/[discourse_user_name]/preferences/email.json?email=[address_to_delete]' \
--header 'Api-Key: [your_api_key]' \
--header 'Api-Username: system' \
--header 'Content-Type: application/json' 

```

**Updated to add** : Don’t forget to URL encode the email address. The API will respond with “success”: “OK”, but it won’t actually delete the address if you don’t do this.

Mark
