# Levels Module

**Levels Module** assigns Levels based on XP and the reward at each level.

#### Get All Levels For Entity&#x20;

Gets all the levels and threshold XP of an Entity.

<mark style="color:blue;">`GET`</mark> `https://api.questprotocol.xyz/api/entities/${entityID}/levels`

#### Path Parameters

| Name                                       | Type   | Description            |
| ------------------------------------------ | ------ | ---------------------- |
| entityID<mark style="color:red;">\*</mark> | String | Entity or community Id |

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| address<mark style="color:red;">\*</mark>   | String |             |
| signature<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| apiKey<mark style="color:red;">\*</mark>    | String |             |
| apiSecret<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[{
    communityId: c-asdf,
    level: 2,
    xpThreshold: 100,
    isEnabled: true
},
{
    communityId: c-asdf,
    level: 3,
    xpThreshold: 200,
    isEnabled: true
}]
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Can be only performed by the admin/owner of the Entity.
{% endhint %}

#### Add a new Level For Entity

Adds a new level based on XPs for an Entity.

<mark style="color:green;">`POST`</mark> `https://api.questprotocol.xyz/api/entities/${entityID}/levels`

#### Path Parameters

| Name     | Type   | Description            |
| -------- | ------ | ---------------------- |
| entityID | String | Entity or community Id |

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| address<mark style="color:red;">\*</mark>   | String |             |
| signature<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| apiKey<mark style="color:red;">\*</mark>    | String |             |
| apiSecret<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name                                    | Type   | Description                                                     |
| --------------------------------------- | ------ | --------------------------------------------------------------- |
| xp<mark style="color:red;">\*</mark>    | String | This is the threshold XP which needs to be passed for the level |
| level<mark style="color:red;">\*</mark> | String |                                                                 |

{% tabs %}
{% tab title="200: OK { success: true }" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Can only be performed by the admin/owner of the Entity.
{% endhint %}

#### Delete Level For Entity

Delete a level in an Entity.

<mark style="color:green;">`POST`</mark> `https://api.questprotocol.xyz/api/entities/${entityID}/levels/${level}/delete`

#### Path Parameters

| Name                                       | Type   | Description                           |
| ------------------------------------------ | ------ | ------------------------------------- |
| entityID<mark style="color:red;">\*</mark> | String | Entity or community Id                |
| level                                      | String | Level number that needs to be deleted |

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| address<mark style="color:red;">\*</mark>   | String |             |
| signature<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| apiKey<mark style="color:red;">\*</mark>    | String |             |
| apiSecret<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK { success: true } " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Can be only performed by admin/owner of the Entity.
{% endhint %}

#### Update Levels for Entity

Updates a level requirements in an Entity. Can be only performed by admin/owner of the Entity.

<mark style="color:green;">`POST`</mark> `https://api.questprotocol.xyz/api/entities/${entityID}/levels/${level}/update`

#### Path Parameters

| Name                                       | Type   | Description                           |
| ------------------------------------------ | ------ | ------------------------------------- |
| entityID<mark style="color:red;">\*</mark> | String | Entity or community Id                |
| level<mark style="color:red;">\*</mark>    | String | Level number that needs to be updated |

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| signature<mark style="color:red;">\*</mark> | String |             |
| address<mark style="color:red;">\*</mark>   | String |             |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| apiKey<mark style="color:red;">\*</mark>    | String |             |
| apiSecret<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name                                 | Type   | Description                    |
| ------------------------------------ | ------ | ------------------------------ |
| xp<mark style="color:red;">\*</mark> | String | New XP threshold for the level |

{% tabs %}
{% tab title="200: OK { success: true }" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Can only be performed by the admin/owner of the Entity.
{% endhint %}


---

# 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.questera.ai/questera-ai-sdks/rest-apis/gamification/levels-module.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.
