Delivery
Continuity
Keep public pages answering from cached copies while the origin fails, with continuity profiles and a preview of what visitors would get.
A continuity profile tells the network what to do for a set of hostnames and paths when the origin fails: serve a cached copy, or show a maintenance page. The paths start with /v2/cdn/continuity/{domain_public_id}/, where the id is the public id of the domain, taken from the domains list.
The examples on this page use these shell variables:
export DIAMWALL_API_KEY="your key"export CONTINUITY="https://api.diamwall.com/v2/cdn/continuity/your-domain-public-id"Profiles
Section titled “Profiles”What a profile is made of
Section titled “What a profile is made of”| Field | Required on create | What it is |
|---|---|---|
name |
Yes | A unique one-line name, 1 to 128 bytes. It is kept as you send it. |
comment |
No | A one-line comment, at most 1024 bytes. An empty string clears it. |
enabled |
Yes | Whether the profile is active. A JSON boolean. |
scope |
Yes | Where the profile applies: hostnames and path_prefix. |
action |
Yes | The cache policy of the profile. |
maintenance |
No | The paths that never get a cached copy, and the maintenance page. |
The body of a create or an edit is limited to 32 KiB. A field that is not part of a profile is refused, at any depth.
scope needs both of its fields:
hostnames: 1 to 32 exact hostnames, in lower case, with no wildcard and none twice.path_prefix: an absolute path of at most 1024 characters, such as/or/news. It is case-sensitive. A query string, a fragment, a percent escape, a double slash and a.or..segment are refused.
action holds the cache policy. Every field in it is optional. These are the ones that matter most for continuity:
| Field | Allowed values | What it does |
|---|---|---|
stale_while_offline |
true |
Serves a stale copy while the origin fails. |
authenticated_fallback |
true |
Serves a cached public copy to an authenticated visitor when the origin fails. |
auth_cookies |
An object with patterns and, optionally, except |
The names of the cookies that mark a request as authenticated. |
edge_ttl |
respect_origin, 5m, 30m, 1h, 4h, 12h, 1d, 7d, 30d, 60d, 90d, 1y |
For how long the network keeps a copy as fresh. |
cache_retention |
1d, 7d, 14d, 30d, 60d, 90d, 180d, 365d, 730d |
For how long a copy is kept without being requested. |
cache_statuses |
A list of 1 to 11 among 200, 203, 204, 300, 301, 302, 303, 307, 308, 404, 410 |
The statuses of the answers that are stored. No 5xx is accepted. |
The action also takes browser_ttl, query_string, strip_cookies, origin_cache_control, min_uses, revalidate and stale_while_revalidating. Their values are in the reference entry of the create endpoint.
auth_cookies lists cookie names, never cookie values:
patterns: 1 to 32 names, each of 1 to 128 characters, none twice. A*is a wildcard and is allowed only as the last character. Names are case-sensitive. List every authentication cookie your origin accepts.except: at most 32 exact names that the patterns leave out. Each one has to be covered by a pattern.
maintenance needs all three of its fields when you send it:
| Field | What it is |
|---|---|
paths |
Up to 32 absolute paths that never read from, or fall back to, a cached copy. |
page |
existing to use your own maintenance page, default to use the shared template. |
on_missing |
Whether the maintenance page answers outside the protected paths when no eligible cached copy exists. |
A profile you read also has an id, which is r_ followed by 32 hexadecimal digits. Its action comes back with two fixed values, "eligibility": "cache" and "runtime_version": 2. You do not need to send them.
Writes need the latest revision
Section titled “Writes need the latest revision”Every create, edit, delete and preview needs an If-Match header. It proves that you saw the latest state of the profiles before you wrote.
| Step | Call | What you keep |
|---|---|---|
| 1 | GET .../profiles/ |
The ETag header of the answer |
| 2 | The write, with If-Match set to that ETag |
The new ETag, for your next write |
Send the ETag exactly as it came, with its quotes: "sha256: followed by 64 hexadecimal digits and a closing quote.
ETAG=$(curl -s -o /dev/null -D - "$CONTINUITY/profiles/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ | tr -d '\r' | awk 'tolower($1) == "etag:" { print $2 }')- Without
If-Matchthe answer is428 PRECONDITION_REQUIRED. - A weak
ETag,*, a list or a value without quotes answers400 INVALID_PRECONDITION. - If the profiles changed since your read, the answer is
412and nothing is written. Read again and retry.
What every answer carries
Section titled “What every answer carries”Around its data, each answer has three fields:
| Field | Values | What it tells you |
|---|---|---|
revision |
sha256: and 64 hexadecimal digits, or null |
The revision of what was read or written. null means it could not be read. |
consistency |
verified, degraded, unknown |
degraded is a real state to show, not an error. |
publication.status |
verified, pending, unknown |
Where the publication of the profiles stands. |
List the profiles
Section titled “List the profiles”curl "$CONTINUITY/profiles/?limit=50" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY"{ "revision": "sha256:abababababab...", "consistency": "verified", "publication": { "status": "pending", "rollout": "unknown" }, "data": { "items": [ { "id": "r_0123456789abcdef0123456789abcdef", "name": "Public portal", "comment": "Public pages during origin outages", "enabled": true, "scope": { "hostnames": ["example.com", "www.example.com"], "path_prefix": "/" }, "action": { "edge_ttl": "1h", "cache_retention": "90d", "cache_statuses": [200], "stale_while_offline": true, "auth_cookies": { "patterns": ["SESSION_*"], "except": [] }, "authenticated_fallback": true, "eligibility": "cache", "runtime_version": 2 }, "maintenance": { "paths": ["/login", "/account"], "page": "existing", "on_missing": true } } ], "page": { "limit": 50, "total": 1, "next_cursor": null } }}limitgoes from 1 to 100. Without it a page holds 50 profiles.- To read the next page, send
data.page.next_cursorback ascursor, until it isnull. data.page.totalis the number of profiles of the domain. When it is absent, the count is not known. It is not0.- If the profiles change between two pages, the next page answers
409 CURSOR_STALE. Start again from the first page.
Read one profile
Section titled “Read one profile”curl "$CONTINUITY/profiles/r_0123456789abcdef0123456789abcdef/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY"The profile is under data, in the same form as an item of the list. An id that no profile has answers 404 CONTINUITY_PROFILE_NOT_FOUND.
Create a profile
Section titled “Create a profile”Send name, enabled, scope and action. Get the ETag first.
curl -X POST "$CONTINUITY/profiles/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "name": "Public portal", "comment": "Public pages during origin outages", "enabled": true, "scope": { "hostnames": ["example.com", "www.example.com"], "path_prefix": "/" }, "action": { "edge_ttl": "1h", "cache_retention": "90d", "cache_statuses": [200], "stale_while_offline": true, "auth_cookies": { "patterns": ["SESSION_*"], "except": [] }, "authenticated_fallback": true }, "maintenance": { "paths": ["/login", "/account"], "page": "existing", "on_missing": true } }'curl -X POST "$CONTINUITY/profiles/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "name": "News section", "enabled": true, "scope": { "hostnames": ["www.example.com"], "path_prefix": "/news" }, "action": { "stale_while_offline": true } }'The answer is 201 with the profile as it is stored under data, and its id in operation.id. Keep the id: the other calls need it.
Change or pause a profile
Section titled “Change or pause a profile”Send at least one field. A top-level field you leave out keeps its value. scope, action and maintenance are objects, so send each of them whole.
curl -X PATCH "$CONTINUITY/profiles/r_0123456789abcdef0123456789abcdef/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "enabled": false }'curl -X PATCH "$CONTINUITY/profiles/r_0123456789abcdef0123456789abcdef/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "scope": { "hostnames": ["www.example.com"], "path_prefix": "/" } }'curl -X PATCH "$CONTINUITY/profiles/r_0123456789abcdef0123456789abcdef/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "action": {} }'"enabled": false alone is a valid request: it pauses the profile and keeps everything else. The answer is 200 with the profile as it is after the change.
Delete a profile
Section titled “Delete a profile”curl -X DELETE "$CONTINUITY/profiles/r_0123456789abcdef0123456789abcdef/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "If-Match: $ETAG"The answer is 200. It has no data. The deleted profile is named in operation:
{ "revision": "sha256:abababababab...", "consistency": "verified", "publication": { "status": "pending", "rollout": "unknown" }, "operation": { "id": "r_0123456789abcdef0123456789abcdef", "type": "delete" }}Preview a cached copy
Section titled “Preview a cached copy”A preview gives you a temporary link that shows the public cached copy of one of your pages, so you can see what a profile would serve. Send the original public URL of the page and a display name for the service:
curl -X POST "$CONTINUITY/profiles/r_0123456789abcdef0123456789abcdef/preview/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "service_name": "Public portal", "url": "https://www.example.com/news/?page=2" }'| Field | Rules |
|---|---|
service_name |
The display name of the service, kept as you send it. Never put a credential in it. |
url |
An absolute http or https URL with a lower-case hostname. No port, no user and password, no fragment. Its query string is kept. |
The answer is 201:
{ "revision": "sha256:abababababab...", "consistency": "verified", "publication": { "status": "pending", "rollout": "unknown" }, "data": { "preview_url": "https://preview.example.com/news/?page=2", "expires_at": "2026-10-15T00:05:00.000Z", "publication": { "status": "pending", "rollout": "unknown" }, "inspection": { "source": "public_cache", "origin_requests": false, "answering_pop_only": true, "authenticated_fallback": true, "stale_offline_effective": null, "protected_paths": ["/account", "/login"] }, "revision": "sha256:abababababab..." }}preview_urlis the link to open. Open exactly this URL.expires_atis when the link stops working, at most 300 seconds after it is issued.data.revisionis the revision of the profiles the preview was issued from.
Errors you are likely to see
Section titled “Errors you are likely to see”The code is in the message field of the answer. A refused request also names the wrong fields in fields, when there are any.
| Status | Code | What happened |
|---|---|---|
400 |
INVALID_REQUEST |
A field is missing, wrong or not accepted. |
400 |
INVALID_PRECONDITION |
If-Match is not one quoted ETag as it came from the read. |
404 |
CONTINUITY_PROFILE_NOT_FOUND |
No profile has that id. |
404 |
PREVIEW_PATH_PROTECTED |
A preview was refused for the path of that URL. |
409 |
RULE_NAME_CONFLICT |
The name is refused because of a conflict. Names are unique. |
409 |
CONTINUITY_HOSTNAME_CONFLICT, CONTINUITY_SCOPE_CONFLICT |
The hostnames or the scope conflict with what already exists. |
409 |
CONTINUITY_UNAVAILABLE |
Continuity cannot be used for this request. Read the current state before trying again. |
409 |
PREVIEW_PROFILE_DISABLED |
A preview was asked for a profile that is not enabled. |
409 |
CURSOR_STALE |
The profiles changed while you were paging. Start from the first page. |
412 |
REVISION_MISMATCH |
The profiles changed since your read. details.current_revision has the new revision. Read again and retry. |
412 |
PRECONDITION_FAILED |
The same, on a preview. |
413 |
PAYLOAD_TOO_LARGE |
The body is too large. |
415 |
UNSUPPORTED_MEDIA_TYPE |
The body is not JSON. Nothing was written. |
428 |
PRECONDITION_REQUIRED |
The If-Match header is missing. |
429 |
PREVIEW_CAPACITY_EXCEEDED |
No more previews can be issued for now. |
429 |
TOO_MANY_REQUESTS, RATE_LIMIT_EXCEEDED |
Too many requests. The wait is in details.retry_after_seconds and in the Retry-After header. |
500 |
UNEXPECTED_ERROR |
On a write, the change may have been made. Read again before you repeat it. |
502 |
FILE_SERVER_OUTCOME_UNKNOWN |
The write may have been made. Read again before you repeat it. |
503 |
STATE_CHANGING |
What the request acts on kept changing. Read the current state before trying again. |
The list of codes grows over time. For a code you do not know, decide by the HTTP status of the answer.
The errors that come from the key itself, such as API_KEY_IP_NOT_ALLOWED, are on the Errors page.
All Continuity endpoints
Section titled “All Continuity endpoints”Each row opens the endpoint in the API reference, with every parameter, rule and response.
Loading the endpoints...