---
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/en/api-ref/attachments/pagesattachments__attach_file.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.ru/support/wiki/en/llms.txt?revision=r21947862
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/support/wiki/en/llms.txt?revision=r21947862

<div class="openapi">

# Attach File

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

Attaches one or more files to the page from the sessions specified in `upload_sessions`. The sessions
must be completed, intended for attaching files, and belong to the current user
and organization.

Attaching files requires permission to edit the page. To create an upload session, use
`POST /v1/upload_sessions`.

For common headers and authentication methods, see [Access to the API](https://yandex.ru/support/wiki/en/api-ref/access.md#headers). For sample scenarios, see [API usage examples](https://yandex.ru/support/wiki/en/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

Page ID. The value of `idx` is the same as the `id` field value in the response to `GET /v1/pages?slug=…` or `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;[]

IDs of completed file upload sessions whose files should be attached to the page

{% 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)[]

Files attached to the page

{% 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}

User identifier

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

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

User identifier in the cloud

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

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

Yandex user ID

_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}

User information

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

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

User affiliation

_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

User display name

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

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

Internal user identifier
{.table-cell}
||
||

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

The user is dismissed
{.table-cell}
||
||

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

User login

_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)

  User identifier

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

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

  {% endcut %}

{% endcut %}

User identifier in the system

{% 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}

File antivirus scan status:
- `check`: The file is being scanned.
- `ready`: The file is ready to use.
- `deleted`: The file has been deleted.
- `infected`: A virus was detected.
- `error`: An error occurred during the scan.

**Type**: string

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

</div>

<div class="openapi-entity">

### AttachmentSchema {#entity-AttachmentSchema}

File attached to a page

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

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

Date and time the file was uploaded

_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

File description

_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 for downloading the file

_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

A preview is available for the file
{.table-cell}
||
||

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

Unique file ID
{.table-cell}
||
||

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

File MIME type

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

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

File name

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

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

File size in mebibytes (MiB)

_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)

  File antivirus scan status:
  - `check`: The file is being scanned.
  - `ready`: The file is ready to use.
  - `deleted`: The file has been deleted.
  - `infected`: A virus was detected.
  - `error`: An error occurred during the scan.

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

{% endcut %}

File antivirus check status

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

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

The file is available for download

_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)

  User information

  {% 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 %}

User who uploaded the file

{% 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.