Get the list of files

Gets the list of files saved in Toloka.

Request

GET https://toloka.yandex.com/api/v1/attachments
Authorization: OAuth <OAuth token>

Headers

Title Overview
authorization A token for account authorization. Add OAuth as a prefix.
Title Overview
authorization A token for account authorization. Add OAuth as a prefix.

Query parameters

Specified in the link after the question mark; separated by &.

Parameter Overview

pool_id

string

Pool ID.

assignment_id

string

ID of the task suite assignment.

name

string

File name.

type

string

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

user_id

string

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

sort

string

Parameters to sort by:

  • id — File ID number (ascending).

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

This query supports multiple sorts that must be specified in a desired sequence:

  • created,id — Sort ascending first by file upload date, then by file ID.
  • -created,-id — Sort descending first by file upload date, then by file ID.

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

Standard query parameters

limit, id_gt, id_gte, id_lt, id_lte, created_gt, created_gte, created_lt, created_lte
Parameter Overview

pool_id

string

Pool ID.

assignment_id

string

ID of the task suite assignment.

name

string

File name.

type

string

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

user_id

string

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

sort

string

Parameters to sort by:

  • id — File ID number (ascending).

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

This query supports multiple sorts that must be specified in a desired sequence:

  • created,id — Sort ascending first by file upload date, then by file ID.
  • -created,-id — Sort descending first by file upload date, then by file ID.

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

Standard query parameters

limit, id_gt, id_gte, id_lt, id_lte, created_gt, created_gte, created_lt, created_lte

Query example

You can set up the display of the list of files in parts (for example, 10 files at a time):

  1. Show the first 10 files, starting with the one with the lowest ID.
  2. Show the remaining files (10 at a time) in ascending order.
Show the first 10 responses
GET https://toloka.yandex.com/api/v1/attachments?sort=id&limit=10
Authorization: OAuth <OAuth token>
Show the remaining responses sorted by ascending ID
GET https://toloka.yandex.com/api/v1/attachments?sort=id&limit=10&id_gt=<ID of the last file from the previous response>
Authorization: OAuth <OAuth token>

Response

Information about files in the items array:

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