# Delete Note

<mark style="color:red;">`DELETE`</mark> `/v2/finplus/debtmanagement/debtornotes/notes/{id}`

Use this endpoint to **delete a debtor note** for a specified school.&#x20;

The **note ID** must be included in the URL and can be found using the [Get Note(s)](https://apidocs.d6plus.co.za/v2/reference/finance+/debt-management/debtor-notes/get-note-s) call.

To restore a deleted debtor not, refer to the [Update Note](https://apidocs.d6plus.co.za/v2/reference/finance+/debt-management/debtor-notes/update-note) page.

### Path Parameters

<table><thead><tr><th width="189.257080078125">Name</th><th width="162.57147216796875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>{id}</code><mark style="color:red;">*</mark></td><td>Integer</td><td>The <strong>Note ID</strong> of the debtor note to delete</td></tr></tbody></table>

### Request Headers

<table><thead><tr><th width="204.7713623046875">Name</th><th width="117.028564453125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>HTTP-X-USERNAME</code><mark style="color:red;">*</mark></td><td>String</td><td>As provided by d6</td></tr><tr><td><code>HTTP-X-PASSWORD</code><mark style="color:red;">*</mark></td><td>String</td><td>As provided by d6</td></tr><tr><td><code>HTTP-X-SCHOOLID</code><mark style="color:red;">*</mark></td><td>Integer</td><td>The unique identifier of the school for which the data is being queried.</td></tr></tbody></table>

### Response Examples

{% tabs %}
{% tab title="Success (200 OK)" %}
**Status:** <mark style="color:green;">`200 OK`</mark>

```json
{
    "status": "Deleted"
}
```

{% endtab %}

{% tab title="ID Missing Error (400 Bad Request)" %}
**Description:** When the note ID was not included in the URL.

**Status:** <mark style="color:red;">`400 Bad Request`</mark>

```json
{
    "success": false,
    "message": "The Note ID is required"
}
```

{% endtab %}

{% tab title="ID Not Found Error (404 Not Found)" %}
**Description:** When the note ID provided does not exist or has already been deleted.

**Status:** <mark style="color:red;">`404 Not Found`</mark>

```json
{
    "success": false,
    "message": "The note does not exist or has already been deleted."
}
```

{% endtab %}
{% endtabs %}

### Code Samples

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

```php
<?php

// API Credentials
$api_username = 'your_username';
$api_password = 'your_password';
$school_id = 'the_school_id';

// Note ID to be deleted (required)
$note_id = '12345'; // Replace with the actual note ID

// API Endpoint
define('BASE_URL', 'https://integrate.d6plus.co.za/api/v2/finplus/debtmanagement/debtornotes/notes');

$url = BASE_URL . '/' . $note_id;

// Initialize cURL
$curl = curl_init();

// Set cURL options
curl_setopt_array($curl, [
    CURLOPT_URL            => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 30,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION   => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST  => 'DELETE',
    CURLOPT_HTTPHEADER     => [
        "HTTP-X-USERNAME: $api_username",
        "HTTP-X-PASSWORD: $api_password",
        "HTTP-X-SCHOOLID: $school_id"
    ],
]);

// Execute request
$response = curl_exec($curl);

// Check for errors
$error = curl_error($curl);
if ($error) {
    curl_close($curl);
    throw new Exception("cURL Error: $error");
}

// Close cURL and output response
curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="cURL" %}

```bash
curl --request DELETE 'https://integrate.d6plus.co.za/api/v2/finplus/debtmanagement/debtornotes/notes/{note_id}' \
     --header 'HTTP-X-USERNAME: your_username' \
     --header 'HTTP-X-PASSWORD: your_password' \
     --header 'HTTP-X-SCHOOLID: the_school_id'
```

{% endtab %}
{% endtabs %}
