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

# Delete activity logs (v2)

> Remove activity log records by documentId, targetEntityId, or activityId in an organization using the Velt v2 REST API for activity history cleanup.

Use this API to delete activity log records. At least one of `documentId`, `targetEntityId`, or `activityIds` is required.

# Endpoint

`POST https://api.velt.dev/v2/activities/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" required>
      Organization ID
    </ParamField>

    <ParamField body="documentId" type="string">
      Delete all activity logs associated with this document ID.
    </ParamField>

    <ParamField body="activityIds" type="string[]">
      Delete specific activity logs by ID.
    </ParamField>

    <ParamField body="targetEntityId" type="string">
      Delete all activity logs associated with this entity ID.
    </ParamField>
  </Expandable>
</ParamField>

<Warning>
  At least one of `documentId`, `targetEntityId`, or `activityIds` must be provided.
</Warning>

## **Example Requests**

#### 1. Delete by activityIds

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "activityIds": ["activity-001", "activity-002"]
  }
}
```

#### 2. Delete all activities for a document

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "documentId": "doc-456"
  }
}
```

#### 3. Delete all activities for a target entity

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "targetEntityId": "annotation-789"
  }
}
```

#### 4. Delete by documentId and targetEntityId

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "documentId": "doc-456",
    "targetEntityId": "annotation-789"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Activity(s) deleted successfully.",
    "data": {
      "activity-001": {
        "success": true,
        "message": "Activity deleted."
      }
    }
  }
}
```

#### When some activities are not found

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Activity(s) deleted successfully.",
    "data": {
      "activity-001": {
        "success": false,
        "message": "Failed to delete activity."
      },
      "activity-002": {
        "success": true,
        "message": "Activity deleted."
      }
    }
  }
}
```

#### Failure Response

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

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Activity(s) deleted successfully.",
      "data": {
        "activity-001": {
          "success": true,
          "message": "Activity deleted."
        }
      }
    }
  }
  ```
</ResponseExample>
