> ## 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 String Value

> This method will assign a new string value to a Data Object. Please read more about access tokens in Remarks.

This method will assign a new string value to a [Data Object](/api-reference/generated/DataObjectsIntro).
Please read more about access tokens in [Remarks](/api-reference/generated/SetStringValue#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/SetStringValue](https://api.cryptolens.io/api/data/SetStringValue)

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Id | The unique object id for the data object. | required |
| StringValue | A string value (text) to store. Max 10000 characters. | optional, null by default. |
| v | Method version. | optional. by default, it's 1. |

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

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 |
| StringValue | A string value (text) to store. Max 10000 characters. | optional, null 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 |
| StringValue | A string value (text) to store. Max 10000 characters. | optional, null by default. |
| v | Method version. | optional. by default, it's 1. |

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

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 |
| StringValue | A string value (text) to store. Max 10000 characters. | optional, null 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 |
| StringValue | A string value (text) to store. Max 10000 characters. | optional, null 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

* The new **StringValue** may not be longer than 10000 characters in length. If it is, an error will be thrown.
* 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). |
| The 'StringValue' should have the size of max 10000 chars. |
| Not enough permission and/or machine code not found. |
