---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/api-ref/Repository-or-PullRequest-or-Comments/CreatePullRequestComment.md
  - https://sourcecraft.dev/portal/docs/ru/api-ref/Repository-or-PullRequest-or-Comments/CreatePullRequestComment.md
  - href: ru/api-ref/Repository-or-PullRequest-or-Comments/CreatePullRequestComment.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/ru/llms.txt

<div class="openapi">

# Create comment

<!-- markdownlint-disable-file -->

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">

<div class="openapi__request">

POST {.openapi__method}
```text translate=no
https://api.sourcecraft.tech/repos/{org_slug}/{repo_slug}/pulls/{pull_request_slug}/comments
```

</div>

</div>

</div>

### Path parameters

#|
|| **Name** | **Description** ||
||

_org_slug_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_pull_request_slug_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_repo_slug_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
|#{.json-schema-properties}

### Query parameters

#|
|| **Name** | **Description** ||
||

_pull_request_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_silent_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

do not notify subscribers
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "parent_id": "example",
  "body": "example",
  "anchor": {
    "path": "example",
    "position": {
      "from": 0,
      "to": 0,
      "side": "target",
      "outdated": true
    }
  },
  "need_resolution": true,
  "publish": true,
  "iteration": "example"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_anchor_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [ShortAnchor](#entity-ShortAnchor)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "path": "example",
  "position": {
    "from": 0,
    "to": 0,
    "side": "target",
    "outdated": true
  }
}
```

{% endcut %}
{.table-cell}
||
||

_body_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_iteration_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_need_resolution_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean
{.table-cell}
||
||

_parent_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_publish_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### Side {#entity-Side}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `target`, `source`

</div>

<div class="openapi-entity">

### DiffPos {#entity-DiffPos}

#|
|| **Name** | **Description** ||
||

_from_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Start of commented region, line number (1-based).
{.table-cell}
||
||

_outdated_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Indicates whether commented region has changed after initial comment publishing.
{.table-cell}
||
||

_side_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [Side](#entity-Side)

_Enum:_{.json-schema-reset .json-schema-value} `target`, `source`
{.table-cell}
||
||

_to_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

End of commented region, line number (1-based).
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "from": 0,
  "to": 0,
  "side": "target",
  "outdated": true
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### ShortAnchor {#entity-ShortAnchor}

#|
|| **Name** | **Description** ||
||

_path_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_position_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [DiffPos](#entity-DiffPos)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "from": 0,
  "to": 0,
  "side": "target",
  "outdated": true
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "path": "example",
  "position": {
    "from": 0,
    "to": 0,
    "side": "target",
    "outdated": true
  }
}
```

{% endcut %}

</div>

## Responses

<div class="openapi__response__code__201">

## 201 Created

A successful response.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "id": "example",
  "body": "example",
  "parent_id": "example",
  "author": {
    "id": "example",
    "slug": "example"
  },
  "updated_by": null,
  "created_at": "2025-01-01T00:00:00Z",
  "updated_at": "2025-01-01T00:00:00Z",
  "is_deleted": true,
  "reactions": {},
  "anchor": {
    "path": "example",
    "position": {
      "from": 0,
      "to": 0,
      "side": "target",
      "outdated": true
    },
    "hunk": {
      "from_start": 0,
      "from_count": 0,
      "to_start": 0,
      "to_count": 0,
      "patch": "example"
    }
  },
  "need_resolution": true,
  "is_resolved": true,
  "is_published": true,
  "is_outdated": true,
  "type": "default",
  "iteration": "example",
  "resolution_state": "no_resolution_needed"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_anchor_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [Anchor](#entity-Anchor)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "path": "example",
  "position": {
    "from": 0,
    "to": 0,
    "side": "target",
    "outdated": true
  },
  "hunk": {
    "from_start": 0,
    "from_count": 0,
    "to_start": 0,
    "to_count": 0,
    "patch": "example"
  }
}
```

{% endcut %}
{.table-cell}
||
||

_author_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [UserEmbedded](#entity-UserEmbedded)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "example",
  "slug": "example"
}
```

