npx wrangler kv key put coupon "SAVE20" --ttl 86400 --namespace-id 2f1b3c4d5e6f7a8b9c0d1e2f3a4b5c6d

Category: Cloudflare

npx wrangler kv key put coupon "SAVE20" --ttl 86400 --namespace-id 2f1b3c4d5e6f7a8b9c0d1e2f3a4b5c6d

Write a KV key with a time to live

Stores the key with --ttl 86400, meaning it auto-expires 86400 seconds (one day) after being written. --expiration works the same but takes an absolute Unix timestamp. Useful for sessions, coupons, and cache-like data. Expired keys simply read as missing.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.