# Delete Note

DELETE https://services.leadconnectorhq.com/notes/{id}

Delete Note

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `notes.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | Yes | Note Id |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location Id |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/notes/{id}": {
      "delete": {
        "summary": "Delete Note",
        "operationId": "deleteNote",
        "description": "Delete Note",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Note Id",
            "schema": {
              "example": "ocQHyuzHvysMo5N5VsXc",
              "type": "string"
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location Id",
            "schema": {
              "example": "ocQHyuzHvysMo5N5VsXc",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCreateUpdateNoteSuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "notes.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetCreateUpdateNoteSuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "note": {
            "description": "The note object",
            "example": {
              "id": "HGPcayliwcdoUFzvbTok",
              "body": "lorem ipsum",
              "userId": "TUcmRxWrjqzJS8EjkxNK",
              "dateAdded": "2021-07-08T12:02:11.285Z",
              "title": "Follow-up summary",
              "color": "#FFAA00",
              "pinned": false
            },
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique identifier for the note",
                "example": "HGPcayliwcdoUFzvbTok"
              },
              "body": {
                "type": "string",
                "description": "The body content of the note",
                "example": "lorem ipsum"
              },
              "userId": {
                "type": "string",
                "description": "The ID of the user who created the note",
                "example": "TUcmRxWrjqzJS8EjkxNK"
              },
              "dateAdded": {
                "type": "string",
                "description": "The date and time when the note was created",
                "example": "2021-07-08T12:02:11.285Z"
              },
              "contactId": {
                "type": "string",
                "description": "The ID of the contact associated with the note. Present only when the note is attached to a contact — notes on custom object records are linked through `relations`.",
                "example": "TUcmRxWrjqzJS8EjkxNK"
              },
              "businessId": {
                "type": "string",
                "description": "The ID of the business associated with the note. Present only when the note is attached to a business — notes on custom object records are linked through `relations`.",
                "example": "TUcmRxWrjqzJS8EjkxNK"
              },
              "title": {
                "type": "string",
                "description": "The title of the note",
                "example": "Follow-up summary"
              },
              "color": {
                "type": "string",
                "description": "The color code of the note",
                "example": "#FFAA00"
              },
              "pinned": {
                "type": "boolean",
                "description": "Whether the note is pinned",
                "example": false
              },
              "attachments": {
                "description": "List of attachments associated with the note",
                "example": [
                  {
                    "id": "att_1",
                    "objectKey": "custom_objects.pet",
                    "recordId": "632c34b4c9b7da3358ac9891"
                  }
                ],
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique identifier for the attachment",
                      "example": "att_1"
                    },
                    "objectKey": {
                      "type": "string",
                      "description": "Object type the note is attached to — a custom object schema key (e.g. \"custom_objects.pet\"), or a standard object key such as \"contact\" or \"business\".",
                      "example": "custom_objects.pet"
                    },
                    "recordId": {
                      "type": "string",
                      "description": "Id of the record to attach the note to. Available on the Record details page under the 3 dots or in the url.",
                      "example": "632c34b4c9b7da3358ac9891"
                    }
                  },
                  "title": "AttachmentSchema"
                }
              }
            },
            "title": "GetNoteSchema"
          }
        },
        "title": "GetCreateUpdateNoteSuccessfulResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X DELETE 'https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'DELETE',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/notes/{id}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "locationId": "<LOCATIONID>"
}

response = requests.delete(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .delete("https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>"
  req, _ := http.NewRequest("DELETE", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/notes/<id>?locationId=<LOCATIONID>' -Method 'DELETE' -Headers $headers
$response | ConvertTo-Json
```
