# Account Delete

## **Account Delete and Verification**

The Account Delete and Verification allows users to initiate the account deletion process, through a website link which includes username, phone number, country which are autofilled and a reason for deletion which should be selected by users from dropdown and an API to check account deletion status. It's an essential feature for users who wish to permanently delete their accounts from the e-commerce platform. &#x20;

<figure><img src="https://3686328336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fd1Iq7THDAagTQzeC9rTN%2Fuploads%2FGJQWtD1z36rVh4OV9BD9%2Fimage.png?alt=media&#x26;token=de6ae960-724f-4af4-b614-313f6a426aef" alt=""><figcaption><p><strong>Delete option in Profile</strong></p></figcaption></figure>

### **Account Deletion Link**&#x20;

When a user requests to delete their account, you can generate a unique URL that includes a bearer token as a query parameter. The bearer token should be used for authentication to verify the user's identity.

Example Account Deletion Link:

```arduino
https://dev.majarat.ae/customer/account-deletion?bearer_token=YOUR_BEARER_TOKEN_HERE
```

### **User Account Verification Page**&#x20;

When the user opens the account deletion link, they should be directed to a verification page. This page can display the following information, Name, phone number and country will be autofilled based on the user's account details user need to select reason for deletion from the dropdown box:

<figure><img src="https://3686328336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fd1Iq7THDAagTQzeC9rTN%2Fuploads%2FbTe8JReVRqjIu13hB65G%2Fimage.png?alt=media&#x26;token=9b543ae3-efb5-4d3e-829f-091283749ec3" alt=""><figcaption><p><strong>Account Deletion page</strong></p></figcaption></figure>

* Username
* Phone Number
* Country
* Reason for Deletion (Options)
  * I am not using this account anymore
  * I have another account
  * Account security concerns/Unauthorized activity
  * Privacy concerns
  * I do not want to provide a reason

### **API for Account Verification**

This API endpoint accepts a bearer token as authentication also user's bearer token should be included in the request header. This API should verify if the user's account has been deleted successfully or not based on the provided bearer token. It can return a success message if the account has been deleted, or an error message if not.

###

###

###

### **Endpoint**

* `{{baseurl}}/api/v1/customer/account-delete`

### **Method**

* **POST**

### **Authorization**&#x20;

The API requires a valid bearer token in the request header for authentication. Users must include their token in the "Authorization" header to access their account.

### **Request Body**

The request body should include bearer token of user.

```json
{
    "token": "USER_BEARER_TOKEN_HERE"
    }
```

### **Response Format**

The API responds with a JSON object indicating the status of the user account.

<pre class="language-json"><code class="lang-json"><a data-footnote-ref href="#user-content-fn-1">Positive feedback</a>
{

    "success": true,

    "message": "User exists",

    "status_code": 200

}

<a data-footnote-ref href="#user-content-fn-1">Negative feedback</a>
{
    "success": false,
    "message": "User not exists",
    "status_code": 400
}
</code></pre>

By following these steps, you can allow users to request account deletion using a unique link with a bearer token for authentication. The API can then verify if the account deletion was successful. Remember to implement security measures to protect the bearer tokens and ensure that only authorized users can access the deletion and verification processes.

[^1]:
