> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Int Value

> This method will assign a new integer value to a Data Object. Note, you can also increment or decrement the integer...

This method will assign a new integer value to a [Data Object](/api-reference/generated/DataObjectsIntro).
Note, you can also [increment](/api-reference/generated/IncrementIntValue) or [decrement](/api-reference/generated/DecrementIntValue) the integer value.
Please read more about access tokens in [Remarks](/api-reference/generated/SetIntValue#remarks).

This method is accessed in several ways. Each way works in the same way and requires the same permission.
The only difference is the type of parameters. Both cases are listed below:

### Parameters

**Method 1 (general):** [https://api.cryptolens.io/api/data/SetIntValue](https://api.cryptolens.io/api/data/SetIntValue)

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Id | The unique object id for the data object. | required |
| IntValue | The new int value that should be assigned to the data object. | optional, 0 by default. |
| v | Method version. | optional. by default, it's 1. |

**Method 2 (key specific):** [https://api.cryptolens.io/api/data/SetIntValueToKey](https://api.cryptolens.io/api/data/SetIntValueToKey)

There are two ways to call this method:

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| ProductId | the product id (=\*\*\[ProductId] \*\*) | required |
| Key | the serial key string | required |
| Id | The unique object id for the data object. | required |
| IntValue | The new int value that should be assigned to the data object. | optional, 0 by default. |
| v | Method version. | optional. by default, it's 1. |

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| ProductId | the product id (=\*\*\[ProductId] \*\*) | required |
| Key | the serial key string | required |
| Name | The name of the data object. | required |
| IntValue | The new int value that should be assigned to the data object. | optional, 0 by default. |
| v | Method version. | optional. by default, it's 1. |

**Method 3 (machine code specific):** [https://api.cryptolens.io/api/data/SetIntValueToMachineCode](https://api.cryptolens.io/api/data/SetIntValueToMachineCode)

There are two ways to call this method:

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| ProductId | the product id (=\*\*\[ProductId] \*\*) | required |
| Key | the serial key string | required |
| MachineCode | the machine code | required |
| Id | The unique object id for the data object. | required |
| IntValue | The new int value that should be assigned to the data object. | optional, 0 by default. |
| v | Method version. | optional. by default, it's 1. |

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| ProductId | the product id (=\*\*\[ProductId] \*\*) | required |
| Key | the serial key string | required |
| MachineCode | the machine code | required |
| Name | The name of the data object. | required |
| IntValue | The new int value that should be assigned to the data object. | optional, 0 by default. |
| v | Method version. | optional. by default, it's 1. |

### Results

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Result | This is either **0**(=success) or **1**(=error). | always returned |
| Message | The message that provides additional information about the result. If it's a successful result, **null** will be returned. Otherwise, in case of an error, a short message will be returned describing the error. | always returned. |

### Example results

```text theme={null}
{"result":0,"message":null}
```

### Remarks

* Integer overflows are not allowed. If you attempt to assign an int value that is beyond the limits of an int32, zero will be assigned to the data object's **IntValue**.
* When accessing the key specific methods (using productId and the key string), you need to either disable key lock (set it to zero) or set it to a negative number, in the same way you would have done if you would have used [KeyLock](/api-reference/generated/KeyLock). We recommend to set the **KeyLock** to **-1** when creating the access token.

### Errors

| **Error** |
| - |
| Access denied. |
| The input parameters were incorrect. |
| Not enough permission. |
| Not enough permission and/or product not found. |
| Not enough permission and/or key not found. |
| Incorrect 'ReferencerType'. It can either be 0 (for a User), 1 (for a Product) and 2 (for a Key). |
| Not enough permission and/or machine code not found. |
