> ## Documentation Index
> Fetch the complete documentation index at: https://velt-v6-0-0-beta-12.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Comment Annotations

Use this API to delete comment annotations from a document within an organization.
Additional filters can be applied using location IDs, annotation IDs, or user IDs — plus the agent filters (`agentId`, `agentSuggestions`, `agentUrls`) to scope the delete to agent-authored annotations.

# Endpoint

`POST https://api.velt.dev/v2/commentannotations/delete`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string">
      Organization ID
    </ParamField>

    <ParamField body="documentId" type="string" required>
      Document ID
    </ParamField>

    <ParamField body="locationIds" type="string[]">
      Array of Location IDs
    </ParamField>

    <ParamField body="annotationIds" type="string[]">
      Array of Annotation IDs
    </ParamField>

    <ParamField body="userIds" type="string[]">
      Array of User IDs
    </ParamField>

    <ParamField body="agentId" type="string">
      Narrows the delete to annotations authored by this agent. Non-empty when provided.
    </ParamField>

    <ParamField body="agentSuggestions" type="boolean">
      When `true`, narrows the delete to fresh (still-pending) agent suggestions only. Accepted suggestions are not matched.
    </ParamField>

    <ParamField body="agentUrls" type="string[]">
      Non-empty array of page URLs. Narrows the delete to agent annotations stamped for any of the supplied pages (annotations created before URL stamping existed are never matched).
    </ParamField>
  </Expandable>
</ParamField>

<Note>
  **Agent filters (V2 only, combinable).** Unlike the [Get Comment Annotations](/api-reference/rest-apis/v2/comments-feature/comment-annotations/get-comment-annotations-v2) agent filters (one per request), the delete filters are **AND-combined**: `agentId` + `agentSuggestions` + `agentUrls` deletes only that agent's still-pending suggestions on those page(s); each alone deletes all suggestions / all of that agent's annotations / all agent annotations for those pages respectively. They also intersect with `annotationIds` when both are supplied.

  Agent filters require the workspace to have advanced queries enabled — otherwise the request fails with `NOT_FOUND` (`Advanced queries are not enabled...`) rather than falling back to a document-wide delete. If none of the supplied `agentUrls` resolve to a valid page (e.g. blank or fragment-only URLs), the request fails with `INVALID_ARGUMENT` instead of widening the delete scope.
</Note>

## **Example Requests**

#### 1. Delete annotations by organizationId and documentId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId"
  }
}
```

#### 2. Delete annotations by organizationId, documentId and locationIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "locationIds": [
      "locationx"
    ]
  }
}
```

#### 3. Delete annotations by organizationId, documentId, locationIds and userIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "locationIds": [
      "locationx"
    ],
    "userIds": [
      "yourUserId"
    ]
  }
}
```

#### 4. Delete annotations by organizationId, documentId and userIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "userIds": [
      "yourUserId"
    ]
  }
}
```

#### 5. Delete annotations by organizationId, documentId and annotationIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "annotationIds": [
      "yourAnnotationId1",
      "yourAnnotationId2"
    ]
  }
}
```

#### 6. Delete annotations by organizationId, documentId, locationIds and annotationIds

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "locationIds": [
      "locationx"
    ],
    "annotationIds": [
      "yourAnnotationId1",
      "yourAnnotationId2"
    ]
  }
}
```

#### 7. Delete annotations by documentId. This will work if the document was created without an organization.

```JSON theme={null}
{
  "data": {
    "documentId": "yourDocumentId"
  }
}
```

#### 8. Delete annotations by documentId and locationIds. This will work if the document was created without an organization.

```JSON theme={null}
{
  "data": {
    "documentId": "yourDocumentId",
    "locationIds": [
      "locationx"
    ]
  }
}
```

#### 9. Delete annotations by documentId and userIds. This will work if the document was created without an organization.

```JSON theme={null}
{
  "data": {
    "documentId": "yourDocumentId",
    "userIds": [
      "yourUserId"
    ]
  }
}
```

#### 10. Delete annotations by documentId and annotationIds. This will work if the document was created without an organization.

```JSON theme={null}
{
  "data": {
    "documentId": "yourDocumentId",
    "annotationIds": [
      "yourAnnotationId1",
      "yourAnnotationId2"
    ]
  }
}
```

#### 11. Delete annotations by documentId, locationIds, and userIds. This will work if the document was created without an organization.

```JSON theme={null}
{
  "data": {
    "documentId": "yourDocumentId",
    "locationIds": [
      "locationx"
    ],
    "userIds": [
      "yourUserId"
    ]
  }
}
```

#### 12. Delete annotations by documentId, locationIds, and annotationIds. This will work if the document was created without an organization.

```JSON theme={null}
{
  "data": {
    "documentId": "yourDocumentId",
    "locationIds": [
      "locationx"
    ],
    "annotationIds": [
      "yourAnnotationId1",
      "yourAnnotationId2"
    ]
  }
}
```

#### 13. Delete an agent's still-pending suggestions for specific pages

Combines the agent filters (AND semantics): only annotations authored by `spell-check` that are still pending suggestions and stamped for one of the listed pages are deleted.

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "agentId": "spell-check",
    "agentSuggestions": true,
    "agentUrls": [
      "https://example.com/pricing"
    ]
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Annotations deleted successfully.",
    "data": {
      "yourAnnotationId1": {
        "success": true,
        "id": "yourAnnotationId",
        "message": "Deleted Successfully"
      },
      "yourAnnotationId2": {
        "success": false,
        "id": "yourAnnotationId2",
        "message": "Annotation not found."
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Annotations deleted successfully.",
      "data": {
        "yourAnnotationId": {
          "success": true,
          "id": "yourAnnotationId",
          "message": "Deleted Successfully"
        }
      }
    }
  }
  ```
</ResponseExample>
