---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.0
alternate:
  - https://sourcecraft.dev/portal/docs/en/sec-api-ref/Defect-Group-Link-Rest-Api/v1defect-groupslinksbatch-post.md
  - https://sourcecraft.dev/portal/docs/ru/sec-api-ref/Defect-Group-Link-Rest-Api/v1defect-groupslinksbatch-post.md
  - href: https://sourcecraft.dev/portal/docs/en/sec-api-ref/Defect-Group-Link-Rest-Api/v1defect-groupslinksbatch-post.md
    type: text/markdown
    title: Markdown version
  - href: https://sourcecraft.dev/portal/docs/en/llms.txt?revision=r21725674
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt?revision=r21725674

<div class="openapi">

# Add Batch Defect Groups Links

<!-- 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://appsec.sourcecraft.tech/v1/defect-groups/links/batch
```

</div>

</div>

</div>

### Query parameters

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

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

Repository identifier. Accepts either internal repository ID (e.g., 88769874964302633) or public UUID (e.g., 0199140f-4343-7c06-a7e3-b835c305b629). These values can be obtained from the getRepo API (fields: id and uuid).

_Pattern:_{.json-schema-reset .json-schema-assertion} `\S`

_Example:_{.json-schema-reset .json-schema-example} `0199140f-4343-7c06-a7e3-b835c305b629`
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "updates": [
    {
      "defectGroupUuid": "0199140f-4343-7c06-a7e3-b835c305b629",
      "links": [
        {
          "type": "SOURCECRAFT_PR",
          "identifier": "42"
        }
      ]
    }
  ]
}
```

{% endcut %}

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

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

_Min items:_{.json-schema-reset .json-schema-assertion} `1`

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

```json translate=no
[
  {
    "defectGroupUuid": "0199140f-4343-7c06-a7e3-b835c305b629",
    "links": [
      {
        "type": "SOURCECRAFT_PR",
        "identifier": "42"
      }
    ]
  }
]
```

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

</div>

<div class="openapi-entity">

### LinkType {#entity-LinkType}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `EXTERNAL_URL`, `SOURCECRAFT_ISSUE`, `SOURCECRAFT_PR`, `YA_TRACKER`

</div>

<div class="openapi-entity">

### LinkToAdd {#entity-LinkToAdd}

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

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

Platform ID of the issue or pull request (a number or a UUID), or the HTTPS URL for URL-typed links

_Pattern:_{.json-schema-reset .json-schema-assertion} `\S`

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

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

Link type. SOURCECRAFT_ISSUE and SOURCECRAFT_PR carry a platform identifier, EXTERNAL_URL and YA_TRACKER carry an HTTPS URL.

_Enum:_{.json-schema-reset .json-schema-value} `EXTERNAL_URL`, `SOURCECRAFT_ISSUE`, `SOURCECRAFT_PR`, `YA_TRACKER`
{.table-cell}
||
|#{.json-schema-properties}

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

```json translate=no
{
  "type": "SOURCECRAFT_PR",
  "identifier": "42"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### DefectGroupLinksUpdate {#entity-DefectGroupLinksUpdate}

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

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

UUID of the defect group to attach the links to

_Pattern:_{.json-schema-reset .json-schema-assertion} `\S`

_Example:_{.json-schema-reset .json-schema-example} `0199140f-4343-7c06-a7e3-b835c305b629`
{.table-cell}
||
||

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

_Min items:_{.json-schema-reset .json-schema-assertion} `1`

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

```json translate=no
[
  {
    "type": "SOURCECRAFT_PR",
    "identifier": "42"
  }
]
```

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

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

```json translate=no
{
  "defectGroupUuid": "0199140f-4343-7c06-a7e3-b835c305b629",
  "links": [
    {
      "type": "SOURCECRAFT_PR",
      "identifier": "42"
    }
  ]
}
```

{% endcut %}

</div>

## Responses

<div class="openapi__response__code__200">

## 200 OK

OK

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "inserted": 0
}
```

{% endcut %}

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

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

Links actually inserted; already existing ones and links for defect groups missing from this repository are skipped
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__400">

## 400 Bad Request

Bad Request

</div>

</div>

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