create_user_bonus

toloka.client.TolokaClient.create_user_bonus | Source code

Issues a bonus payment to a Toloker.

You can send a maximum of 10,000 requests of this kind per day.

Parameters description

ParametersTypeDescription
user_bonusUserBonus

The bonus.

operation_idOptional[UUID]

The UUID of the operation that conforms to the RFC4122 standard. The UUID is used if async_mode is True.

Specify UUID to avoid accidental errors like Toloka operation duplication caused by network problems. If you send several requests with the same operation_id, Toloka performs the operation only once.

async_modeOptional[bool]

Request processing mode:

  • True — Asynchronous operation is started internally.
  • False — The request is processed synchronously.

Default value: True.

  • Returns:

    Created bonus.

  • Return type:

    UserBonus

Examples:

Issuing a bonus to a Toloker with a message in 2 languages.

from decimal import Decimal
new_bonus = toloka_client.create_user_bonus(
toloka.client.UserBonus(
user_id='fac97860c7929add8048ed2ef63b66fd',
amount=Decimal('0.50'),
public_title={
'EN': 'Perfect job!',
'RU': 'Прекрасная работа!',
},
public_message={
'EN': 'You are the best!',
'RU': 'Молодец!',
},
assignment_id='00001092da--61ef030400c684132d0da0de'
)
)

Last updated: August 28, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming