Creating a file upload session

Creates a file upload session. To upload a file:

  1. Create a file upload session.
  2. Upload file data using PUT /v1/upload_sessions/{session_id}/upload_part.
  3. Complete the upload session using POST /v1/upload_sessions/{session_id}/finish.

Once the upload is complete, attach the file to a page using POST /v1/pages/{idx}/attachments.

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/upload_sessions

Body

application/json
{
  "file_name": "example",
  "file_size": 0
}

Name

Description

file_name

Type: string

The name of the file to upload.

Example: example

file_size

Type: integer

Size of the file to upload, in bytes.

Responses

200 OK

OK

Body

application/json
{
  "session_id": "example",
  "file_name": "example",
  "file_size": 0,
  "status": "not_started",
  "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",
  "finished_at": "2025-01-01T00:00:00Z",
  "storage_type": "mds"
}

Name

Description

created_at

Type: string<date-time>

Date and time when the upload session was created.

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

file_name

Type: string

The name of the file to upload.

Example: example

file_size

Type: integer

File size in bytes, as specified when the session was created.

session_id

Type: string<uuid4>

File upload session ID in UUID format. Use this value as session_id in methods for uploading, completing, and aborting a session.

Example: example

status

Type: UploadSessionStatusType

Upload session state.

An enumeration.

Enum: not_started, in_progress, finished, aborted, used, cleanup

user

Type: UserSchema

User who created the upload session.

User information

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

finished_at

Any of 2 types
  • Type: string<date-time>

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

  • Type: null

    Example: null

The date and time when the upload finished. null if the upload has not finished yet.

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

storage_type

Any of 2 types
  • StorageType

    Type: StorageType

    An enumeration.

    Enum: mds, s3, custom_s3, avatars

  • Type: null

    Example: null

File storage type.

Example: mds

UploadSessionStatusType

An enumeration.

Type: string

Enum: not_started, in_progress, finished, aborted, used, cleanup

UserIdentity

User ID

Name

Description

cloud_uid

Any of 2 types
  • Type: string

    Example: example

  • Type: null

    Example: null

User identifier in the cloud

Example: example

uid

Any of 2 types
  • Type: string

    Example: example

  • Type: null

    Example: null

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

Any of 2 types
  • UserIdentity

    Type: UserIdentity

    User ID

    Example
    {
      "uid": "example",
      "cloud_uid": "example"
    }
    
  • Type: null

    Example: null

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

StorageType

An enumeration.

Type: string

Enum: mds, s3, custom_s3, avatars