---
schema_version: "1"
id: 6cf5292b08f47e0170e6b4b0d0240923286ff7b613c9d42b2c2af9372604643a
title: Deleting A Subscriber
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-apis/deleting_a_subscriber.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_subscriber.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 443d461e5bf8647a414eb0ce5a62c764db2e29c26482be2040b47feb43f414af
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# Deleting A Subscriber

Use this API call to delete a subscriber's information from your account.

You don't need to delete a subscriber in order to unsubscribe that subscriber from an email list.

When you delete a subscriber, your account also loses all tracking information related to that subscriber and a new instance of that subscriber could be added to lists from which that subscriber has previously unsubscribed. For this reason, we recommend that you unsubscribe subscribers rather than delete them.

Use these code examples to create your own API call.

## Sample .NET Code

```csharp
using System;
using System.Configuration;
using etAPI;
public partial class SubscriberDelete : System.Web.UI.Page
{
    //Global Variables
    private SoapClient client = new SoapClient();
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            Subscriber sub = new Subscriber();
            // Use one of the following to identify the subscriber
            sub.SubscriberKey = "12345"; // Preferred method
            sub.EmailAddress = "acruz@example.com";
            sub.ID = 123456789;
            try
            {
                string requestID = String.Empty;
                string status = String.Empty;
                DeleteResult[] results = null;
                //Call the Delete method on the Subscriber object
                results = client.Delete(null, new APIObject[] { sub }, out requestID, out status);
                //Display Results
                lblMessage.Text += "Overall Status: " + status;
                lblMessage.Text += "<br/>";
                lblMessage.Text += "Number of Results: " + results.Length;
                lblMessage.Text += "<br/>";
                //Loop through each object returned and display the StatusMessage
                foreach (DeleteResult result in results)
                {
                    lblMessage.Text += "Status Message: " + result.StatusMessage;
                    lblMessage.Text += "<br/>";
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text += "<br/><br/>UPDATE ERROR:<br/>" + ex.Message;
            }
        }
        catch (Exception exc)
        {
            lblMessage.Text += "<br/><br/>###ERROR<br/>" + exc.Message;
        }
    }
}
```

## Java (CXF) Code Example

```java
public void testDeleteSubscriber() throws RemoteException {
    try {
            Soap stub = init();
            Subscriber subscriber = new Subscriber();
            subscriber.setSubscriberKey("jdoe@example.com");
            DeleteRequest deleteRequest = new DeleteRequest();
            APIObject[] apiObjects = {subscriber};
            deleteRequest.getObjects().addAll(Arrays.asList(apiObjects));
            deleteRequest.setOptions(new DeleteOptions());
            DeleteResponse deleteResponse = stub.delete(deleteRequest);
            System.out.println("Deleted Subscriber ::: " + deleteResponse.getOverallStatus());
        } catch (Exception e) {
            e.printStackTrace();  //Change the exception body at File > Settings > File Templates.
    }
}
```

## Sample SOAP Envelope

```xml
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <Header>
          <fueloauth>YOUR_ACCESS_TOKEN</fueloauth>
     </Header>
     <Body>
          <DeleteRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
               <Objects xsi:type="Subscriber">
                    <PartnerKey xsi:nil="true"/>
                    <ObjectID xsi:nil="true"/>
                    <EmailAddress>example@example.com</EmailAddress>
               </Objects>
          </DeleteRequest>
     </Body>
</Envelope>
```

## Related Items

- _Salesforce Help_: [Delete a Subscriber](https://help.salesforce.com/s/articleView?id=mktg.mc_es_delete_subscriber.htm)
- [Unsubscriber Subscriber from an Email List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/unsubscribing_and_logging_an_unsubevent_with_a_logunsubevent_execute_call.md)
