# Bequesting a token

{% hint style="warning" %}
This feature is in beta and there will be unexpected side effects if the body parameters aren't used.
{% endhint %}

## Send/bequest a token to an account

<mark style="color:green;">`POST`</mark> `https://hedera-serverless-consensus.vercel.app/api/token/bequest`

This endpoint allows you to send a token to user as a permissioned function, provide the encrypted keys and ids of the receiver and token.

#### Headers

| Name                                             | Type   | Description                                                        |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------ |
| Authentication<mark style="color:red;">\*</mark> | string | The **API\_SECRET\_KEY** from th e client's environment variables. |

#### Request Body

| Name                                                       | Type   | Description                          |
| ---------------------------------------------------------- | ------ | ------------------------------------ |
| encrypted\_receiver\_key<mark style="color:red;">\*</mark> | String | Encrypted private key of receiver    |
| token\_id<mark style="color:red;">\*</mark>                | String | ID of token to send                  |
| receiver\_id<mark style="color:red;">\*</mark>             | String | Account id of receiving account      |
| amount<mark style="color:red;">\*</mark>                   | Number | amount of tokens to send             |
| decimals                                                   | Number | Explicitly set decimals of the token |

{% tabs %}
{% tab title="200 Token sent to user" %}

```
{
    "data": {
        "amount": "1",
        "receiver_id": "0.0.2120537",
        "transaction_id": "0.0.1156@1634128052.72220023"
    }
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Encrypted key too short" %}

```javascript
{
    "errors": [
        "\"encrypted_receiver_key\" length must be 241 characters long"
    ]
}
```

{% endtab %}
{% endtabs %}
