KV
List
Returns the namespaces owned by an account.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
params | array | No | [] | Array containing the necessary params. |
$response = $client->workers()->kv()->list('ACCOUNT_ID', []);
Create
Creates a namespace under the given title. A 400 is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
title | string | Yes | A human-readable string name for a Namespace. |
$response = $client->workers()->kv()->create('ACCOUNT_ID', 'TITLE');
Get
Get the namespace corresponding to the given ID.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. |
$response = $client->workers()->kv()->get('ACCOUNT_ID', 'NAMESPACE_ID');
Update
Modifies a namespace's title.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
title | string | Yes | A human-readable string name for a Namespace. |
$response = $client->workers()->kv()->update('ACCOUNT_ID', 'NAMESPACE_ID', 'TITLE');
Delete
Deletes the namespace corresponding to the given ID.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. |
$response = $client->workers()->kv()->delete('ACCOUNT_ID', 'NAMESPACE_ID');
List Keys
Lists a namespace keys.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
params | array | No | [] | Array containing the necessary params. |
$response = $client->workers()->kv()->listKeys('ACCOUNT_ID', 'NAMESPACE_ID', []);
Key Metadata
Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, :, !, %) in the key name.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
keyName | string | Yes | A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. |
$response = $client->workers()->kv()->keyMetadata('ACCOUNT_ID', 'NAMESPACE_ID', 'KEY_NAME');
Key Details
Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, :, !, %) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the expiration response header.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
keyName | string | Yes | A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. |
$response = $client->workers()->kv()->keyDetails('ACCOUNT_ID', 'NAMESPACE_ID', 'KEY_NAME');
Write Key With Metadata
Write a value identified by a key. Use URL-encoding to use special characters (for example, :, !, %) in the key name.
Body should be the value to be stored along with JSON metadata to be associated with the key/value pair.
Existing values, expirations, and metadata will be overwritten. If neither expiration nor expiration_ttl is specified, the key-value pair will never expire.
If both are set, expiration_ttl is used and expiration is ignored.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
keyName | string | Yes | A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. | |
values | array | Yes | keys and values. |
$response = $client->workers()->kv()->writeKeyWithMetadata('ACCOUNT_ID', 'NAMESPACE_ID', 'KEY_NAME', []);
Delete Key
Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
keyName | string | Yes | A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. |
$response = $client->workers()->kv()->deleteKey('ACCOUNT_ID', 'NAMESPACE_ID', 'KEY_NAME');
Write Multiple Keys
Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information.
Existing values and expirations will be overwritten. If neither expiration nor expiration_ttl is specified, the key-value pair will never expire.
If both are set, expiration_ttl is used and expiration is ignored. The entire request size must be 100 megabytes or less.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
values | array | Yes | keys and values. |
$response = $client->workers()->kv()->writeMultipleKeys('ACCOUNT_ID', 'NAMESPACE_ID', []);
Delete Multiple Keys
Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account identifier. | |
namespaceId | string | Yes | Namespace identifier tag. | |
keys | array | Yes | Keys. |
$response = $client->workers()->kv()->deleteMultipleKeys('ACCOUNT_ID', 'NAMESPACE_ID', []);

