---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.2
alternate:
  - https://yandex.ru/support/wiki/en/api-ref/attachments/pagesattachments__attach_file.md
  - https://yandex.ru/support/wiki/ru/api-ref/attachments/pagesattachments__attach_file.md
  - href: https://yandex.ru/support/wiki/ru/api-ref/attachments/pagesattachments__attach_file.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.ru/support/wiki/ru/llms.txt?revision=r21947862
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/support/wiki/ru/llms.txt?revision=r21947862

<div class="openapi">

# Добавить прикрепленный файл

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

Прикрепляет к странице один или несколько файлов из сессий, указанных в `upload_sessions`. Сессии
должны быть завершены, предназначены для прикрепления файлов и принадлежать текущему пользователю
и организации.

Для прикрепления требуется право редактирования страницы. Создать сессию загрузки можно методом
`POST /v1/upload_sessions`.

Общие заголовки и способы аутентификации описаны в разделе [Доступ к API](https://yandex.ru/support/wiki/ru/api-ref/access.md#headers). Примеры сценариев приведены в разделе [Примеры использования API](https://yandex.ru/support/wiki/ru/api-ref/examples.md).

## 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.wiki.yandex.net/v1/pages/{idx}/attachments
```

</div>

</div>

</div>

### Path parameters

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

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

Идентификатор страницы. Значение `idx` совпадает со значением поля `id` в ответе `GET /v1/pages?slug=…` или `POST /v1/pages`.
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "upload_sessions": [
    "example"
  ]
}
```

{% endcut %}

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

_upload_sessions_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string&lt;uuid4&gt;[]

Идентификаторы завершенных сессий загрузки файлов, которые нужно прикрепить к странице

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

```json translate=no
[
  "example"
]
```

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

</div>

## Responses

<div class="openapi__response__code__200">

## 200 OK

OK

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "results": [
    {
      "id": 0,
      "name": "example",
      "is_downloadable": true,
      "download_url": "example",
      "size": "example",
      "description": "example",
      "user": {
        "id": 0,
        "identity": null,
        "username": "example",
        "display_name": "example",
        "is_dismissed": true,
        "affiliation": "example"
      },
      "created_at": "2025-01-01T00:00:00Z",
      "mimetype": "example",
      "has_preview": true,
      "check_status": "ready"
    }
  ]
}
```

{% endcut %}

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

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

Файлы, прикрепленные к странице

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

```json translate=no
[
  {
    "id": 0,
    "name": "example",
    "is_downloadable": true,
    "download_url": "example",
    "size": "example",
    "description": "example",
    "user": {
      "id": 0,
      "identity": null,
      "username": "example",
      "display_name": "example",
      "is_dismissed": true,
      "affiliation": "example"
    },
    "created_at": "2025-01-01T00:00:00Z",
    "mimetype": "example",
    "has_preview": true,
    "check_status": "ready"
  }
]
```

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

</div>

<div class="openapi-entity">

### UserIdentity {#entity-UserIdentity}

Идентификатор пользователя

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

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

Идентификатор пользователя в облаке

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

_uid_{.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
{
  "uid": "example",
  "cloud_uid": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### UserSchema {#entity-UserSchema}

Информация о пользователе

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

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

Принадлежность пользователя

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

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

Отображаемое имя пользователя

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

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

Внутренний идентификатор пользователя
{.table-cell}
||
||

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

Пользователь уволен
{.table-cell}
||
||

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

Логин пользователя

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

_identity_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**All of 1 type**" %}{.json-schema-combinators data-marker=and}

- **UserIdentity**

  **Type**: [UserIdentity](#entity-UserIdentity)

  Идентификатор пользователя

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

  ```json translate=no
  {
    "uid": "example",
    "cloud_uid": "example"
  }
  ```

  {% endcut %}

{% endcut %}

Идентификатор пользователя в системе

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

```json translate=no
{
  "uid": "example",
  "cloud_uid": "example"
}
```

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

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

```json translate=no
{
  "id": 0,
  "identity": {
    "uid": "example",
    "cloud_uid": "example"
  },
  "username": "example",
  "display_name": "example",
  "is_dismissed": true,
  "affiliation": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### FileCheckStatusType {#entity-FileCheckStatusType}

Статус проверки файла антивирусом:
- `check` — файл проверяется
- `ready` — файл готов к использованию
- `deleted` — файл удален
- `infected` — обнаружен вирус
- `error` — ошибка при проверке

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `check`, `ready`, `deleted`, `infected`, `error`

</div>

<div class="openapi-entity">

### AttachmentSchema {#entity-AttachmentSchema}

Прикрепленный файл к странице

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

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

Дата и время загрузки файла

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

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

Описание файла

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

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

URL для скачивания файла

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

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

Для файла доступен предварительный просмотр
{.table-cell}
||
||

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

Уникальный идентификатор файла
{.table-cell}
||
||

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

MIME-тип файла

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

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

Имя файла

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

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

Размер файла в мебибайтах (МиБ)

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

_check_status_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**All of 1 type**" %}{.json-schema-combinators data-marker=and}

- **FileCheckStatusType**

  **Type**: [FileCheckStatusType](#entity-FileCheckStatusType)

  Статус проверки файла антивирусом:
  - `check` — файл проверяется
  - `ready` — файл готов к использованию
  - `deleted` — файл удален
  - `infected` — обнаружен вирус
  - `error` — ошибка при проверке

  _Enum:_{.json-schema-reset .json-schema-value} `check`, `ready`, `deleted`, `infected`, `error`

{% endcut %}

Статус проверки файла антивирусом

_Default:_{.json-schema-reset .json-schema-value} `ready`
{.table-cell}
||
||

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

Файл доступен для скачивания

_Default:_{.json-schema-reset .json-schema-value} `true`
{.table-cell}
||
||

_user_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**All of 1 type**" %}{.json-schema-combinators data-marker=and}

- **UserSchema**

  **Type**: [UserSchema](#entity-UserSchema)

  Информация о пользователе

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

  ```json translate=no
  {
    "id": 0,
    "identity": {
      "uid": "example",
      "cloud_uid": "example"
    },
    "username": "example",
    "display_name": "example",
    "is_dismissed": true,
    "affiliation": "example"
  }
  ```

  {% endcut %}

{% endcut %}

Пользователь, загрузивший файл

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

```json translate=no
{
  "id": 0,
  "identity": {
    "uid": "example",
    "cloud_uid": "example"
  },
  "username": "example",
  "display_name": "example",
  "is_dismissed": true,
  "affiliation": "example"
}
```

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

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

```json translate=no
{
  "id": 0,
  "name": "example",
  "is_downloadable": true,
  "download_url": "example",
  "size": "example",
  "description": "example",
  "user": {
    "id": 0,
    "identity": {
      "uid": "example",
      "cloud_uid": "example"
    },
    "username": "example",
    "display_name": "example",
    "is_dismissed": true,
    "affiliation": "example"
  },
  "created_at": "2025-01-01T00:00:00Z",
  "mimetype": "example",
  "has_preview": true,
  "check_status": "ready"
}
```

{% endcut %}

</div>

</div>

</div>

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