Attach 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. For sample scenarios, see API usage examples.

Request

POST

https://api.wiki.yandex.net/v1/pages/{idx}/attachments

Path parameters

Name

Description

idx

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.

Body

application/json
{
  "upload_sessions": [
    "example"
  ]
}

Name

Description

upload_sessions

Type: string<uuid4>[]

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

Example
[
  "example"
]

Responses

200 OK

OK

Body

application/json
{
  "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"
    }
  ]
}

Name

Description

results

Type: AttachmentSchema[]

Files attached to the page

Example
[
  {
    "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"
  }
]

UserIdentity

User identifier

Name

Description

cloud_uid

Type: string

User identifier in the cloud

Example: example

uid

Type: string

Yandex user ID

Example: example

Example
{
  "uid": "example",
  "cloud_uid": "example"
}

UserSchema

User information

Name

Description

affiliation

Type: string

User affiliation

Example: example

display_name

Type: string

User display name

Example: example

id

Type: integer

Internal user identifier

is_dismissed

Type: boolean

The user is dismissed

username

Type: string

User login

Example: example

identity

All of 1 type
  • UserIdentity

    Type: UserIdentity

    User identifier

    Example
    {
      "uid": "example",
      "cloud_uid": "example"
    }
    

User identifier in the system

Example
{
  "uid": "example",
  "cloud_uid": "example"
}
Example
{
  "id": 0,
  "identity": {
    "uid": "example",
    "cloud_uid": "example"
  },
  "username": "example",
  "display_name": "example",
  "is_dismissed": true,
  "affiliation": "example"
}

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: check, ready, deleted, infected, error

AttachmentSchema

File attached to a page

Name

Description

created_at

Type: string<date-time>

Date and time the file was uploaded

Example: 2025-01-01T00:00:00Z

description

Type: string

File description

Example: example

download_url

Type: string

URL for downloading the file

Example: example

has_preview

Type: boolean

A preview is available for the file

id

Type: integer

Unique file ID

mimetype

Type: string

File MIME type

Example: example

name

Type: string

File name

Example: example

size

Type: string

File size in mebibytes (MiB)

Example: example

check_status

All of 1 type
  • FileCheckStatusType

    Type: 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: check, ready, deleted, infected, error

File antivirus check status

Default: ready

is_downloadable

Type: boolean

The file is available for download

Default: true

user

All of 1 type
  • UserSchema

    Type: UserSchema

    User information

    Example
    {
      "id": 0,
      "identity": {
        "uid": "example",
        "cloud_uid": "example"
      },
      "username": "example",
      "display_name": "example",
      "is_dismissed": true,
      "affiliation": "example"
    }
    

User who uploaded the file

Example
{
  "id": 0,
  "identity": {
    "uid": "example",
    "cloud_uid": "example"
  },
  "username": "example",
  "display_name": "example",
  "is_dismissed": true,
  "affiliation": "example"
}
Example
{
  "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"
}