SetKeyValueItem

View as Markdown

Creates or updates a key-value pair. If an existing key is passed, the method returns the existing item and changes the value if needed. The keys should be unique within a Voximplant application.

Allowed roles: Owner, Admin, Developer.

Example request: SetKeyValueItem example.

Authentication

AuthorizationBearer
Voximplant Management API uses signed JWT tokens generated from your service-account private key. Pass the token in the `Authorization` header as a Bearer value: ``` Authorization: Bearer $VOXIMPLANT_TOKEN ``` See [Authorization](/api-reference/management-api/authorization) for ready-to-copy snippets in bash, Python, Node.js and Go that turn your `credentials.json` into a token.

Query parameters

keystringRequired
Key, up to 200 characters. A key can contain a namespace that is written before the ':' symbol, for example, test:1234. Thus, namespace 'test' can be used as a pattern in the [GetKeyValueItems](/api-reference/management-api/keyvaluestorage/getkeyvalueitems) and [GetKeyValueKeys](/api-reference/management-api/keyvaluestorage/getkeyvaluekeys) methods to find the keys with the same namespace. The key should match the following regular expression: `^[a-zA-Z0-9а-яА-ЯёЁ_\-:;.#+]*$`
valuestringRequired
Value for the specified key, up to 2000 characters
application_idintegerRequired
Application ID
application_namestringOptional
Application name
ttlintegerOptional

Key expiry time in seconds. The value is in range of 0..7,776,000 (90 days), the default value is 30 days (2,592,000 seconds). The TTL is converted to an expires_at Unix timestamp field as part of the storage object. Note that one of the two parameters (ttl or expires_at) must be set

expires_atintegerOptional

Expiration date based on ttl (timestamp without milliseconds). Note that one of the two parameters (ttl or expires_at) must be set

Response

Successful response
resultobject

The key-value item