# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trust.enterprises/rest-api/tokens/bequesting-a-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