{% endcut %}
{.table-cell}
||
||

_body_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_created_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_is_deleted_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean
{.table-cell}
||
||

_is_outdated_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean
{.table-cell}
||
||

_is_published_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean
{.table-cell}
||
||

_is_resolved_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Deprecated: use resolution_state instead.
{.table-cell}
||
||

_iteration_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;uint64&gt;

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_need_resolution_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Deprecated: use resolution_state instead.
{.table-cell}
||
||

_parent_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_reactions_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
||

_[additional]_{.json-schema-reset .json-schema-additional-property}
{.table-cell}|
**Type**: [ReactionCount](#entity-ReactionCount)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "count": 0,
  "self_react": true
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

{% endcut %}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
||

_resolution_state_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [ResolutionState](#entity-ResolutionState)

Resolution state for pull request comments.
Transition from `no_resolution_needed` directly to `resolved` is not allowed:
set to `awaiting_resolution` first, then resolve.

_Enum:_{.json-schema-reset .json-schema-value} `no_resolution_needed`, `awaiting_resolution`, `resolved`
{.table-cell}
||
||

_type_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [PullRequestComment.Type](#entity-PullRequestComment.Type)

_Enum:_{.json-schema-reset .json-schema-value} `default`, `appsec`
{.table-cell}
||
||

_updated_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_updated_by_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [UserEmbedded](#entity-UserEmbedded)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "example",
  "slug": "example"
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### UserEmbedded {#entity-UserEmbedded}

#|
|| **Name** | **Description** ||
||

_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_slug_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "example",
  "slug": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### ReactionCount {#entity-ReactionCount}

#|
|| **Name** | **Description** ||
||

_count_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer
{.table-cell}
||
||

_self_react_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "count": 0,
  "self_react": true
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### Hunk {#entity-Hunk}

#|
|| **Name** | **Description** ||
||

_from_count_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer
{.table-cell}
||
||

_from_start_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer
{.table-cell}
||
||

_patch_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_to_count_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer
{.table-cell}
||
||

_to_start_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "from_start": 0,
  "from_count": 0,
  "to_start": 0,
  "to_count": 0,
  "patch": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### Anchor {#entity-Anchor}

#|
|| **Name** | **Description** ||
||

_hunk_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [Hunk](#entity-Hunk)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "from_start": 0,
  "from_count": 0,
  "to_start": 0,
  "to_count": 0,
  "patch": "example"
}
```

{% endcut %}
{.table-cell}
||
||

_path_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_position_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [DiffPos](#entity-DiffPos)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "from": 0,
  "to": 0,
  "side": "target",
  "outdated": true
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "path": "example",
  "position": {
    "from": 0,
    "to": 0,
    "side": "target",
    "outdated": true
  },
  "hunk": {
    "from_start": 0,
    "from_count": 0,
    "to_start": 0,
    "to_count": 0,
    "patch": "example"
  }
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### PullRequestComment.Type {#entity-PullRequestComment.Type}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `default`, `appsec`

</div>

<div class="openapi-entity">

### ResolutionState {#entity-ResolutionState}

Resolution state for pull request comments.
Transition from `no_resolution_needed` directly to `resolved` is not allowed:
set to `awaiting_resolution` first, then resolve.

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `no_resolution_needed`, `awaiting_resolution`, `resolved`

</div>

</div>

<div class="openapi__response__code__default">

## default

Both Client Errors (4xx) and Server Errors (5xx) are serialized into this scheme

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error_code": "example",
  "message": "example",
  "request_id": "example",
  "details": null
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: unknown

_Example:_{.json-schema-reset .json-schema-example} `null`
{.table-cell}
||
||

_error_code_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_request_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.