Create a subscription

Attention

The toloka.yandex.com domain will be disabled starting May 1, 2023. Please use the toloka.dev domain for API requests.

Creates one or more subscriptions.

Request

Production version
Sandbox
PUT https://toloka.dev/api/v1/webhook-subscriptions
Authorization: OAuth <OAuth token>
Content-Type: application/JSON

Headers

TitleOverview
AuthorizationA token for account authorization. Add OAuth as a prefix.
Content-TypeSpecifies the data format in the request body.

Request body

[
{
"webhook_url": "https://awesome-requester.com/toloka-webhook",
"event_type": "ASSIGNMENT_CREATED",
"pool_id": "121212"
},
{
"webhook_url": "https://awesome-requester.com/toloka-webhook",
"event_type": "POOL_CLOSED",
"pool_id": "121212",
"secret_key": "12345"
}
]
ParameterOverview
webhook_urlstring | required

The URL that notifications will be sent to.
event_type

string | required

Event type.

Acceptable values:

  • POOL_CLOSED — The pool is closed.
  • DYNAMIC_OVERLAP_COMPLETED — An aggregated result appeared after dynamic overlap.
  • ASSIGNMENT_CREATED — A task is created.
  • ASSIGNMENT_SUBMITTED — A task is completed and waiting for acceptance by the requester.
  • ASSIGNMENT_SKIPPED — A task was taken by the Toloker who then skipped it and won't return to it.
  • ASSIGNMENT_EXPIRED — A task was taken by the Toloker who failed to complete it within the time allowed or rejected it before it expired.
  • ASSIGNMENT_APPROVED — A task was completed by the Toloker and approved by the requester.
  • ASSIGNMENT_REJECTED — A task was completed by the Toloker but rejected by the requester.
pool_idstring | required

ID of the pool that the subscription was created for.
secret_keystring | optional

A secret key with which you can check whether incoming requests were sent through the Toloka API. For more information, see Event authentication.

Response

Contains information about created subscriptions in JSON format. Each subscription is assigned a unique identifier (id) and creation date (created).

When creating a single subscription
When creating multiple subscriptions
[
{
"webhook_url": "https://awesome-requester.com/toloka-webhook",
"event_type": "ASSIGNMENT_CREATED",
"pool_id": "121212",
"id": "webhook-subscription-1",
"created": "2020-02-03T15:00:00"
}
]
ParameterOverview
items[]array of objects

An array of objects with information about the subscriptions created.
<n>object

Sequential number of the subscription in the creation request (starting from 0).
webhook_urlstring

The URL that notifications will be sent to.
event_type

string

Event type.

Acceptable values:

  • POOL_CLOSED — The pool is closed.
  • DYNAMIC_OVERLAP_COMPLETED — An aggregated result appeared after dynamic overlap.
  • ASSIGNMENT_CREATED — A task is created.
  • ASSIGNMENT_SUBMITTED — A task is completed and waiting for acceptance by the requester.
  • ASSIGNMENT_SKIPPED — A task was taken by the Toloker who then skipped it and won't return to it.
  • ASSIGNMENT_EXPIRED — A task was taken by the Toloker who failed to complete it within the time allowed or rejected it before it expired.
  • ASSIGNMENT_APPROVED — A task was completed by the Toloker and approved by the requester.
  • ASSIGNMENT_REJECTED — A task was completed by the Toloker but rejected by the requester.
pool_idstring

ID of the pool that the subscription was created for.
idstring

ID of the subscription. Generated automatically.
createdstring

The date and time when the subscription was created (UTC). It uses ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].
validation_errorsobject

Object with validation errors.
Contact support
Toloka API
OverviewAccessing the APIRate limiting
Quick start
Reference
Project
Pools
Training
Subscriptions to events
Toloker selection
Ways to upload tasks
Tasks
Task suites
Tracking operations
Getting responses
Checking completed tasks
Rewards
Messages for Tolokers
Various parameters
Libraries