Set Key/Value
POST https://api.echovalue.dev/kv/<bucket>/<key>
Stores a value for the given key. If the key already exists, its value is overwritten.
Request
Section titled “Request”Headers:
| Header | Description |
|---|---|
x-token | Your API token |
Path parameters:
| Parameter | Type | Description |
|---|---|---|
bucket | string | Logical namespace. Max 30 characters. Cannot start with reserved- or end with ---. |
key | string | Key identifier. Max 30 characters. |
Query parameters:
| Parameter | Type | Description | Default |
|---|---|---|---|
ttl | integer | Time-to-live in seconds. Min: 0 (= max 30 days). Max: 2592000 (30 days). | 30 days |
Body (text/plain): The value to store. Max 1000 characters.
curl 'https://api.echovalue.dev/kv/default/mykey' \ -H 'x-token: mytoken' \ -d 'hello world'
# With 30-second TTLcurl 'https://api.echovalue.dev/kv/default/mykey?ttl=30' \ -H 'x-token: mytoken' \ -d 'hello world'Response
Section titled “Response”200 OK
OKResponse headers:
| Header | Description |
|---|---|
x-balance | Wallet balance after this call |
x-cost | Credits consumed |
See Response Headers for details.
Status Codes
Section titled “Status Codes”| Status | Meaning |
|---|---|
200 | Value stored successfully |
400 | Malformed request |
401 | Invalid token |
402 | Insufficient credits |
ttl=0means the maximum TTL, which is 30 days.- Values are stored as plain text and overwrite any existing value for the same bucket/key.