All Products
Search
Document Center

Edge Security Acceleration:PutKv

Last Updated:Jun 25, 2026

Creates or updates a single key-value pair in a namespace. The maximum size of a request is 2 MB.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

Namespace

string

Yes

The namespace name, which you specify when you call the CreateKvNamespace operation.

test_namespace

Key

string

Yes

The key name. The key can be up to 512 bytes and cannot contain spaces or forward slashes (/).

test_key

Value

string

Yes

The value. Maximum size: 2 MB (2,000,000 bytes). For larger values, use the PutKvWithHighCapacity operation.

test_value

Expiration

integer

No

The expiration time of the key-value pair, specified as a Unix timestamp in seconds. Must not be earlier than the current time. If both Expiration and ExpirationTtl are specified, ExpirationTtl takes precedence.

1690081381

ExpirationTtl

integer

No

The time-to-live (TTL) for the key-value pair, in seconds. If you specify both Expiration and ExpirationTtl, ExpirationTtl takes precedence.

3600

Base64

boolean

No

Specifies whether the Value parameter is Base64-encoded. Set to true for binary values. When true, Value must be a valid Base64-encoded string.

true

Response elements

Element

Type

Description

Example

object

The response object.

RequestId

string

The request ID.

EEEBE525-F576-1196-8DAF-2D70CA3F4D2F

Length

string

The length of the value.

4

Value

string

The value. If longer than 256 characters, only the first 100 and last 100 characters are returned.

test

Examples

Success response

JSON format

{
  "RequestId": "EEEBE525-F576-1196-8DAF-2D70CA3F4D2F",
  "Length": "4",
  "Value": "test"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidAccount.Malformed The specified account is invalid. The account is invalid, for example, the value is empty.
400 InvalidNameSpace.Malformed The specified namespace is invalid. The namespace name is invalid, for example, the value is empty.
400 InvalidKey.Malformed The specified key is invalid. The key name is invalid, for example, the value is empty.
400 InvalidKey.ExceedsMaximum The size of the key cannot exceed 512 bytes. The key exceeds the maximum length of 512 bytes.
400 InvalidValue.ExceedsMaximum The size of the value cannot exceed 2,000,000 bytes. The value exceeds the maximum size of 2,000,000 bytes.
403 InvalidKey.ExceedsCapacity The maximum capacity of a single namespace cannot exceed 1 GB. The namespace capacity exceeds the 1 GB limit.
403 Unauthorized.InvalidParameters The specified authentication parameters are invalid. The authentication parameters are invalid.
403 Unauthorized.InvalidTime The specified authentication time is invalid. The authentication time parameter is invalid. Verify the value and try again.
403 Unauthorized.InvalidToken Token authentication failed. The token is invalid. Verify the token and try again.
404 InvalidAccount.NotFound The specified account does not exist. The specified account does not exist.
404 InvalidNameSpace.NotFound The specified namespace does not exist.
404 InvalidKey.NotFound The specified key does not exist. The specified key-value pair does not exist.
406 InvalidNameSpace.Duplicate The specified namespace already exists. The specified namespace already exists.
406 InvalidNameSpace.QuotaFull The maximum number of namespaces is exceeded. The number of namespaces exceeds the quota.
429 TooManyRequests Too many requests are submitted. Too many requests. Try again later.
429 TooQuickRequests Request for putting or deleting keys are frequently submitted. Key-value pair put or delete requests are too frequent.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.