# delete\_\_settings\_user

`DELETE /settings/user`

*Delete Specific User Settings Keys*

Delete specific keys from the current user's settings. This endpoint removes only the specified settings keys while preserving all other settings. The user must be authenticated.

#### Request Body Schema <a href="#delete__settings_user-requestbodyschema" id="delete__settings_user-requestbodyschema"></a>

| Name    | Type   | Required | Restrictions | Description                     |
| ------- | ------ | -------- | ------------ | ------------------------------- |
| » keys  | array  | true     | none         | Array of setting keys to delete |
| »» keys | string | true     | none         | Setting key to delete           |

#### TypeScript Client Library

```typescript
// Using the Flashback TypeScript client
import { FlashbackClient } from '@flashback/client';

const client = new FlashbackClient({ accessToken: 'your-access-token' });

// Delete specific user setting keys
try {
  const result = await client.settings.user.delete({
    keys: ['theme', 'notifications.push']
  });
  console.log('User settings keys deleted:', result);
} catch (error) {
  console.error('Failed to delete user settings keys:', error);
}
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X DELETE https://backend.flashback.tech/settings/user \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}' \
  -H 'Content-Type: application/json' \
  -d '{
    "keys": ["theme", "notifications.push"]
  }'
```

{% endtab %}

{% tab title="HTTP" %}

```http
DELETE https://backend.flashback.tech/settings/user HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
Content-Type: application/json

{
  "keys": ["theme", "notifications.push"]
}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}',
  'Content-Type':'application/json'
};

const body = {
  "keys": ["theme", "notifications.push"]
};

fetch('https://backend.flashback.tech/settings/user',
{
  method: 'DELETE',
  headers: headers,
  body: JSON.stringify(body)
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}',
  'Content-Type' => 'application/json'
}

body = {
  "keys" => ["theme", "notifications.push"]
}

result = RestClient.delete 'https://backend.flashback.tech/settings/user',
  body.to_json, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}',
  'Content-Type': 'application/json'
}

body = {
  "keys": ["theme", "notifications.push"]
}

r = requests.delete('https://backend.flashback.tech/settings/user', 
                    headers=headers, 
                    data=json.dumps(body))

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
    'Content-Type' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array(
    'keys' => array(
        'theme',
        'notifications.push'
    )
);

try {
    $response = $client->request('DELETE','https://backend.flashback.tech/settings/user', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/settings/user");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
con.setRequestProperty("Content-Type", "application/json");

String jsonInputString = "{\"keys\":[\"theme\",\"notifications.push\"]}";

con.setDoOutput(true);
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonInputString.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "encoding/json"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
        "Content-Type": []string{"application/json"},
    }

    body := map[string]interface{}{
        "keys": []string{
            "theme",
            "notifications.push",
        },
    }

    jsonData, _ := json.Marshal(body)
    data := bytes.NewBuffer(jsonData)
    req, err := http.NewRequest("DELETE", "https://backend.flashback.tech/settings/user", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Example responses

> 200 Response

```json
{
  "success": true,
  "message": "User settings keys deleted successfully"
}
```

> 400 Response

```json
{
  "success": false,
  "message": "Keys array is required and must not be empty"
}
```

> 500 Response

```json
{
  "success": false,
  "message": "Internal server error",
  "error": "Database connection failed"
}
```

#### Responses <a href="#delete__settings_user-responses" id="delete__settings_user-responses"></a>

| Status | Meaning                                                                    | Description                                   | Schema |
| ------ | -------------------------------------------------------------------------- | --------------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | User settings keys deleted successfully       | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)           | Invalid request (missing or empty keys array) | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal server error                         | Inline |

#### Response Schema <a href="#delete__settings_user-responseschema" id="delete__settings_user-responseschema"></a>

Status Code **200**

| Name      | Type    | Required | Restrictions | Description                              |
| --------- | ------- | -------- | ------------ | ---------------------------------------- |
| » success | boolean | true     | none         | Indicates if the request was successful  |
| » message | string  | true     | none         | Success message describing the operation |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description                        |
| --------- | ------- | -------- | ------------ | ---------------------------------- |
| » success | boolean | true     | none         | Always false for error responses   |
| » message | string  | true     | none         | Error message describing the issue |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description                           |
| --------- | ------- | -------- | ------------ | ------------------------------------- |
| » success | boolean | true     | none         | Always false for error responses      |
| » message | string  | true     | none         | Error message describing the issue    |
| » error   | string  | false    | none         | Additional error details if available |

#### DTOs

**DeleteSettingsRequest**

```typescript
export interface DeleteSettingsRequest {
  keys: string[];
}
```

**SettingsErrorResponse**

```typescript
export interface SettingsErrorResponse {
  success: false;
  message: string;
  error?: string;
}
```
