Get the list of files

To get the list of files saved in Toloka, send a GET request to the /attachments resource.

Request

GET /api/v1/attachments ?
  [name=<file name>]
& [type=ASSIGNMENT_ATTACHMENT]
& [user_id=<user ID>]
& [assignment_id=<assignment ID>]
& [pool_id=<pool ID>]
& [limit=<maximum number of results in the response>]
& [sort=<fields to sort by>]
& [id_gt=<file ID>]
& [id_gte=<file ID>]
& [id_lt=<file ID>]
& [id_lte=<file ID>]
& [created_gt=<date>]
& [created_gte=<date>]
& [created_lt=<date>]
& [created_lte=<date>]

Host: https://sandbox.toloka.yandex.ru
Authorization: OAuth <OAuth token>
Request parameters

Parameter

Description

Data type

Required

name

File name.

String

No

type

Attachment type. Currently the key can have only one value — ASSIGNMENT_ATTACHMENT.

String

No

user_id

ID of the user who uploaded the file(s).

String

No

assignment_id

Assignment ID.

String

No

pool_id

Pool ID.

String

No

limit

Limit on the number of results to return. By default — 20; maximum — 100.

Number

No

sort

Parameters to sort by:

  • id — File ID number (ascending).

  • created — File upload date in UTC in the format YYYY-MM-DD (ascending).

You can set multiple comma-separated parameters.

To change the sorting direction to descending, add the minus sign before the parameter. For example, sort=-id.

String

No

id_gt

Files with an ID greater than the specified value.

String

No

id_gte

Files with an ID greater than or equal to the specified value.

String

No

id_lt

Files with an ID less than the specified value.

String

No

id_lte

Files with an ID less than or equal to the specified value.

String

No

created_gt

Files uploaded by users after the specified date. The date is specified in UTC in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

No

created_gte

Files uploaded by users after or on the specified date. The date is specified in UTC in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

No

created_lt

Files uploaded by users before the specified date. The date is specified in UTC in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

No

created_lte

Files uploaded by users before or on the specified date. The date is specified in UTC in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

No

To get the list of files in parts (for example, 10 files at a time), use a combination of parameters in requests:

GET /api/v1/attachments?sort=id&limit=10
Host: https://sandbox.toloka.yandex.ru
Authorization: OAuth <OAuth token>
GET /api/v1/attachments?sort=id&limit=10&id_gt=<last file ID from the previous request>
Host: https://sandbox.toloka.yandex.ru
Authorization: OAuth <OAuth token>

Response

Contains a list of files and their properties in the items array:

{"items": [{properties of file 1}, {properties of file 2}, ... {properties of file n}], "has_more": false}