Cache, redirects & secrets
Preview Three small, closely-related env-scoped resources live here: the cache (purge it, read its config), redirects (list and replace rules), and secrets (per-environment config variables). They share a pattern — all are scoped to a single environment, because a redirect or a secret can differ between staging and production — and each is governed by its own write scope.
For the product behavior behind these — how caching works, how redirects are matched, and how config and secrets are inherited across environments — see caching, redirects, and config & secrets. This page is the API reference.
| Method + path | Scope | Does |
|---|---|---|
POST …/{envID}/cache/purge |
cache:write |
purge the cache → 202 + a job |
GET …/{envID}/cache |
cache:read |
read cache configuration and current state |
POST …/cache/purge accepts an optional body to scope the purge; an empty body
purges everything. Because a global purge briefly raises origin load, it returns a
job you can wait on rather than blocking.
| Name | Type | Required | Description |
|---|---|---|---|
type |
string |
no | page, object, or all (default all) |
tags |
string[] |
no | purge only entries tagged with these |
paths |
string[] |
no | purge only these URL paths |
Redirects
Section titled “Redirects”| Method + path | Scope | Does |
|---|---|---|
GET …/{envID}/redirects |
redirects:read |
list the environment’s redirect rules |
PUT …/{envID}/redirects |
redirects:write |
replace the full redirect rule set |
PUT is a full replacement — send the complete rule set you want, not a delta.
Read first, edit the array, write it back. Each rule has a from, a to, and a
status (301 or 302).
Secrets
Section titled “Secrets”| Method + path | Scope | Does |
|---|---|---|
GET …/{envID}/secrets |
secrets:read |
list secret keys (names + metadata, never values) |
PUT …/{envID}/secrets/{key} |
secrets:write |
set or replace a secret’s value |
DELETE …/{envID}/secrets/{key} |
secrets:write |
remove a secret |
Worked example — purge the cache
Section titled “Worked example — purge the cache”Purge everything for a production environment, and wait on the job. Pass an
Idempotency-Key so a retry doesn’t queue a second
purge.
curl -X POST https://api.managed.dev/v1/sites/site_01J7Q2/environments/env_01J8D9/cache/purge \ -H "Authorization: Bearer mfk_live_9aF2…" \ -H "Forge-Version: 2026-06-23" \ -H "Idempotency-Key: purge-after-release-rel_01JE7" \ -H "Content-Type: application/json" \ -d '{ "type": "page" }'body := strings.NewReader(`{ "type": "page" }`)req, _ := http.NewRequest("POST", "https://api.managed.dev/v1/sites/site_01J7Q2/environments/env_01J8D9/cache/purge", body)req.Header.Set("Authorization", "Bearer mfk_live_9aF2…")req.Header.Set("Forge-Version", "2026-06-23")req.Header.Set("Idempotency-Key", "purge-after-release-rel_01JE7")req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req) // 202 Acceptedmf cache purge --env env_01J8D9 --type page{ "data": { "id": "job_01J9TT", "type": "cache.purge", "status": "queued", "created_at": "2026-06-24T01:20:00.300Z", "resource": { "type": "environment", "id": "env_01J8D9" } }, "request_id": "req_01JAD3"}Worked example — set a secret
Section titled “Worked example — set a secret”Set a config secret on the staging environment. The value is write-only — you won’t read it back.
curl -X PUT https://api.managed.dev/v1/sites/site_01J7Q2/environments/env_01J8D9/secrets/STRIPE_API_KEY \ -H "Authorization: Bearer mfk_live_9aF2…" \ -H "Forge-Version: 2026-06-23" \ -H "Content-Type: application/json" \ -d '{ "value": "sk_test_51N…" }'await fetch( "https://api.managed.dev/v1/sites/site_01J7Q2/environments/env_01J8D9/secrets/STRIPE_API_KEY", { method: "PUT", headers: { Authorization: "Bearer mfk_live_9aF2…", "Forge-Version": "2026-06-23", "Content-Type": "application/json", }, body: JSON.stringify({ value: "sk_test_51N…" }), },);mf secrets set STRIPE_API_KEY --env env_01J8D9{ "data": { "key": "STRIPE_API_KEY", "env_id": "env_01J8D9", "updated_at": "2026-06-24T01:21:30Z", "applies_on": "next-deploy" }, "request_id": "req_01JAD9"}