# Delete a watermark template by ID

DELETE https://services.leadconnectorhq.com/social-media-posting/{locationId}/watermarks/{templateId}

Soft-delete a watermark template. The template is marked as deleted and no longer applies at post-publish time, but the record is preserved in the database. Any accounts previously bound via `accountIds` are released and become eligible for other templates.

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

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

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | string | Yes | Watermark template ID |
| `locationId` | string | Yes | Location ID |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2023-02-21"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/social-media-posting/{locationId}/watermarks/{templateId}": {
      "delete": {
        "summary": "Delete a watermark template by ID",
        "operationId": "deleteAWatermarkTemplateById",
        "description": "Soft-delete a watermark template. The template is marked as deleted and no longer applies at post-publish time, but the record is preserved in the database. Any accounts previously bound via `accountIds` are released and become eligible for other templates.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          },
          {
            "name": "templateId",
            "required": true,
            "in": "path",
            "description": "Watermark template ID",
            "schema": {
              "example": "507f1f77bcf86cd799439011",
              "type": "string"
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location ID",
            "schema": {
              "example": "w37swmmLbA02zgqKPpxITe",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Watermark template successfully marked as deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatermarkTemplateResponseDTO"
                }
              }
            }
          },
          "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": [
          {
            "Location-Access": [
              "socialplanner/watermarks.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"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "WatermarkTemplateResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success or Failure",
            "example": true
          },
          "statusCode": {
            "type": "number",
            "description": "Status Code",
            "example": 201
          },
          "message": {
            "type": "string",
            "description": "Message",
            "example": "Created Watermark Image"
          },
          "results": {
            "description": "Requested Results",
            "example": {
              "_id": "665f1bac78fda9b6c5f48012",
              "watermarkImageUrl": "http://example.com/watermark.png",
              "position": "top-left",
              "scale": 0.5,
              "opacity": 0.7,
              "padding": true,
              "templateName": "DefaultTemplate",
              "locationId": "ve9EPM428h8vShlRW1KT",
              "createdBy": "Lx1EI6YIgQYMQi0ytFXv",
              "accountIds": [
                "507f1f77bcf86cd799439011",
                "507f1f77bcf86cd799439012"
              ],
              "deleted": false,
              "createdAt": "2024-07-24T10:21:00.123Z",
              "updatedAt": "2024-07-24T10:21:00.123Z"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "_id": {
                    "type": "string",
                    "description": "Template Id",
                    "example": "665f1bac78fda9b6c5f48012"
                  },
                  "watermarkImageUrl": {
                    "type": "string",
                    "description": "Watermark Image URL",
                    "example": "http://example.com/watermark.png"
                  },
                  "position": {
                    "type": "string",
                    "description": "Watermark position. Position can be one of the following values: top-left, top-center, top-right, left-center, center, right-center, bottom-left, bottom-center, bottom-right",
                    "enum": [
                      "top-left",
                      "top-right",
                      "bottom-left",
                      "bottom-right",
                      "center",
                      "top-center",
                      "bottom-center",
                      "left-center",
                      "right-center"
                    ],
                    "example": "top-left"
                  },
                  "scale": {
                    "type": "number",
                    "description": "Scale factor for watermark. scale value must be between 0 - 1",
                    "example": 0.5
                  },
                  "opacity": {
                    "type": "number",
                    "description": "Watermark opacity. opacity value must be between 0 - 1",
                    "example": 0.7
                  },
                  "padding": {
                    "type": "boolean",
                    "description": "Whether padding is applied around the watermark",
                    "example": true
                  },
                  "templateName": {
                    "type": "string",
                    "description": "Name of the watermark template",
                    "example": "DefaultTemplate"
                  },
                  "locationId": {
                    "type": "string",
                    "description": "Location ID this template belongs to",
                    "example": "ve9EPM428h8vShlRW1KT"
                  },
                  "createdBy": {
                    "type": "string",
                    "description": "User ID that created the template",
                    "example": "Lx1EI6YIgQYMQi0ytFXv"
                  },
                  "accountIds": {
                    "description": "Connected account IDs the template is bound to. These IDs map user accounts to this template at post-publish time. Use the [Get Accounts](./get-account) endpoint to look up account IDs.",
                    "example": [
                      "507f1f77bcf86cd799439011",
                      "507f1f77bcf86cd799439012"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "deleted": {
                    "type": "boolean",
                    "description": "Indicates whether template is soft deleted",
                    "example": false
                  },
                  "createdAt": {
                    "format": "date-time",
                    "type": "string",
                    "description": "Template created timestamp",
                    "example": "2024-07-24T10:21:00.123Z"
                  },
                  "updatedAt": {
                    "format": "date-time",
                    "type": "string",
                    "description": "Template updated timestamp",
                    "example": "2024-07-24T10:21:00.123Z"
                  }
                },
                "required": [
                  "_id",
                  "watermarkImageUrl",
                  "position",
                  "scale",
                  "opacity",
                  "padding",
                  "templateName",
                  "locationId",
                  "createdBy",
                  "accountIds",
                  "deleted"
                ],
                "title": "WatermarkTemplateSchema"
              }
            ]
          }
        },
        "required": [
          "success",
          "statusCode",
          "message"
        ],
        "title": "WatermarkTemplateResponseDTO"
      },
      "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"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const response = await ghl.socialMediaPosting.deleteAWatermarkTemplateById('<TEMPLATEID>', '<LOCATIONID>');
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

response = await client.socialMediaPosting.delete_a_watermark_template_by_id('<TEMPLATEID>', '<LOCATIONID>')
print(response)
```

**PHP** (`gohighlevel/api-client`)

```php
<?php
require_once 'vendor/autoload.php';

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$response = $ghl->socialMediaPosting->deleteAWatermarkTemplateById('<TEMPLATEID>', '<LOCATIONID>');
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X DELETE 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/watermarks/<templateId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21'
```

**Node.js**

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

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/<locationId>/watermarks/<templateId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/social-media-posting/{locationId}/watermarks/{templateId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2023-02-21"
}

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

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/watermarks/<templateId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .delete("https://services.leadconnectorhq.com/social-media-posting/<locationId>/watermarks/<templateId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/<locationId>/watermarks/<templateId>"
  req, _ := http.NewRequest("DELETE", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2023-02-21")

  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/social-media-posting/<locationId>/watermarks/<templateId>")

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

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

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2023-02-21"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/watermarks/<templateId>' -Method 'DELETE' -Headers $headers
$response | ConvertTo-Json
```
