Allocate rewards
Important:
Request headers are required. See API basics introduction for more information.
Allocate reward
Endpoint
POST /reward/allocate
- Creates a new
Allocation
request for a reward contracts to allocate reward tokens to a given user UID, associated with the given App (set by the X-API-KEY). - Returns a new
Allocation
(allocation uid
) associated.
Note:
The request is partly asynchronous - this will immediately return the
allocation uid
and perform the allocation on the blockchain asynchronously.To know when the allocation has been executed on the blockchain, you can subscribe to the Webhook events or poll any of the Get allocation details endpoints.
Request body
Request body fields | Type | Description | Required/Optional |
---|---|---|---|
reward_uid | String | The UID of the rewards contract where tokens should be allocated. | Required |
to_user_uid | String | The UID of the user who is going to be able to claim the tokens. | Required |
amount | String | The amount of tokens to allocate. | Required |
nonce | String | The unique ID of the allocation to prevent double allocations. | Required |
Request example
Sample: request body
{
"reward_uid": "764893807463",
"to_user_uid": "110985463782",
"amount": "1.23",
"nonce": "nonce_1"
}
Response
Response example
Sample: 201 Allocate Response
You will receive a uid
which refers to the allocation details uid:
{
"success": true,
"data": {
"uid": "324167489835", // (allocation uid)
}
}
You can use this uid
to call and reference the other Allocation endpoints. For example GET /reward/allocation/{uid}
with this uid
will return the allocation details.
Example
The following example creates an allocation for the reward 123123123123 and user 111111111111 for an amount of "1.23" and a nonce "nonce_1".
# API_KEY is your api key
# TOKEN is the access token generated with your api key secret
curl -i \
-X POST \
-d "{\"reward_uid\":\"123123123123\",\"user_uid\":\"111111111111\",\"amount\":\"1.23\",\"nonce\":\"nonce_1\"}" \
-H "Content-Type: application/json" \
-H "X-Api-Key: API_KEY" \
-H "Authorization: Bearer TOKEN" \
"https://api.getoriginal.com/v1/reward/allocate"
Updated about 2 months ago