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

# Detach Comment

Use this API to detach a person's comment from the check it was [attached](https://velt.dev/docs/api-reference/rest-apis/v2/agents/checks/comments/attach.md) to. The comment's `checkInfo` is removed and the check's counts are updated. The comment itself, its status and its replies are not changed.

# Endpoint

`POST https://api.velt.dev/v2/agents/checks/comments/detach`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**organizationId** `string` *required*

1 to 512 characters. The organization of the project.

**documentId** `string` *required*

1 to 512 characters. The document of the project.

**annotationId** `string` *required*

The attached comment's annotation id. 1 to 512 characters, no `/`, and not `.` or `..`.

**userId** `string` *required*

1 to 512 characters. The person who detaches the comment.

The schema uses `.strict()`: unknown fields are rejected.

## **Example Requests**

```JSON theme={null}
{
  "data": {
    "organizationId": "org_acme",
    "documentId": "acme-marketing-site",
    "annotationId": "H3vN6pQ1zT8kWmB5xYcR",
    "userId": "user_sam"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Comment detached",
    "data": {
      "detached": true
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "This comment is not attached to a check",
    "status": "FAILED_PRECONDITION",
    "details": {
      "reason": "CHECKS_COMMENT_NOT_ATTACHED"
    }
  }
}
```

**Errors:** `INVALID_ARGUMENT` (a body outside the schema: a missing or malformed `annotationId`, a missing `userId`, or an unknown field) / `NOT_FOUND` with `CHECKS_COMMENT_NOT_FOUND` (no such comment in the project) or `CHECKS_WORKSPACE_NOT_FOUND` (the workspace has no store database) / `FAILED_PRECONDITION` with `CHECKS_AGENT_COMMENT_NOT_ATTACHABLE` (an agent comment) or `CHECKS_COMMENT_NOT_ATTACHED` (the comment is not attached to a check).

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Comment detached",
    "data": {
      "detached": true
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.