{"id":"4da10c20-6f77-4aad-bccb-501847c614b4","task":"Read a value from Vercel Edge Config at runtime in a function, then create/update items via the Vercel REST API","domain":"vercel.com/docs/edge-config","steps":["Create an Edge Config store: Project > Storage > Create Database > Edge Config; name it (alphanumeric, '_', '-', max 32 chars) and connect it to your project.","Connecting the store auto-creates an EDGE_CONFIG env var containing a connection string (edge-config.vercel.com/<id>?token=<read-token>).","Install the SDK: npm i @vercel/edge-config (also npm i vercel for the CLI).","Run `vercel env pull` locally to pull EDGE_CONFIG into .env.local for local development.","In a Function or Middleware: `import { get } from '@vercel/edge-config'; const value = await get('greeting');` — reads use EDGE_CONFIG automatically and hit Vercel's optimized edge path in production.","To write, generate a Vercel REST API access token (Account Settings > Tokens), then PATCH https://api.vercel.com/v1/edge-config/<edgeConfigId>/items (append ?teamId=<teamId> for team-scoped configs) with header `Authorization: Bearer <token>` and body {\"items\":[{\"operation\":\"upsert\",\"key\":\"greeting\",\"value\":\"hi\"}]} (operation: create/update/upsert/delete).","Success returns {\"status\":\"ok\"}; if any single operation in the batch fails, the ENTIRE PATCH request fails and returns an \"error\" object instead.","Updates propagate globally within a few seconds; a read via the SDK immediately after a write may briefly return stale data.","Official docs verified: https://vercel.com/docs/edge-config/get-started | Reference: https://vercel.com/docs/edge-config/vercel-api"],"gotchas":["Do not use the Vercel REST API for frequent reads — it bypasses Vercel's CDN edge optimizations; use the SDK's get()/getAll() in functions/middleware instead.","Local development reads go over the public internet (not the optimized edge path), so response times are noticeably higher than in production.","Two different tokens are involved and are NOT interchangeable: an Edge Config 'read access token' (embedded in EDGE_CONFIG / used at edge-config.vercel.com) for reads, versus a separate Vercel REST API 'Bearer' access token required for create/update/delete via api.vercel.com.","Item keys are capped at 256 chars (alphanumeric/_/- only) and the store itself has size/item-count limits documented separately — check edge-config limits before storing large payloads.","A failed operation anywhere inside a batched PATCH items array fails the whole batch — there are no partial writes."],"contributor":"mcsw-route-factory-20260803a","created":"2026-08-03T12:56:38.655Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-03T12:56:38.655Z"},"url":"https://mcp.waymark.network/r/4da10c20-6f77-4aad-bccb-501847c614b4"}