[{"data":1,"prerenderedAt":2616},["ShallowReactive",2],{"docs-navigation":3,"content-query-FrRnOxZCLP":348},[4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,190,193,196,199,202,205,208,211,214,217,220,223,226,229,232,235,238,241,244,247,250,253,256,259,262,265,268,271,274,277,280,283,285,288,291,294,297,300,303,306,309,312,315,318,321,324,327,330,333,336,339,342,345],{"_path":5,"title":6},"/docs/account/account-management","Account management",{"_path":8,"title":9},"/docs/account/mfa","Multi-factor authentication (MFA)",{"_path":11,"title":12},"/docs/account/team","Teams and sub-accounts",{"_path":14,"title":15},"/docs/account/billing-and-subscriptions","Billing & subscriptions",{"_path":17,"title":18},"/docs/account/access-tokens","Webhook Relay access tokens: permissions and subscription scopes",{"_path":20,"title":21},"/docs/clawhub","Webhook Relay on ClawHub",{"_path":23,"title":24},"/docs/email","Receive emails as webhooks",{"_path":26,"title":27},"/docs/email/payload","Email webhook payload",{"_path":29,"title":30},"/docs/email/filtering-and-policy","Sender filtering & policy",{"_path":32,"title":33},"/docs/email/cli","Create & poll email addresses from the CLI",{"_path":35,"title":36},"/docs","Getting Started",{"_path":38,"title":39},"/docs/installation/cli","CLI",{"_path":41,"title":42},"/docs/installation/docker","Docker container",{"_path":44,"title":45},"/docs/installation/docker-compose","Docker Compose",{"_path":47,"title":48},"/docs/installation/kubernetes","Kubernetes",{"_path":50,"title":51},"/docs/installation/autostart-windows","Autostart (Windows)",{"_path":53,"title":54},"/docs/installation/autostart-linux","Autostart (Linux)",{"_path":56,"title":57},"/docs/installation/autostart-macos","Autostart (MacOS)",{"_path":59,"title":60},"/docs/installation/behind-proxy","HTTP proxy configuration",{"_path":62,"title":63},"/docs/mcp","MCP Server",{"_path":65,"title":66},"/docs/outbound","Outbound Gateway: send webhooks to your customers",{"_path":68,"title":69},"/docs/outbound/setup","Set up the Outbound Gateway",{"_path":71,"title":72},"/docs/outbound/receiving","Receive and verify outbound webhooks",{"_path":74,"title":75},"/docs/outbound/operating","Monitor, retry and recover deliveries",{"_path":77,"title":78},"/docs/outbound/migrate","Migrate to the Outbound Gateway",{"_path":80,"title":81},"/docs/outbound/migrate/svix","Migrate from Svix",{"_path":83,"title":84},"/docs/outbound/migrate/hookdeck-outpost","Migrate from Hookdeck Outpost",{"_path":86,"title":87},"/docs/outbound/migrate/convoy","Migrate from Convoy",{"_path":89,"title":90},"/docs/outbound/migrate/hook0","Migrate from Hook0",{"_path":92,"title":93},"/docs/outbound/migrate/diy","Migrate a homegrown webhook sender",{"_path":95,"title":96},"/docs/security","Security & Tech",{"_path":98,"title":99},"/docs/service-connections","Service Connections",{"_path":101,"title":102},"/docs/service-connections/ai-providers","AI provider connections",{"_path":104,"title":105},"/docs/service-connections/aws_s3","AWS S3",{"_path":107,"title":108},"/docs/service-connections/aws_sns","AWS SNS",{"_path":110,"title":111},"/docs/service-connections/aws_sqs","AWS SQS",{"_path":113,"title":114},"/docs/service-connections/azure","Azure",{"_path":116,"title":117},"/docs/service-connections/gcp_gcs","GCP Cloud Storage",{"_path":119,"title":120},"/docs/service-connections/gcp_pubsub","GCP Pub/Sub",{"_path":122,"title":123},"/docs/service-connections/secrets","Secrets",{"_path":125,"title":126},"/docs/skills","Agent Skills",{"_path":128,"title":129},"/docs/skills-cli","skills.sh — the Agent Skills CLI",{"_path":131,"title":132},"/docs/tunnels/demoing-your-website","Demoing your website",{"_path":134,"title":135},"/docs/tunnels/regions","Regions",{"_path":137,"title":138},"/docs/tutorials/cicd/jenkins-bitbucket","Jenkins and Bitbucket",{"_path":140,"title":141},"/docs/tutorials/cicd/jenkins-github","Jenkins and GitHub",{"_path":143,"title":144},"/docs/tutorials/cicd/jenkins-plugin","Jenkins Plugin",{"_path":146,"title":147},"/docs/tutorials/cicd/jenkins-plugin-multibranch","Jenkins Multibranch Pipelines",{"_path":149,"title":150},"/docs/tutorials/cicd/kubernetes-operator","Kubernetes Operator",{"_path":152,"title":153},"/docs/tutorials/cicd/terraform-atlantis","Terraform Atlantis",{"_path":155,"title":156},"/docs/tutorials/cicd/webhook-exec","Execute scripts on webhook",{"_path":158,"title":159},"/docs/tutorials/edge/home-assistant","Home Assistant",{"_path":161,"title":162},"/docs/tutorials/edge/javascript-app","JavaScript app",{"_path":164,"title":165},"/docs/tutorials/edge/node-red","Node-RED",{"_path":167,"title":168},"/docs/tutorials/email/airtable","Email to Airtable",{"_path":170,"title":171},"/docs/tutorials/email/api","Email to API",{"_path":173,"title":174},"/docs/tutorials/email/database","Email to Database",{"_path":176,"title":177},"/docs/tutorials/email/discord","Email to Discord",{"_path":179,"title":180},"/docs/tutorials/email/google-sheets","Email to Google Sheets",{"_path":182,"title":183},"/docs/tutorials/email/microsoft-teams","Email to Microsoft Teams",{"_path":185,"title":186},"/docs/tutorials/email/notion","Email to Notion",{"_path":188,"title":189},"/docs/tutorials/email/slack","Email to Slack",{"_path":191,"title":192},"/docs/tutorials","Tutorials",{"_path":194,"title":195},"/docs/tutorials/n8n/email-trigger","n8n Email Trigger (Inbound Email)",{"_path":197,"title":198},"/docs/tutorials/n8n/webhook-trigger","n8n Webhook Trigger (No Public IP)",{"_path":200,"title":201},"/docs/tutorials/n8n/whatsapp-cloud-api-webhook","n8n WhatsApp Cloud API Webhook Setup",{"_path":203,"title":204},"/docs/tutorials/outbound/send-webhooks-nodejs","Send webhooks to your customers from a Node.js / TypeScript app",{"_path":206,"title":207},"/docs/tutorials/outbound/send-webhooks-go","Send webhooks to your customers from a Go service",{"_path":209,"title":210},"/docs/tutorials/outbound/nextjs-saas-webhooks","Add webhooks to a Next.js SaaS app",{"_path":212,"title":213},"/docs/tutorials/transform/docker-to-slack","DockerHub webhook to Slack notification",{"_path":215,"title":216},"/docs/tutorials/transform/enrich-webhooks","Enrich webhooks from APIs",{"_path":218,"title":219},"/docs/tutorials/transform/stripe-to-plain","Sync Stripe subscriptions to Plain.com tenants",{"_path":221,"title":222},"/docs/tutorials/warehouse/bigquery","GCP BigQuery",{"_path":224,"title":225},"/docs/webhooks/alerts","Alerts",{"_path":227,"title":228},"/docs/webhooks/auth/username-password","Username and password",{"_path":230,"title":231},"/docs/webhooks/auth/hmac","HMAC",{"_path":233,"title":234},"/docs/webhooks/auth/jwt","JWT authentication",{"_path":236,"title":237},"/docs/webhooks/auth/http-method","Auth using request method",{"_path":239,"title":240},"/docs/webhooks/cors","CORS for webhooks",{"_path":242,"title":243},"/docs/webhooks/cron/using-cron-webhooks","Schedule recurring webhooks",{"_path":245,"title":246},"/docs/webhooks/custom-domains","Custom webhook domains",{"_path":248,"title":249},"/docs/webhooks/custom-subdomains","Custom webhook subdomains",{"_path":251,"title":252},"/docs/webhooks/custom-webhook-response","Custom response to webhooks",{"_path":254,"title":255},"/docs/webhooks/durable-webhooks","Durable webhooks: reliable delivery with automatic retries",{"_path":257,"title":258},"/docs/webhooks/functions/manipulating-json","JSON encoding",{"_path":260,"title":261},"/docs/webhooks/functions/make-http-request","Make HTTP request",{"_path":263,"title":264},"/docs/webhooks/functions/modify-request","Modify webhook headers, body, method and path",{"_path":266,"title":267},"/docs/webhooks/functions/multipart-form-data","Multipart form to JSON",{"_path":269,"title":270},"/docs/webhooks/functions/url-encoded-data","URL Encoded Form",{"_path":272,"title":273},"/docs/webhooks/functions/working-with-time","Working with time",{"_path":275,"title":276},"/docs/webhooks/functions/send-emails","Sending emails",{"_path":278,"title":279},"/docs/webhooks/functions/crypto-functions","Base64, encryption",{"_path":281,"title":282},"/docs/webhooks/functions/integrate-into-cicd","Integrating into CI/CD",{"_path":284,"title":222},"/docs/webhooks/functions/big-query",{"_path":286,"title":287},"/docs/webhooks/functions/accessing-metadata","Accessing metadata",{"_path":289,"title":290},"/docs/webhooks/functions/response-functions","Response (post-delivery) functions",{"_path":292,"title":293},"/docs/webhooks/functions/alerting","Alerting from functions",{"_path":295,"title":296},"/docs/webhooks/functions/helper-libraries","Helper libraries",{"_path":298,"title":299},"/docs/webhooks/functions/transform-webhook-payload","Transform a webhook payload",{"_path":301,"title":302},"/docs/webhooks/functions/filter-webhooks","Filter or drop webhooks before forwarding",{"_path":304,"title":305},"/docs/webhooks/functions/provider-helpers","Provider-aware function helpers",{"_path":307,"title":308},"/docs/webhooks/functions/kv-store","KV store for functions: persist state, dedupe and cache with TTL",{"_path":310,"title":311},"/docs/webhooks/functions/file-store","File store for functions: save files and share pre-signed URLs",{"_path":313,"title":314},"/docs/webhooks/functions","Webhook transformations (functions): modify body, headers, method and path",{"_path":316,"title":317},"/docs/webhooks/internal/localhost","Receive webhooks on localhost with the relay CLI",{"_path":319,"title":320},"/docs/webhooks/large-webhooks","Large Webhooks",{"_path":322,"title":323},"/docs/webhooks/outbound-throttling","Outbound throttling: control webhook delivery speed",{"_path":325,"title":326},"/docs/webhooks/polling-webhooks","Polling webhooks with /v1/events",{"_path":328,"title":329},"/docs/webhooks/public/public-destination","Forward to public URL",{"_path":331,"title":332},"/docs/webhooks/public/multiple-destination-urls","Forward webhooks to multiple destinations",{"_path":334,"title":335},"/docs/webhooks/replay-on-agent-connect","Webhook replay on agent connect: recover missed webhooks",{"_path":337,"title":338},"/docs/webhooks/static-ip-address","Static IP Address",{"_path":340,"title":341},"/docs/webhooks/tls-ssl-errors","Fix TLS/SSL handshake errors: unsupported protocol, wrong version number, handshake failure",{"_path":343,"title":344},"/docs/webhooks/websocket-server","Connecting to websocket server",{"_path":346,"title":347},"/docs/webhooks/zero-retention-buckets","Zero Retention Buckets",{"_path":307,"_dir":349,"_draft":350,"_partial":350,"_locale":351,"title":308,"description":352,"intro":353,"type":354,"section":349,"level":355,"layout":356,"tags":357,"faq":360,"body":379,"_type":2609,"_id":2610,"_source":2611,"_file":2612,"_stem":2613,"_extension":2614,"sitemap":2615},"functions",false,"","Give Webhook Relay functions a persistent key-value store with require(\"kv:name\"): counters, webhook deduplication, cached API tokens and cursors with per-key TTL, in JavaScript or Lua. No database to run.","Persist JSON values between function runs with a built-in key-value store. Dedupe webhooks, cache tokens with a TTL and keep counters or cursors without running a database.","example","intermediate","doc",[358,359],"Functions","KV Store",[361,364,367,370,373,376],{"q":362,"a":363},"Does Webhook Relay have a key-value store for functions?","Yes. A function calls require(\"kv:name\") and gets a persistent key-value store with get, set, has, delete, setTtl and keys. Values are any JSON-serializable data up to 256 KiB, and each key can have its own TTL in seconds. It works in both JavaScript and Lua functions.",{"q":365,"a":366},"Do I need to create the KV store before using it?","No. The first time a function runs require(\"kv:sessions\"), Webhook Relay creates an empty store named sessions and binds it to that function. Other functions that require the same name share the same store. You can also create, browse and clear stores in the dashboard under Functions, KV.",{"q":368,"a":369},"Can I use the KV store as a cache with expiry?","Yes. Pass a TTL in seconds as the third argument to set, for example kv.set(\"token\", value, 3600). After the TTL the key reads as missing, so the function fetches a fresh value and stores it again. setTtl changes the expiry of an existing key without rewriting its value.",{"q":371,"a":372},"How do I deduplicate webhooks with the KV store?","Use the provider's event or delivery ID as the key. If kv.has(id) is true, call r.stopForwarding() so the duplicate is logged but not delivered; otherwise store the ID with a TTL that covers the provider's retry window, such as seven days for Stripe, and let the request through.",{"q":374,"a":375},"Are KV operations atomic?","No. Each call is a single read or write, and a get followed by a set is not a transaction. Two concurrent executions can read the same old value. For a counter that must never race, serialize the work in one consumer instead of relying on the KV store.",{"q":377,"a":378},"What are the KV store limits?","A value can be up to 256 KiB once JSON-encoded and a key up to 512 bytes. keys() returns 100 keys per page by default and at most 1,000. An account can have up to 50 function stores in total, counting KV and file stores together.",{"type":380,"children":381,"toc":2599},"root",[382,405,1303,1310,1347,1368,1389,1395,1408,1636,1641,1647,1652,1852,1864,1870,1875,2288,2300,2306,2364,2383,2389,2469,2481,2487,2543,2549,2593],{"type":383,"tag":384,"props":385,"children":386},"element","p",{},[387,403],{"type":383,"tag":388,"props":389,"children":390},"strong",{},[391,394,401],{"type":392,"value":393},"text","A Webhook Relay function can keep state between runs with ",{"type":383,"tag":395,"props":396,"children":398},"code",{"className":397},[],[399],{"type":392,"value":400},"require(\"kv:name\")",{"type":392,"value":402},", a persistent key-value store with optional per-key TTL.",{"type":392,"value":404}," Use it to deduplicate webhooks, cache an access token until it expires, count events or remember a sync cursor, with no database or Redis to run. The store is created automatically the first time a function imports it.",{"type":383,"tag":406,"props":407,"children":408},"code-switcher",{},[409,879],{"type":383,"tag":410,"props":411,"children":412},"template",{"v-slot:javascript":351},[413],{"type":383,"tag":414,"props":415,"children":419},"pre",{"className":416,"code":417,"language":418,"meta":351,"style":351},"language-javascript shiki shiki-themes github-dark","const kv = require(\"kv:sessions\")\n\n// Store any JSON value; the optional third argument is a TTL in seconds\nkv.set(\"customer:42\", { plan: \"pro\", seats: 5 }, 3600)\n\n// Read it back (undefined when missing or expired)\nconst customer = kv.get(\"customer:42\")\n\n// Keep a counter across executions\nconst seen = (kv.get(\"events_seen\") || 0) + 1\nkv.set(\"events_seen\", seen)\n\n// Check, extend, list by prefix, delete\nif (kv.has(\"customer:42\")) {\n  kv.setTtl(\"customer:42\", 7200)\n}\nconst page = kv.keys(\"customer:\", 100) // { keys: [...], cursor: \"...\" }\nkv.delete(\"customer:42\")\n","javascript",[420],{"type":383,"tag":395,"props":421,"children":422},{"__ignoreMap":351},[423,469,479,489,546,554,563,602,610,619,683,708,716,725,756,792,801,854],{"type":383,"tag":424,"props":425,"children":428},"span",{"class":426,"line":427},"line",1,[429,435,441,446,452,458,464],{"type":383,"tag":424,"props":430,"children":432},{"style":431},"--shiki-default:#F97583",[433],{"type":392,"value":434},"const",{"type":383,"tag":424,"props":436,"children":438},{"style":437},"--shiki-default:#79B8FF",[439],{"type":392,"value":440}," kv",{"type":383,"tag":424,"props":442,"children":443},{"style":431},[444],{"type":392,"value":445}," =",{"type":383,"tag":424,"props":447,"children":449},{"style":448},"--shiki-default:#B392F0",[450],{"type":392,"value":451}," require",{"type":383,"tag":424,"props":453,"children":455},{"style":454},"--shiki-default:#E1E4E8",[456],{"type":392,"value":457},"(",{"type":383,"tag":424,"props":459,"children":461},{"style":460},"--shiki-default:#9ECBFF",[462],{"type":392,"value":463},"\"kv:sessions\"",{"type":383,"tag":424,"props":465,"children":466},{"style":454},[467],{"type":392,"value":468},")\n",{"type":383,"tag":424,"props":470,"children":472},{"class":426,"line":471},2,[473],{"type":383,"tag":424,"props":474,"children":476},{"emptyLinePlaceholder":475},true,[477],{"type":392,"value":478},"\n",{"type":383,"tag":424,"props":480,"children":482},{"class":426,"line":481},3,[483],{"type":383,"tag":424,"props":484,"children":486},{"style":485},"--shiki-default:#6A737D",[487],{"type":392,"value":488},"// Store any JSON value; the optional third argument is a TTL in seconds\n",{"type":383,"tag":424,"props":490,"children":492},{"class":426,"line":491},4,[493,498,503,507,512,517,522,527,532,537,542],{"type":383,"tag":424,"props":494,"children":495},{"style":454},[496],{"type":392,"value":497},"kv.",{"type":383,"tag":424,"props":499,"children":500},{"style":448},[501],{"type":392,"value":502},"set",{"type":383,"tag":424,"props":504,"children":505},{"style":454},[506],{"type":392,"value":457},{"type":383,"tag":424,"props":508,"children":509},{"style":460},[510],{"type":392,"value":511},"\"customer:42\"",{"type":383,"tag":424,"props":513,"children":514},{"style":454},[515],{"type":392,"value":516},", { plan: ",{"type":383,"tag":424,"props":518,"children":519},{"style":460},[520],{"type":392,"value":521},"\"pro\"",{"type":383,"tag":424,"props":523,"children":524},{"style":454},[525],{"type":392,"value":526},", seats: ",{"type":383,"tag":424,"props":528,"children":529},{"style":437},[530],{"type":392,"value":531},"5",{"type":383,"tag":424,"props":533,"children":534},{"style":454},[535],{"type":392,"value":536}," }, ",{"type":383,"tag":424,"props":538,"children":539},{"style":437},[540],{"type":392,"value":541},"3600",{"type":383,"tag":424,"props":543,"children":544},{"style":454},[545],{"type":392,"value":468},{"type":383,"tag":424,"props":547,"children":549},{"class":426,"line":548},5,[550],{"type":383,"tag":424,"props":551,"children":552},{"emptyLinePlaceholder":475},[553],{"type":392,"value":478},{"type":383,"tag":424,"props":555,"children":557},{"class":426,"line":556},6,[558],{"type":383,"tag":424,"props":559,"children":560},{"style":485},[561],{"type":392,"value":562},"// Read it back (undefined when missing or expired)\n",{"type":383,"tag":424,"props":564,"children":566},{"class":426,"line":565},7,[567,571,576,580,585,590,594,598],{"type":383,"tag":424,"props":568,"children":569},{"style":431},[570],{"type":392,"value":434},{"type":383,"tag":424,"props":572,"children":573},{"style":437},[574],{"type":392,"value":575}," customer",{"type":383,"tag":424,"props":577,"children":578},{"style":431},[579],{"type":392,"value":445},{"type":383,"tag":424,"props":581,"children":582},{"style":454},[583],{"type":392,"value":584}," kv.",{"type":383,"tag":424,"props":586,"children":587},{"style":448},[588],{"type":392,"value":589},"get",{"type":383,"tag":424,"props":591,"children":592},{"style":454},[593],{"type":392,"value":457},{"type":383,"tag":424,"props":595,"children":596},{"style":460},[597],{"type":392,"value":511},{"type":383,"tag":424,"props":599,"children":600},{"style":454},[601],{"type":392,"value":468},{"type":383,"tag":424,"props":603,"children":605},{"class":426,"line":604},8,[606],{"type":383,"tag":424,"props":607,"children":608},{"emptyLinePlaceholder":475},[609],{"type":392,"value":478},{"type":383,"tag":424,"props":611,"children":613},{"class":426,"line":612},9,[614],{"type":383,"tag":424,"props":615,"children":616},{"style":485},[617],{"type":392,"value":618},"// Keep a counter across executions\n",{"type":383,"tag":424,"props":620,"children":622},{"class":426,"line":621},10,[623,627,632,636,641,645,649,654,659,664,669,673,678],{"type":383,"tag":424,"props":624,"children":625},{"style":431},[626],{"type":392,"value":434},{"type":383,"tag":424,"props":628,"children":629},{"style":437},[630],{"type":392,"value":631}," seen",{"type":383,"tag":424,"props":633,"children":634},{"style":431},[635],{"type":392,"value":445},{"type":383,"tag":424,"props":637,"children":638},{"style":454},[639],{"type":392,"value":640}," (kv.",{"type":383,"tag":424,"props":642,"children":643},{"style":448},[644],{"type":392,"value":589},{"type":383,"tag":424,"props":646,"children":647},{"style":454},[648],{"type":392,"value":457},{"type":383,"tag":424,"props":650,"children":651},{"style":460},[652],{"type":392,"value":653},"\"events_seen\"",{"type":383,"tag":424,"props":655,"children":656},{"style":454},[657],{"type":392,"value":658},") ",{"type":383,"tag":424,"props":660,"children":661},{"style":431},[662],{"type":392,"value":663},"||",{"type":383,"tag":424,"props":665,"children":666},{"style":437},[667],{"type":392,"value":668}," 0",{"type":383,"tag":424,"props":670,"children":671},{"style":454},[672],{"type":392,"value":658},{"type":383,"tag":424,"props":674,"children":675},{"style":431},[676],{"type":392,"value":677},"+",{"type":383,"tag":424,"props":679,"children":680},{"style":437},[681],{"type":392,"value":682}," 1\n",{"type":383,"tag":424,"props":684,"children":686},{"class":426,"line":685},11,[687,691,695,699,703],{"type":383,"tag":424,"props":688,"children":689},{"style":454},[690],{"type":392,"value":497},{"type":383,"tag":424,"props":692,"children":693},{"style":448},[694],{"type":392,"value":502},{"type":383,"tag":424,"props":696,"children":697},{"style":454},[698],{"type":392,"value":457},{"type":383,"tag":424,"props":700,"children":701},{"style":460},[702],{"type":392,"value":653},{"type":383,"tag":424,"props":704,"children":705},{"style":454},[706],{"type":392,"value":707},", seen)\n",{"type":383,"tag":424,"props":709,"children":711},{"class":426,"line":710},12,[712],{"type":383,"tag":424,"props":713,"children":714},{"emptyLinePlaceholder":475},[715],{"type":392,"value":478},{"type":383,"tag":424,"props":717,"children":719},{"class":426,"line":718},13,[720],{"type":383,"tag":424,"props":721,"children":722},{"style":485},[723],{"type":392,"value":724},"// Check, extend, list by prefix, delete\n",{"type":383,"tag":424,"props":726,"children":728},{"class":426,"line":727},14,[729,734,738,743,747,751],{"type":383,"tag":424,"props":730,"children":731},{"style":431},[732],{"type":392,"value":733},"if",{"type":383,"tag":424,"props":735,"children":736},{"style":454},[737],{"type":392,"value":640},{"type":383,"tag":424,"props":739,"children":740},{"style":448},[741],{"type":392,"value":742},"has",{"type":383,"tag":424,"props":744,"children":745},{"style":454},[746],{"type":392,"value":457},{"type":383,"tag":424,"props":748,"children":749},{"style":460},[750],{"type":392,"value":511},{"type":383,"tag":424,"props":752,"children":753},{"style":454},[754],{"type":392,"value":755},")) {\n",{"type":383,"tag":424,"props":757,"children":759},{"class":426,"line":758},15,[760,765,770,774,778,783,788],{"type":383,"tag":424,"props":761,"children":762},{"style":454},[763],{"type":392,"value":764},"  kv.",{"type":383,"tag":424,"props":766,"children":767},{"style":448},[768],{"type":392,"value":769},"setTtl",{"type":383,"tag":424,"props":771,"children":772},{"style":454},[773],{"type":392,"value":457},{"type":383,"tag":424,"props":775,"children":776},{"style":460},[777],{"type":392,"value":511},{"type":383,"tag":424,"props":779,"children":780},{"style":454},[781],{"type":392,"value":782},", ",{"type":383,"tag":424,"props":784,"children":785},{"style":437},[786],{"type":392,"value":787},"7200",{"type":383,"tag":424,"props":789,"children":790},{"style":454},[791],{"type":392,"value":468},{"type":383,"tag":424,"props":793,"children":795},{"class":426,"line":794},16,[796],{"type":383,"tag":424,"props":797,"children":798},{"style":454},[799],{"type":392,"value":800},"}\n",{"type":383,"tag":424,"props":802,"children":804},{"class":426,"line":803},17,[805,809,814,818,822,827,831,836,840,845,849],{"type":383,"tag":424,"props":806,"children":807},{"style":431},[808],{"type":392,"value":434},{"type":383,"tag":424,"props":810,"children":811},{"style":437},[812],{"type":392,"value":813}," page",{"type":383,"tag":424,"props":815,"children":816},{"style":431},[817],{"type":392,"value":445},{"type":383,"tag":424,"props":819,"children":820},{"style":454},[821],{"type":392,"value":584},{"type":383,"tag":424,"props":823,"children":824},{"style":448},[825],{"type":392,"value":826},"keys",{"type":383,"tag":424,"props":828,"children":829},{"style":454},[830],{"type":392,"value":457},{"type":383,"tag":424,"props":832,"children":833},{"style":460},[834],{"type":392,"value":835},"\"customer:\"",{"type":383,"tag":424,"props":837,"children":838},{"style":454},[839],{"type":392,"value":782},{"type":383,"tag":424,"props":841,"children":842},{"style":437},[843],{"type":392,"value":844},"100",{"type":383,"tag":424,"props":846,"children":847},{"style":454},[848],{"type":392,"value":658},{"type":383,"tag":424,"props":850,"children":851},{"style":485},[852],{"type":392,"value":853},"// { keys: [...], cursor: \"...\" }\n",{"type":383,"tag":424,"props":855,"children":857},{"class":426,"line":856},18,[858,862,867,871,875],{"type":383,"tag":424,"props":859,"children":860},{"style":454},[861],{"type":392,"value":497},{"type":383,"tag":424,"props":863,"children":864},{"style":448},[865],{"type":392,"value":866},"delete",{"type":383,"tag":424,"props":868,"children":869},{"style":454},[870],{"type":392,"value":457},{"type":383,"tag":424,"props":872,"children":873},{"style":460},[874],{"type":392,"value":511},{"type":383,"tag":424,"props":876,"children":877},{"style":454},[878],{"type":392,"value":468},{"type":383,"tag":410,"props":880,"children":881},{"v-slot:lua":351},[882],{"type":383,"tag":414,"props":883,"children":887},{"className":884,"code":885,"language":886,"meta":351,"style":351},"language-lua shiki shiki-themes github-dark","local kv = require(\"kv:sessions\")\n\n-- Store any JSON value; the optional third argument is a TTL in seconds\nkv.set(\"customer:42\", { plan = \"pro\", seats = 5 }, 3600)\n\n-- Read it back (nil when missing or expired)\nlocal customer = kv.get(\"customer:42\")\n\n-- Keep a counter across executions\nlocal seen = (kv.get(\"events_seen\") or 0) + 1\nkv.set(\"events_seen\", seen)\n\n-- Check, extend, list by prefix, delete\nif kv.has(\"customer:42\") then\n  kv.setTtl(\"customer:42\", 7200)\nend\nlocal page = kv.keys(\"customer:\", 100) -- { keys = {...}, cursor = \"...\" }\nkv.delete(\"customer:42\")\n","lua",[888],{"type":383,"tag":395,"props":889,"children":890},{"__ignoreMap":351},[891,925,932,940,999,1006,1014,1050,1057,1065,1122,1145,1152,1160,1192,1223,1231,1280],{"type":383,"tag":424,"props":892,"children":893},{"class":426,"line":427},[894,899,904,909,913,917,921],{"type":383,"tag":424,"props":895,"children":896},{"style":431},[897],{"type":392,"value":898},"local",{"type":383,"tag":424,"props":900,"children":901},{"style":454},[902],{"type":392,"value":903}," kv ",{"type":383,"tag":424,"props":905,"children":906},{"style":431},[907],{"type":392,"value":908},"=",{"type":383,"tag":424,"props":910,"children":911},{"style":437},[912],{"type":392,"value":451},{"type":383,"tag":424,"props":914,"children":915},{"style":454},[916],{"type":392,"value":457},{"type":383,"tag":424,"props":918,"children":919},{"style":460},[920],{"type":392,"value":463},{"type":383,"tag":424,"props":922,"children":923},{"style":454},[924],{"type":392,"value":468},{"type":383,"tag":424,"props":926,"children":927},{"class":426,"line":471},[928],{"type":383,"tag":424,"props":929,"children":930},{"emptyLinePlaceholder":475},[931],{"type":392,"value":478},{"type":383,"tag":424,"props":933,"children":934},{"class":426,"line":481},[935],{"type":383,"tag":424,"props":936,"children":937},{"style":485},[938],{"type":392,"value":939},"-- Store any JSON value; the optional third argument is a TTL in seconds\n",{"type":383,"tag":424,"props":941,"children":942},{"class":426,"line":491},[943,947,951,955,959,964,968,973,978,982,987,991,995],{"type":383,"tag":424,"props":944,"children":945},{"style":454},[946],{"type":392,"value":497},{"type":383,"tag":424,"props":948,"children":949},{"style":437},[950],{"type":392,"value":502},{"type":383,"tag":424,"props":952,"children":953},{"style":454},[954],{"type":392,"value":457},{"type":383,"tag":424,"props":956,"children":957},{"style":460},[958],{"type":392,"value":511},{"type":383,"tag":424,"props":960,"children":961},{"style":454},[962],{"type":392,"value":963},", { plan ",{"type":383,"tag":424,"props":965,"children":966},{"style":431},[967],{"type":392,"value":908},{"type":383,"tag":424,"props":969,"children":970},{"style":460},[971],{"type":392,"value":972}," \"pro\"",{"type":383,"tag":424,"props":974,"children":975},{"style":454},[976],{"type":392,"value":977},", seats ",{"type":383,"tag":424,"props":979,"children":980},{"style":431},[981],{"type":392,"value":908},{"type":383,"tag":424,"props":983,"children":984},{"style":437},[985],{"type":392,"value":986}," 5",{"type":383,"tag":424,"props":988,"children":989},{"style":454},[990],{"type":392,"value":536},{"type":383,"tag":424,"props":992,"children":993},{"style":437},[994],{"type":392,"value":541},{"type":383,"tag":424,"props":996,"children":997},{"style":454},[998],{"type":392,"value":468},{"type":383,"tag":424,"props":1000,"children":1001},{"class":426,"line":548},[1002],{"type":383,"tag":424,"props":1003,"children":1004},{"emptyLinePlaceholder":475},[1005],{"type":392,"value":478},{"type":383,"tag":424,"props":1007,"children":1008},{"class":426,"line":556},[1009],{"type":383,"tag":424,"props":1010,"children":1011},{"style":485},[1012],{"type":392,"value":1013},"-- Read it back (nil when missing or expired)\n",{"type":383,"tag":424,"props":1015,"children":1016},{"class":426,"line":565},[1017,1021,1026,1030,1034,1038,1042,1046],{"type":383,"tag":424,"props":1018,"children":1019},{"style":431},[1020],{"type":392,"value":898},{"type":383,"tag":424,"props":1022,"children":1023},{"style":454},[1024],{"type":392,"value":1025}," customer ",{"type":383,"tag":424,"props":1027,"children":1028},{"style":431},[1029],{"type":392,"value":908},{"type":383,"tag":424,"props":1031,"children":1032},{"style":454},[1033],{"type":392,"value":584},{"type":383,"tag":424,"props":1035,"children":1036},{"style":437},[1037],{"type":392,"value":589},{"type":383,"tag":424,"props":1039,"children":1040},{"style":454},[1041],{"type":392,"value":457},{"type":383,"tag":424,"props":1043,"children":1044},{"style":460},[1045],{"type":392,"value":511},{"type":383,"tag":424,"props":1047,"children":1048},{"style":454},[1049],{"type":392,"value":468},{"type":383,"tag":424,"props":1051,"children":1052},{"class":426,"line":604},[1053],{"type":383,"tag":424,"props":1054,"children":1055},{"emptyLinePlaceholder":475},[1056],{"type":392,"value":478},{"type":383,"tag":424,"props":1058,"children":1059},{"class":426,"line":612},[1060],{"type":383,"tag":424,"props":1061,"children":1062},{"style":485},[1063],{"type":392,"value":1064},"-- Keep a counter across executions\n",{"type":383,"tag":424,"props":1066,"children":1067},{"class":426,"line":621},[1068,1072,1077,1081,1085,1089,1093,1097,1101,1106,1110,1114,1118],{"type":383,"tag":424,"props":1069,"children":1070},{"style":431},[1071],{"type":392,"value":898},{"type":383,"tag":424,"props":1073,"children":1074},{"style":454},[1075],{"type":392,"value":1076}," seen ",{"type":383,"tag":424,"props":1078,"children":1079},{"style":431},[1080],{"type":392,"value":908},{"type":383,"tag":424,"props":1082,"children":1083},{"style":454},[1084],{"type":392,"value":640},{"type":383,"tag":424,"props":1086,"children":1087},{"style":437},[1088],{"type":392,"value":589},{"type":383,"tag":424,"props":1090,"children":1091},{"style":454},[1092],{"type":392,"value":457},{"type":383,"tag":424,"props":1094,"children":1095},{"style":460},[1096],{"type":392,"value":653},{"type":383,"tag":424,"props":1098,"children":1099},{"style":454},[1100],{"type":392,"value":658},{"type":383,"tag":424,"props":1102,"children":1103},{"style":431},[1104],{"type":392,"value":1105},"or",{"type":383,"tag":424,"props":1107,"children":1108},{"style":437},[1109],{"type":392,"value":668},{"type":383,"tag":424,"props":1111,"children":1112},{"style":454},[1113],{"type":392,"value":658},{"type":383,"tag":424,"props":1115,"children":1116},{"style":431},[1117],{"type":392,"value":677},{"type":383,"tag":424,"props":1119,"children":1120},{"style":437},[1121],{"type":392,"value":682},{"type":383,"tag":424,"props":1123,"children":1124},{"class":426,"line":685},[1125,1129,1133,1137,1141],{"type":383,"tag":424,"props":1126,"children":1127},{"style":454},[1128],{"type":392,"value":497},{"type":383,"tag":424,"props":1130,"children":1131},{"style":437},[1132],{"type":392,"value":502},{"type":383,"tag":424,"props":1134,"children":1135},{"style":454},[1136],{"type":392,"value":457},{"type":383,"tag":424,"props":1138,"children":1139},{"style":460},[1140],{"type":392,"value":653},{"type":383,"tag":424,"props":1142,"children":1143},{"style":454},[1144],{"type":392,"value":707},{"type":383,"tag":424,"props":1146,"children":1147},{"class":426,"line":710},[1148],{"type":383,"tag":424,"props":1149,"children":1150},{"emptyLinePlaceholder":475},[1151],{"type":392,"value":478},{"type":383,"tag":424,"props":1153,"children":1154},{"class":426,"line":718},[1155],{"type":383,"tag":424,"props":1156,"children":1157},{"style":485},[1158],{"type":392,"value":1159},"-- Check, extend, list by prefix, delete\n",{"type":383,"tag":424,"props":1161,"children":1162},{"class":426,"line":727},[1163,1167,1171,1175,1179,1183,1187],{"type":383,"tag":424,"props":1164,"children":1165},{"style":431},[1166],{"type":392,"value":733},{"type":383,"tag":424,"props":1168,"children":1169},{"style":454},[1170],{"type":392,"value":584},{"type":383,"tag":424,"props":1172,"children":1173},{"style":437},[1174],{"type":392,"value":742},{"type":383,"tag":424,"props":1176,"children":1177},{"style":454},[1178],{"type":392,"value":457},{"type":383,"tag":424,"props":1180,"children":1181},{"style":460},[1182],{"type":392,"value":511},{"type":383,"tag":424,"props":1184,"children":1185},{"style":454},[1186],{"type":392,"value":658},{"type":383,"tag":424,"props":1188,"children":1189},{"style":431},[1190],{"type":392,"value":1191},"then\n",{"type":383,"tag":424,"props":1193,"children":1194},{"class":426,"line":758},[1195,1199,1203,1207,1211,1215,1219],{"type":383,"tag":424,"props":1196,"children":1197},{"style":454},[1198],{"type":392,"value":764},{"type":383,"tag":424,"props":1200,"children":1201},{"style":437},[1202],{"type":392,"value":769},{"type":383,"tag":424,"props":1204,"children":1205},{"style":454},[1206],{"type":392,"value":457},{"type":383,"tag":424,"props":1208,"children":1209},{"style":460},[1210],{"type":392,"value":511},{"type":383,"tag":424,"props":1212,"children":1213},{"style":454},[1214],{"type":392,"value":782},{"type":383,"tag":424,"props":1216,"children":1217},{"style":437},[1218],{"type":392,"value":787},{"type":383,"tag":424,"props":1220,"children":1221},{"style":454},[1222],{"type":392,"value":468},{"type":383,"tag":424,"props":1224,"children":1225},{"class":426,"line":794},[1226],{"type":383,"tag":424,"props":1227,"children":1228},{"style":431},[1229],{"type":392,"value":1230},"end\n",{"type":383,"tag":424,"props":1232,"children":1233},{"class":426,"line":803},[1234,1238,1243,1247,1251,1255,1259,1263,1267,1271,1275],{"type":383,"tag":424,"props":1235,"children":1236},{"style":431},[1237],{"type":392,"value":898},{"type":383,"tag":424,"props":1239,"children":1240},{"style":454},[1241],{"type":392,"value":1242}," page ",{"type":383,"tag":424,"props":1244,"children":1245},{"style":431},[1246],{"type":392,"value":908},{"type":383,"tag":424,"props":1248,"children":1249},{"style":454},[1250],{"type":392,"value":584},{"type":383,"tag":424,"props":1252,"children":1253},{"style":437},[1254],{"type":392,"value":826},{"type":383,"tag":424,"props":1256,"children":1257},{"style":454},[1258],{"type":392,"value":457},{"type":383,"tag":424,"props":1260,"children":1261},{"style":460},[1262],{"type":392,"value":835},{"type":383,"tag":424,"props":1264,"children":1265},{"style":454},[1266],{"type":392,"value":782},{"type":383,"tag":424,"props":1268,"children":1269},{"style":437},[1270],{"type":392,"value":844},{"type":383,"tag":424,"props":1272,"children":1273},{"style":454},[1274],{"type":392,"value":658},{"type":383,"tag":424,"props":1276,"children":1277},{"style":485},[1278],{"type":392,"value":1279},"-- { keys = {...}, cursor = \"...\" }\n",{"type":383,"tag":424,"props":1281,"children":1282},{"class":426,"line":856},[1283,1287,1291,1295,1299],{"type":383,"tag":424,"props":1284,"children":1285},{"style":454},[1286],{"type":392,"value":497},{"type":383,"tag":424,"props":1288,"children":1289},{"style":437},[1290],{"type":392,"value":866},{"type":383,"tag":424,"props":1292,"children":1293},{"style":454},[1294],{"type":392,"value":457},{"type":383,"tag":424,"props":1296,"children":1297},{"style":460},[1298],{"type":392,"value":511},{"type":383,"tag":424,"props":1300,"children":1301},{"style":454},[1302],{"type":392,"value":468},{"type":383,"tag":1304,"props":1305,"children":1307},"h2",{"id":1306},"how-stores-are-created-and-shared",[1308],{"type":392,"value":1309},"How stores are created and shared",{"type":383,"tag":384,"props":1311,"children":1312},{},[1313,1315,1321,1323,1329,1331,1337,1339,1345],{"type":392,"value":1314},"The name after ",{"type":383,"tag":395,"props":1316,"children":1318},{"className":1317},[],[1319],{"type":392,"value":1320},"kv:",{"type":392,"value":1322}," is the store. The first time a function runs ",{"type":383,"tag":395,"props":1324,"children":1326},{"className":1325},[],[1327],{"type":392,"value":1328},"require(\"kv:sessions\")",{"type":392,"value":1330},", Webhook Relay creates an empty KV store called ",{"type":383,"tag":395,"props":1332,"children":1334},{"className":1333},[],[1335],{"type":392,"value":1336},"sessions",{"type":392,"value":1338}," in your account and binds it to that function. Any other function that requires ",{"type":383,"tag":395,"props":1340,"children":1342},{"className":1341},[],[1343],{"type":392,"value":1344},"kv:sessions",{"type":392,"value":1346}," uses the same store, so two functions can share state (for example, one writes a cursor and another reads it).",{"type":383,"tag":384,"props":1348,"children":1349},{},[1350,1352,1358,1360,1366],{"type":392,"value":1351},"Store names start with a letter, contain only letters, numbers, ",{"type":383,"tag":395,"props":1353,"children":1355},{"className":1354},[],[1356],{"type":392,"value":1357},"_",{"type":392,"value":1359}," or ",{"type":383,"tag":395,"props":1361,"children":1363},{"className":1362},[],[1364],{"type":392,"value":1365},"-",{"type":392,"value":1367},", and are at most 64 characters.",{"type":383,"tag":384,"props":1369,"children":1370},{},[1371,1373,1387],{"type":392,"value":1372},"You can see and manage stores in the dashboard under ",{"type":383,"tag":388,"props":1374,"children":1375},{},[1376,1378],{"type":392,"value":1377},"Functions → ",{"type":383,"tag":1379,"props":1380,"children":1384},"a",{"href":1381,"rel":1382},"https://my.webhookrelay.com/functions?tab=kv",[1383],"nofollow",[1385],{"type":392,"value":1386},"KV",{"type":392,"value":1388},": browse keys and values, edit or expire entries, clear a store, or delete it. Deleting a store works as a reset. The next run that requires the name gets a fresh, empty store.",{"type":383,"tag":1304,"props":1390,"children":1392},{"id":1391},"api",[1393],{"type":392,"value":1394},"API",{"type":383,"tag":384,"props":1396,"children":1397},{},[1398,1400,1406],{"type":392,"value":1399},"All methods are synchronous: they return the result directly, with no ",{"type":383,"tag":395,"props":1401,"children":1403},{"className":1402},[],[1404],{"type":392,"value":1405},"await",{"type":392,"value":1407}," or callback.",{"type":383,"tag":1409,"props":1410,"children":1411},"table",{},[1412,1436],{"type":383,"tag":1413,"props":1414,"children":1415},"thead",{},[1416],{"type":383,"tag":1417,"props":1418,"children":1419},"tr",{},[1420,1426,1431],{"type":383,"tag":1421,"props":1422,"children":1423},"th",{},[1424],{"type":392,"value":1425},"Method",{"type":383,"tag":1421,"props":1427,"children":1428},{},[1429],{"type":392,"value":1430},"Returns",{"type":383,"tag":1421,"props":1432,"children":1433},{},[1434],{"type":392,"value":1435},"Notes",{"type":383,"tag":1437,"props":1438,"children":1439},"tbody",{},[1440,1479,1534,1554,1577,1602],{"type":383,"tag":1417,"props":1441,"children":1442},{},[1443,1453,1474],{"type":383,"tag":1444,"props":1445,"children":1446},"td",{},[1447],{"type":383,"tag":395,"props":1448,"children":1450},{"className":1449},[],[1451],{"type":392,"value":1452},"kv.get(key)",{"type":383,"tag":1444,"props":1454,"children":1455},{},[1456,1458,1464,1466,1472],{"type":392,"value":1457},"value, or ",{"type":383,"tag":395,"props":1459,"children":1461},{"className":1460},[],[1462],{"type":392,"value":1463},"undefined",{"type":392,"value":1465}," (",{"type":383,"tag":395,"props":1467,"children":1469},{"className":1468},[],[1470],{"type":392,"value":1471},"nil",{"type":392,"value":1473}," in Lua)",{"type":383,"tag":1444,"props":1475,"children":1476},{},[1477],{"type":392,"value":1478},"Missing and expired keys both read as absent",{"type":383,"tag":1417,"props":1480,"children":1481},{},[1482,1491,1500],{"type":383,"tag":1444,"props":1483,"children":1484},{},[1485],{"type":383,"tag":395,"props":1486,"children":1488},{"className":1487},[],[1489],{"type":392,"value":1490},"kv.set(key, value[, ttl])",{"type":383,"tag":1444,"props":1492,"children":1493},{},[1494],{"type":383,"tag":395,"props":1495,"children":1497},{"className":1496},[],[1498],{"type":392,"value":1499},"true",{"type":383,"tag":1444,"props":1501,"children":1502},{},[1503,1509,1511,1517,1519,1525,1527,1532],{"type":383,"tag":395,"props":1504,"children":1506},{"className":1505},[],[1507],{"type":392,"value":1508},"value",{"type":392,"value":1510}," is any JSON-serializable data. ",{"type":383,"tag":395,"props":1512,"children":1514},{"className":1513},[],[1515],{"type":392,"value":1516},"ttl",{"type":392,"value":1518}," in seconds; ",{"type":383,"tag":395,"props":1520,"children":1522},{"className":1521},[],[1523],{"type":392,"value":1524},"0",{"type":392,"value":1526}," or omitted means no expiry. A new ",{"type":383,"tag":395,"props":1528,"children":1530},{"className":1529},[],[1531],{"type":392,"value":502},{"type":392,"value":1533}," replaces any previous TTL",{"type":383,"tag":1417,"props":1535,"children":1536},{},[1537,1546,1551],{"type":383,"tag":1444,"props":1538,"children":1539},{},[1540],{"type":383,"tag":395,"props":1541,"children":1543},{"className":1542},[],[1544],{"type":392,"value":1545},"kv.has(key)",{"type":383,"tag":1444,"props":1547,"children":1548},{},[1549],{"type":392,"value":1550},"boolean",{"type":383,"tag":1444,"props":1552,"children":1553},{},[],{"type":383,"tag":1417,"props":1555,"children":1556},{},[1557,1566,1574],{"type":383,"tag":1444,"props":1558,"children":1559},{},[1560],{"type":383,"tag":395,"props":1561,"children":1563},{"className":1562},[],[1564],{"type":392,"value":1565},"kv.delete(key)",{"type":383,"tag":1444,"props":1567,"children":1568},{},[1569],{"type":383,"tag":395,"props":1570,"children":1572},{"className":1571},[],[1573],{"type":392,"value":1499},{"type":383,"tag":1444,"props":1575,"children":1576},{},[],{"type":383,"tag":1417,"props":1578,"children":1579},{},[1580,1589,1597],{"type":383,"tag":1444,"props":1581,"children":1582},{},[1583],{"type":383,"tag":395,"props":1584,"children":1586},{"className":1585},[],[1587],{"type":392,"value":1588},"kv.setTtl(key, ttl)",{"type":383,"tag":1444,"props":1590,"children":1591},{},[1592],{"type":383,"tag":395,"props":1593,"children":1595},{"className":1594},[],[1596],{"type":392,"value":1499},{"type":383,"tag":1444,"props":1598,"children":1599},{},[1600],{"type":392,"value":1601},"Change the expiry without rewriting the value",{"type":383,"tag":1417,"props":1603,"children":1604},{},[1605,1614,1623],{"type":383,"tag":1444,"props":1606,"children":1607},{},[1608],{"type":383,"tag":395,"props":1609,"children":1611},{"className":1610},[],[1612],{"type":392,"value":1613},"kv.keys([prefix[, limit[, cursor]]])",{"type":383,"tag":1444,"props":1615,"children":1616},{},[1617],{"type":383,"tag":395,"props":1618,"children":1620},{"className":1619},[],[1621],{"type":392,"value":1622},"{ keys, cursor }",{"type":383,"tag":1444,"props":1624,"children":1625},{},[1626,1628,1634],{"type":392,"value":1627},"Page through keys, optionally under a prefix. Pass the returned ",{"type":383,"tag":395,"props":1629,"children":1631},{"className":1630},[],[1632],{"type":392,"value":1633},"cursor",{"type":392,"value":1635}," to get the next page",{"type":383,"tag":384,"props":1637,"children":1638},{},[1639],{"type":392,"value":1640},"Errors (an oversized value, a storage failure) are thrown as exceptions with a short message. Storage internals are never exposed to function code.",{"type":383,"tag":1304,"props":1642,"children":1644},{"id":1643},"deduplicate-webhooks",[1645],{"type":392,"value":1646},"Deduplicate webhooks",{"type":383,"tag":384,"props":1648,"children":1649},{},[1650],{"type":392,"value":1651},"Providers retry, and at-least-once delivery means your destination can see the same event twice. Use the event ID as the key and drop anything you have already seen:",{"type":383,"tag":414,"props":1653,"children":1655},{"className":416,"code":1654,"language":418,"meta":351,"style":351},"const kv = require(\"kv:stripe_events\")\nconst event = JSON.parse(r.body)\n\nif (kv.has(event.id)) {\n  r.stopForwarding()      // logged, not delivered again\n  return\n}\n// Remember the ID for the provider's retry window (Stripe retries for up to 3 days)\nkv.set(event.id, true, 7 * 24 * 3600)\n",[1656],{"type":383,"tag":395,"props":1657,"children":1658},{"__ignoreMap":351},[1659,1691,1727,1734,1754,1777,1785,1792,1800],{"type":383,"tag":424,"props":1660,"children":1661},{"class":426,"line":427},[1662,1666,1670,1674,1678,1682,1687],{"type":383,"tag":424,"props":1663,"children":1664},{"style":431},[1665],{"type":392,"value":434},{"type":383,"tag":424,"props":1667,"children":1668},{"style":437},[1669],{"type":392,"value":440},{"type":383,"tag":424,"props":1671,"children":1672},{"style":431},[1673],{"type":392,"value":445},{"type":383,"tag":424,"props":1675,"children":1676},{"style":448},[1677],{"type":392,"value":451},{"type":383,"tag":424,"props":1679,"children":1680},{"style":454},[1681],{"type":392,"value":457},{"type":383,"tag":424,"props":1683,"children":1684},{"style":460},[1685],{"type":392,"value":1686},"\"kv:stripe_events\"",{"type":383,"tag":424,"props":1688,"children":1689},{"style":454},[1690],{"type":392,"value":468},{"type":383,"tag":424,"props":1692,"children":1693},{"class":426,"line":471},[1694,1698,1703,1707,1712,1717,1722],{"type":383,"tag":424,"props":1695,"children":1696},{"style":431},[1697],{"type":392,"value":434},{"type":383,"tag":424,"props":1699,"children":1700},{"style":437},[1701],{"type":392,"value":1702}," event",{"type":383,"tag":424,"props":1704,"children":1705},{"style":431},[1706],{"type":392,"value":445},{"type":383,"tag":424,"props":1708,"children":1709},{"style":437},[1710],{"type":392,"value":1711}," JSON",{"type":383,"tag":424,"props":1713,"children":1714},{"style":454},[1715],{"type":392,"value":1716},".",{"type":383,"tag":424,"props":1718,"children":1719},{"style":448},[1720],{"type":392,"value":1721},"parse",{"type":383,"tag":424,"props":1723,"children":1724},{"style":454},[1725],{"type":392,"value":1726},"(r.body)\n",{"type":383,"tag":424,"props":1728,"children":1729},{"class":426,"line":481},[1730],{"type":383,"tag":424,"props":1731,"children":1732},{"emptyLinePlaceholder":475},[1733],{"type":392,"value":478},{"type":383,"tag":424,"props":1735,"children":1736},{"class":426,"line":491},[1737,1741,1745,1749],{"type":383,"tag":424,"props":1738,"children":1739},{"style":431},[1740],{"type":392,"value":733},{"type":383,"tag":424,"props":1742,"children":1743},{"style":454},[1744],{"type":392,"value":640},{"type":383,"tag":424,"props":1746,"children":1747},{"style":448},[1748],{"type":392,"value":742},{"type":383,"tag":424,"props":1750,"children":1751},{"style":454},[1752],{"type":392,"value":1753},"(event.id)) {\n",{"type":383,"tag":424,"props":1755,"children":1756},{"class":426,"line":548},[1757,1762,1767,1772],{"type":383,"tag":424,"props":1758,"children":1759},{"style":454},[1760],{"type":392,"value":1761},"  r.",{"type":383,"tag":424,"props":1763,"children":1764},{"style":448},[1765],{"type":392,"value":1766},"stopForwarding",{"type":383,"tag":424,"props":1768,"children":1769},{"style":454},[1770],{"type":392,"value":1771},"()      ",{"type":383,"tag":424,"props":1773,"children":1774},{"style":485},[1775],{"type":392,"value":1776},"// logged, not delivered again\n",{"type":383,"tag":424,"props":1778,"children":1779},{"class":426,"line":556},[1780],{"type":383,"tag":424,"props":1781,"children":1782},{"style":431},[1783],{"type":392,"value":1784},"  return\n",{"type":383,"tag":424,"props":1786,"children":1787},{"class":426,"line":565},[1788],{"type":383,"tag":424,"props":1789,"children":1790},{"style":454},[1791],{"type":392,"value":800},{"type":383,"tag":424,"props":1793,"children":1794},{"class":426,"line":604},[1795],{"type":383,"tag":424,"props":1796,"children":1797},{"style":485},[1798],{"type":392,"value":1799},"// Remember the ID for the provider's retry window (Stripe retries for up to 3 days)\n",{"type":383,"tag":424,"props":1801,"children":1802},{"class":426,"line":612},[1803,1807,1811,1816,1820,1824,1829,1834,1839,1843,1848],{"type":383,"tag":424,"props":1804,"children":1805},{"style":454},[1806],{"type":392,"value":497},{"type":383,"tag":424,"props":1808,"children":1809},{"style":448},[1810],{"type":392,"value":502},{"type":383,"tag":424,"props":1812,"children":1813},{"style":454},[1814],{"type":392,"value":1815},"(event.id, ",{"type":383,"tag":424,"props":1817,"children":1818},{"style":437},[1819],{"type":392,"value":1499},{"type":383,"tag":424,"props":1821,"children":1822},{"style":454},[1823],{"type":392,"value":782},{"type":383,"tag":424,"props":1825,"children":1826},{"style":437},[1827],{"type":392,"value":1828},"7",{"type":383,"tag":424,"props":1830,"children":1831},{"style":431},[1832],{"type":392,"value":1833}," *",{"type":383,"tag":424,"props":1835,"children":1836},{"style":437},[1837],{"type":392,"value":1838}," 24",{"type":383,"tag":424,"props":1840,"children":1841},{"style":431},[1842],{"type":392,"value":1833},{"type":383,"tag":424,"props":1844,"children":1845},{"style":437},[1846],{"type":392,"value":1847}," 3600",{"type":383,"tag":424,"props":1849,"children":1850},{"style":454},[1851],{"type":392,"value":468},{"type":383,"tag":384,"props":1853,"children":1854},{},[1855,1857,1862],{"type":392,"value":1856},"The duplicate still appears in the bucket's logs, and the provider gets a normal success response, so it stops retrying. See ",{"type":383,"tag":1379,"props":1858,"children":1859},{"href":301},[1860],{"type":392,"value":1861},"filter or drop webhooks",{"type":392,"value":1863}," for other ways to stop a request.",{"type":383,"tag":1304,"props":1865,"children":1867},{"id":1866},"cache-an-access-token",[1868],{"type":392,"value":1869},"Cache an access token",{"type":383,"tag":384,"props":1871,"children":1872},{},[1873],{"type":392,"value":1874},"When a destination needs an OAuth token or a short-lived API key, fetch it once and cache it with a TTL a little shorter than its lifetime:",{"type":383,"tag":414,"props":1876,"children":1878},{"className":416,"code":1877,"language":418,"meta":351,"style":351},"const kv = require(\"kv:tokens\")\n\nlet token = kv.get(\"crm\")\nif (!token) {\n  const res = http.request(\"POST\", \"https://auth.example.com/oauth/token\", {\n    headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n    body: \"grant_type=client_credentials&client_id=\" + cfg.get(\"CLIENT_ID\") + \"&client_secret=\" + cfg.get(\"CLIENT_SECRET\"),\n  })\n  const body = JSON.parse(res.body)\n  token = body.access_token\n  kv.set(\"crm\", token, body.expires_in - 60)   // refresh a minute early\n}\n\nr.setHeader(\"Authorization\", \"Bearer \" + token)\n",[1879],{"type":383,"tag":395,"props":1880,"children":1881},{"__ignoreMap":351},[1882,1914,1921,1959,1980,2030,2058,2133,2141,2174,2191,2234,2241,2248],{"type":383,"tag":424,"props":1883,"children":1884},{"class":426,"line":427},[1885,1889,1893,1897,1901,1905,1910],{"type":383,"tag":424,"props":1886,"children":1887},{"style":431},[1888],{"type":392,"value":434},{"type":383,"tag":424,"props":1890,"children":1891},{"style":437},[1892],{"type":392,"value":440},{"type":383,"tag":424,"props":1894,"children":1895},{"style":431},[1896],{"type":392,"value":445},{"type":383,"tag":424,"props":1898,"children":1899},{"style":448},[1900],{"type":392,"value":451},{"type":383,"tag":424,"props":1902,"children":1903},{"style":454},[1904],{"type":392,"value":457},{"type":383,"tag":424,"props":1906,"children":1907},{"style":460},[1908],{"type":392,"value":1909},"\"kv:tokens\"",{"type":383,"tag":424,"props":1911,"children":1912},{"style":454},[1913],{"type":392,"value":468},{"type":383,"tag":424,"props":1915,"children":1916},{"class":426,"line":471},[1917],{"type":383,"tag":424,"props":1918,"children":1919},{"emptyLinePlaceholder":475},[1920],{"type":392,"value":478},{"type":383,"tag":424,"props":1922,"children":1923},{"class":426,"line":481},[1924,1929,1934,1938,1942,1946,1950,1955],{"type":383,"tag":424,"props":1925,"children":1926},{"style":431},[1927],{"type":392,"value":1928},"let",{"type":383,"tag":424,"props":1930,"children":1931},{"style":454},[1932],{"type":392,"value":1933}," token ",{"type":383,"tag":424,"props":1935,"children":1936},{"style":431},[1937],{"type":392,"value":908},{"type":383,"tag":424,"props":1939,"children":1940},{"style":454},[1941],{"type":392,"value":584},{"type":383,"tag":424,"props":1943,"children":1944},{"style":448},[1945],{"type":392,"value":589},{"type":383,"tag":424,"props":1947,"children":1948},{"style":454},[1949],{"type":392,"value":457},{"type":383,"tag":424,"props":1951,"children":1952},{"style":460},[1953],{"type":392,"value":1954},"\"crm\"",{"type":383,"tag":424,"props":1956,"children":1957},{"style":454},[1958],{"type":392,"value":468},{"type":383,"tag":424,"props":1960,"children":1961},{"class":426,"line":491},[1962,1966,1970,1975],{"type":383,"tag":424,"props":1963,"children":1964},{"style":431},[1965],{"type":392,"value":733},{"type":383,"tag":424,"props":1967,"children":1968},{"style":454},[1969],{"type":392,"value":1465},{"type":383,"tag":424,"props":1971,"children":1972},{"style":431},[1973],{"type":392,"value":1974},"!",{"type":383,"tag":424,"props":1976,"children":1977},{"style":454},[1978],{"type":392,"value":1979},"token) {\n",{"type":383,"tag":424,"props":1981,"children":1982},{"class":426,"line":548},[1983,1988,1993,1997,2002,2007,2011,2016,2020,2025],{"type":383,"tag":424,"props":1984,"children":1985},{"style":431},[1986],{"type":392,"value":1987},"  const",{"type":383,"tag":424,"props":1989,"children":1990},{"style":437},[1991],{"type":392,"value":1992}," res",{"type":383,"tag":424,"props":1994,"children":1995},{"style":431},[1996],{"type":392,"value":445},{"type":383,"tag":424,"props":1998,"children":1999},{"style":454},[2000],{"type":392,"value":2001}," http.",{"type":383,"tag":424,"props":2003,"children":2004},{"style":448},[2005],{"type":392,"value":2006},"request",{"type":383,"tag":424,"props":2008,"children":2009},{"style":454},[2010],{"type":392,"value":457},{"type":383,"tag":424,"props":2012,"children":2013},{"style":460},[2014],{"type":392,"value":2015},"\"POST\"",{"type":383,"tag":424,"props":2017,"children":2018},{"style":454},[2019],{"type":392,"value":782},{"type":383,"tag":424,"props":2021,"children":2022},{"style":460},[2023],{"type":392,"value":2024},"\"https://auth.example.com/oauth/token\"",{"type":383,"tag":424,"props":2026,"children":2027},{"style":454},[2028],{"type":392,"value":2029},", {\n",{"type":383,"tag":424,"props":2031,"children":2032},{"class":426,"line":556},[2033,2038,2043,2048,2053],{"type":383,"tag":424,"props":2034,"children":2035},{"style":454},[2036],{"type":392,"value":2037},"    headers: { ",{"type":383,"tag":424,"props":2039,"children":2040},{"style":460},[2041],{"type":392,"value":2042},"\"Content-Type\"",{"type":383,"tag":424,"props":2044,"children":2045},{"style":454},[2046],{"type":392,"value":2047},": ",{"type":383,"tag":424,"props":2049,"children":2050},{"style":460},[2051],{"type":392,"value":2052},"\"application/x-www-form-urlencoded\"",{"type":383,"tag":424,"props":2054,"children":2055},{"style":454},[2056],{"type":392,"value":2057}," },\n",{"type":383,"tag":424,"props":2059,"children":2060},{"class":426,"line":565},[2061,2066,2071,2076,2081,2085,2089,2094,2098,2102,2107,2111,2115,2119,2123,2128],{"type":383,"tag":424,"props":2062,"children":2063},{"style":454},[2064],{"type":392,"value":2065},"    body: ",{"type":383,"tag":424,"props":2067,"children":2068},{"style":460},[2069],{"type":392,"value":2070},"\"grant_type=client_credentials&client_id=\"",{"type":383,"tag":424,"props":2072,"children":2073},{"style":431},[2074],{"type":392,"value":2075}," +",{"type":383,"tag":424,"props":2077,"children":2078},{"style":454},[2079],{"type":392,"value":2080}," cfg.",{"type":383,"tag":424,"props":2082,"children":2083},{"style":448},[2084],{"type":392,"value":589},{"type":383,"tag":424,"props":2086,"children":2087},{"style":454},[2088],{"type":392,"value":457},{"type":383,"tag":424,"props":2090,"children":2091},{"style":460},[2092],{"type":392,"value":2093},"\"CLIENT_ID\"",{"type":383,"tag":424,"props":2095,"children":2096},{"style":454},[2097],{"type":392,"value":658},{"type":383,"tag":424,"props":2099,"children":2100},{"style":431},[2101],{"type":392,"value":677},{"type":383,"tag":424,"props":2103,"children":2104},{"style":460},[2105],{"type":392,"value":2106}," \"&client_secret=\"",{"type":383,"tag":424,"props":2108,"children":2109},{"style":431},[2110],{"type":392,"value":2075},{"type":383,"tag":424,"props":2112,"children":2113},{"style":454},[2114],{"type":392,"value":2080},{"type":383,"tag":424,"props":2116,"children":2117},{"style":448},[2118],{"type":392,"value":589},{"type":383,"tag":424,"props":2120,"children":2121},{"style":454},[2122],{"type":392,"value":457},{"type":383,"tag":424,"props":2124,"children":2125},{"style":460},[2126],{"type":392,"value":2127},"\"CLIENT_SECRET\"",{"type":383,"tag":424,"props":2129,"children":2130},{"style":454},[2131],{"type":392,"value":2132},"),\n",{"type":383,"tag":424,"props":2134,"children":2135},{"class":426,"line":604},[2136],{"type":383,"tag":424,"props":2137,"children":2138},{"style":454},[2139],{"type":392,"value":2140},"  })\n",{"type":383,"tag":424,"props":2142,"children":2143},{"class":426,"line":612},[2144,2148,2153,2157,2161,2165,2169],{"type":383,"tag":424,"props":2145,"children":2146},{"style":431},[2147],{"type":392,"value":1987},{"type":383,"tag":424,"props":2149,"children":2150},{"style":437},[2151],{"type":392,"value":2152}," body",{"type":383,"tag":424,"props":2154,"children":2155},{"style":431},[2156],{"type":392,"value":445},{"type":383,"tag":424,"props":2158,"children":2159},{"style":437},[2160],{"type":392,"value":1711},{"type":383,"tag":424,"props":2162,"children":2163},{"style":454},[2164],{"type":392,"value":1716},{"type":383,"tag":424,"props":2166,"children":2167},{"style":448},[2168],{"type":392,"value":1721},{"type":383,"tag":424,"props":2170,"children":2171},{"style":454},[2172],{"type":392,"value":2173},"(res.body)\n",{"type":383,"tag":424,"props":2175,"children":2176},{"class":426,"line":621},[2177,2182,2186],{"type":383,"tag":424,"props":2178,"children":2179},{"style":454},[2180],{"type":392,"value":2181},"  token ",{"type":383,"tag":424,"props":2183,"children":2184},{"style":431},[2185],{"type":392,"value":908},{"type":383,"tag":424,"props":2187,"children":2188},{"style":454},[2189],{"type":392,"value":2190}," body.access_token\n",{"type":383,"tag":424,"props":2192,"children":2193},{"class":426,"line":685},[2194,2198,2202,2206,2210,2215,2219,2224,2229],{"type":383,"tag":424,"props":2195,"children":2196},{"style":454},[2197],{"type":392,"value":764},{"type":383,"tag":424,"props":2199,"children":2200},{"style":448},[2201],{"type":392,"value":502},{"type":383,"tag":424,"props":2203,"children":2204},{"style":454},[2205],{"type":392,"value":457},{"type":383,"tag":424,"props":2207,"children":2208},{"style":460},[2209],{"type":392,"value":1954},{"type":383,"tag":424,"props":2211,"children":2212},{"style":454},[2213],{"type":392,"value":2214},", token, body.expires_in ",{"type":383,"tag":424,"props":2216,"children":2217},{"style":431},[2218],{"type":392,"value":1365},{"type":383,"tag":424,"props":2220,"children":2221},{"style":437},[2222],{"type":392,"value":2223}," 60",{"type":383,"tag":424,"props":2225,"children":2226},{"style":454},[2227],{"type":392,"value":2228},")   ",{"type":383,"tag":424,"props":2230,"children":2231},{"style":485},[2232],{"type":392,"value":2233},"// refresh a minute early\n",{"type":383,"tag":424,"props":2235,"children":2236},{"class":426,"line":710},[2237],{"type":383,"tag":424,"props":2238,"children":2239},{"style":454},[2240],{"type":392,"value":800},{"type":383,"tag":424,"props":2242,"children":2243},{"class":426,"line":718},[2244],{"type":383,"tag":424,"props":2245,"children":2246},{"emptyLinePlaceholder":475},[2247],{"type":392,"value":478},{"type":383,"tag":424,"props":2249,"children":2250},{"class":426,"line":727},[2251,2256,2261,2265,2270,2274,2279,2283],{"type":383,"tag":424,"props":2252,"children":2253},{"style":454},[2254],{"type":392,"value":2255},"r.",{"type":383,"tag":424,"props":2257,"children":2258},{"style":448},[2259],{"type":392,"value":2260},"setHeader",{"type":383,"tag":424,"props":2262,"children":2263},{"style":454},[2264],{"type":392,"value":457},{"type":383,"tag":424,"props":2266,"children":2267},{"style":460},[2268],{"type":392,"value":2269},"\"Authorization\"",{"type":383,"tag":424,"props":2271,"children":2272},{"style":454},[2273],{"type":392,"value":782},{"type":383,"tag":424,"props":2275,"children":2276},{"style":460},[2277],{"type":392,"value":2278},"\"Bearer \"",{"type":383,"tag":424,"props":2280,"children":2281},{"style":431},[2282],{"type":392,"value":2075},{"type":383,"tag":424,"props":2284,"children":2285},{"style":454},[2286],{"type":392,"value":2287}," token)\n",{"type":383,"tag":384,"props":2289,"children":2290},{},[2291,2293,2298],{"type":392,"value":2292},"The same pattern caches any slow lookup, such as enrichment data from an API you ",{"type":383,"tag":1379,"props":2294,"children":2295},{"href":260},[2296],{"type":392,"value":2297},"call from the function",{"type":392,"value":2299},", so each webhook doesn't pay for the round trip.",{"type":383,"tag":1304,"props":2301,"children":2303},{"id":2302},"counters-rate-limits-and-cursors",[2304],{"type":392,"value":2305},"Counters, rate limits and cursors",{"type":383,"tag":2307,"props":2308,"children":2309},"ul",{},[2310,2329,2347],{"type":383,"tag":2311,"props":2312,"children":2313},"li",{},[2314,2319,2321,2327],{"type":383,"tag":388,"props":2315,"children":2316},{},[2317],{"type":392,"value":2318},"Counters.",{"type":392,"value":2320}," ",{"type":383,"tag":395,"props":2322,"children":2324},{"className":2323},[],[2325],{"type":392,"value":2326},"kv.set(\"count\", (kv.get(\"count\") || 0) + 1)",{"type":392,"value":2328}," keeps a running total across executions.",{"type":383,"tag":2311,"props":2330,"children":2331},{},[2332,2337,2339,2345],{"type":383,"tag":388,"props":2333,"children":2334},{},[2335],{"type":392,"value":2336},"Simple rate limits.",{"type":392,"value":2338}," Key by a time window, for example ",{"type":383,"tag":395,"props":2340,"children":2342},{"className":2341},[],[2343],{"type":392,"value":2344},"\"calls:\" + Math.floor(Date.now() / 60000)",{"type":392,"value":2346}," with a 120-second TTL, and stop forwarding when the count passes your limit.",{"type":383,"tag":2311,"props":2348,"children":2349},{},[2350,2355,2357,2362],{"type":383,"tag":388,"props":2351,"children":2352},{},[2353],{"type":392,"value":2354},"Cursors.",{"type":392,"value":2356}," Store the last processed ID or timestamp so a ",{"type":383,"tag":1379,"props":2358,"children":2359},{"href":242},[2360],{"type":392,"value":2361},"scheduled webhook",{"type":392,"value":2363}," that polls an API only fetches what's new.",{"type":383,"tag":384,"props":2365,"children":2366},{},[2367,2369,2374,2376,2381],{"type":392,"value":2368},"KV operations are not atomic. A ",{"type":383,"tag":395,"props":2370,"children":2372},{"className":2371},[],[2373],{"type":392,"value":589},{"type":392,"value":2375}," followed by a ",{"type":383,"tag":395,"props":2377,"children":2379},{"className":2378},[],[2380],{"type":392,"value":502},{"type":392,"value":2382}," is two separate calls, so two concurrent executions can read the same value. That is fine for dedupe, caching and approximate counts. For a counter that must never race, serialize the work in one consumer.",{"type":383,"tag":1304,"props":2384,"children":2386},{"id":2385},"limits",[2387],{"type":392,"value":2388},"Limits",{"type":383,"tag":1409,"props":2390,"children":2391},{},[2392,2408],{"type":383,"tag":1413,"props":2393,"children":2394},{},[2395],{"type":383,"tag":1417,"props":2396,"children":2397},{},[2398,2403],{"type":383,"tag":1421,"props":2399,"children":2400},{},[2401],{"type":392,"value":2402},"Limit",{"type":383,"tag":1421,"props":2404,"children":2405},{},[2406],{"type":392,"value":2407},"Value",{"type":383,"tag":1437,"props":2409,"children":2410},{},[2411,2424,2437,2456],{"type":383,"tag":1417,"props":2412,"children":2413},{},[2414,2419],{"type":383,"tag":1444,"props":2415,"children":2416},{},[2417],{"type":392,"value":2418},"Value size",{"type":383,"tag":1444,"props":2420,"children":2421},{},[2422],{"type":392,"value":2423},"256 KiB (JSON-encoded)",{"type":383,"tag":1417,"props":2425,"children":2426},{},[2427,2432],{"type":383,"tag":1444,"props":2428,"children":2429},{},[2430],{"type":392,"value":2431},"Key size",{"type":383,"tag":1444,"props":2433,"children":2434},{},[2435],{"type":392,"value":2436},"512 bytes",{"type":383,"tag":1417,"props":2438,"children":2439},{},[2440,2451],{"type":383,"tag":1444,"props":2441,"children":2442},{},[2443,2449],{"type":383,"tag":395,"props":2444,"children":2446},{"className":2445},[],[2447],{"type":392,"value":2448},"keys()",{"type":392,"value":2450}," page size",{"type":383,"tag":1444,"props":2452,"children":2453},{},[2454],{"type":392,"value":2455},"100 by default, up to 1,000",{"type":383,"tag":1417,"props":2457,"children":2458},{},[2459,2464],{"type":383,"tag":1444,"props":2460,"children":2461},{},[2462],{"type":392,"value":2463},"Stores per account",{"type":383,"tag":1444,"props":2465,"children":2466},{},[2467],{"type":392,"value":2468},"50 (KV and file stores combined)",{"type":383,"tag":384,"props":2470,"children":2471},{},[2472,2474,2479],{"type":392,"value":2473},"For larger blobs, such as exports, generated reports or attachments, use the ",{"type":383,"tag":1379,"props":2475,"children":2476},{"href":310},[2477],{"type":392,"value":2478},"file store",{"type":392,"value":2480}," instead.",{"type":383,"tag":1304,"props":2482,"children":2484},{"id":2483},"manage-stores-from-the-api-mcp-or-an-agent",[2485],{"type":392,"value":2486},"Manage stores from the API, MCP or an agent",{"type":383,"tag":384,"props":2488,"children":2489},{},[2490,2492,2498,2500,2505,2507,2513,2514,2520,2521,2527,2528,2534,2536,2542],{"type":392,"value":2491},"Stores are also available through the REST API under ",{"type":383,"tag":395,"props":2493,"children":2495},{"className":2494},[],[2496],{"type":392,"value":2497},"/v1/function-stores",{"type":392,"value":2499}," (list, create, delete, and browse, set, expire or clear KV entries) and through the ",{"type":383,"tag":1379,"props":2501,"children":2502},{"href":62},[2503],{"type":392,"value":2504},"Webhook Relay MCP server",{"type":392,"value":2506},", so a coding agent can inspect what a function has stored while it debugs it. The MCP tools include ",{"type":383,"tag":395,"props":2508,"children":2510},{"className":2509},[],[2511],{"type":392,"value":2512},"list_function_stores",{"type":392,"value":782},{"type":383,"tag":395,"props":2515,"children":2517},{"className":2516},[],[2518],{"type":392,"value":2519},"list_function_kv_entries",{"type":392,"value":782},{"type":383,"tag":395,"props":2522,"children":2524},{"className":2523},[],[2525],{"type":392,"value":2526},"get_function_kv_entry",{"type":392,"value":782},{"type":383,"tag":395,"props":2529,"children":2531},{"className":2530},[],[2532],{"type":392,"value":2533},"set_function_kv_entry",{"type":392,"value":2535}," and ",{"type":383,"tag":395,"props":2537,"children":2539},{"className":2538},[],[2540],{"type":392,"value":2541},"clear_function_kv_store",{"type":392,"value":1716},{"type":383,"tag":1304,"props":2544,"children":2546},{"id":2545},"migrating-from-pipedream-data-stores",[2547],{"type":392,"value":2548},"Migrating from Pipedream Data Stores",{"type":383,"tag":384,"props":2550,"children":2551},{},[2552,2554,2560,2562,2568,2570,2576,2578,2583,2585,2591],{"type":392,"value":2553},"The API mirrors Pipedream's ",{"type":383,"tag":395,"props":2555,"children":2557},{"className":2556},[],[2558],{"type":392,"value":2559},"this.dataStore",{"type":392,"value":2561},", so ports are mostly mechanical: ",{"type":383,"tag":395,"props":2563,"children":2565},{"className":2564},[],[2566],{"type":392,"value":2567},"this.dataStore.set(k, v, { ttl })",{"type":392,"value":2569}," becomes ",{"type":383,"tag":395,"props":2571,"children":2573},{"className":2572},[],[2574],{"type":392,"value":2575},"kv.set(k, v, ttl)",{"type":392,"value":2577},", and you drop the ",{"type":383,"tag":395,"props":2579,"children":2581},{"className":2580},[],[2582],{"type":392,"value":1405},{"type":392,"value":2584}," because calls are synchronous. The ",{"type":383,"tag":1379,"props":2586,"children":2588},{"href":2587},"/blog/pipedream-workflows-shutdown-migration",[2589],{"type":392,"value":2590},"Pipedream Workflows migration guide",{"type":392,"value":2592}," has the full method-by-method mapping and a worked example.",{"type":383,"tag":2594,"props":2595,"children":2596},"style",{},[2597],{"type":392,"value":2598},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":351,"searchDepth":481,"depth":481,"links":2600},[2601,2602,2603,2604,2605,2606,2607,2608],{"id":1306,"depth":471,"text":1309},{"id":1391,"depth":471,"text":1394},{"id":1643,"depth":471,"text":1646},{"id":1866,"depth":471,"text":1869},{"id":2302,"depth":471,"text":2305},{"id":2385,"depth":471,"text":2388},{"id":2483,"depth":471,"text":2486},{"id":2545,"depth":471,"text":2548},"markdown","content:docs:webhooks:functions:19.kv-store.md","content","docs/webhooks/functions/19.kv-store.md","docs/webhooks/functions/19.kv-store","md",{"loc":307},1793185647368]