Protection
GDPR
Read the GDPR zone of a domain, switch it on at a location, move it or switch it off.
A domain can have a GDPR zone at one location that you choose. This page covers reading the zone, listing the locations it can be in, and switching it on, moving it or switching it off. The paths start with /v2/cdn/gdpr/{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 GDPR="https://api.diamwall.com/v2/cdn/gdpr/your-domain-public-id"The order of calls
Section titled “The order of calls”| Step | Call | What you keep |
|---|---|---|
| 1 | GET .../references/gdpr-locations/ |
The id of the location you want |
| 2 | GET .../settings/gdpr/ |
The ETag header of the answer |
| 3 | PATCH .../settings/gdpr/ |
The new ETag, for the next change |
Step 1 is only needed when you switch the zone on or move it. Step 2 is needed before every change.
List the locations
Section titled “List the locations”curl "$GDPR/references/gdpr-locations/?limit=50" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY"{ "revision": "sha256:a3cdbdbf2ff3...", "consistency": "verified", "data": { "state": "resolved", "items": [ { "id": "HKG", "city": "Hong Kong", "country": "Hong Kong", "continent": "Asia", "name": "Hong Kong PoP" }, { "id": "LIS", "city": "Lisbon", "country": "PT", "continent": "EU" } ], "page": { "limit": 50, "next_cursor": null, "total": 2 } }}- The
idis what you send aslocation_idwhen you change the zone. city,countryandcontinentare labels.countryandcontinentare not ISO codes: show them as they are and do not compare them with a code.nameis only there for some locations.limitgoes from 1 to 100. Without it a page holds 50 locations.- To read the next page, send
data.page.next_cursorback ascursor, until it isnull.data.page.totalis the number of locations in all. - If the list changes between two pages, the next page answers
409 CURSOR_STALE. Start again from the first page. - No other query parameter is accepted.
- The list is read-only. Its answer has no
ETag.
Read the zone
Section titled “Read the zone”curl -i "$GDPR/settings/gdpr/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY"{ "revision": "sha256:9074f9827d70...", "consistency": "verified", "data": { "enabled": { "state": "resolved", "value": true }, "location_id": { "state": "resolved", "value": "LIS" }, "created_at": { "state": "resolved", "value": "2026-10-10T12:00:00.000Z" }, "shared_address_tenant_count": { "state": "resolved", "value": 1 }, "publication": { "state": "resolved", "value": "local_artifacts_verified" } }}{ "revision": "sha256:9074f9827d70...", "consistency": "verified", "data": { "enabled": { "state": "resolved", "value": false }, "location_id": { "state": "resolved", "value": null }, "publication": { "state": "resolved", "value": "not_configured" } }}{ "revision": null, "consistency": "degraded", "state": "unknown"}Each field comes back as an object with a state, and a value only when the state is resolved.
| Field | What it is |
|---|---|
enabled |
Whether the domain has a GDPR zone. |
location_id |
The id of the zone’s location, from the locations list. null when there is no zone. |
created_at |
When the zone was created. Absent when there is no zone. |
shared_address_tenant_count |
How many domains share the address of the zone. A count only, with no names. Absent when there is no zone. |
publication |
What the CDN holds of the zone on the node it read. See below. |
publication inside data has one of these forms:
state |
value |
Meaning |
|---|---|---|
resolved |
not_configured |
There is no GDPR entry for the domain, and nothing left of one. |
resolved |
local_artifacts_verified |
What the zone needs is coherent on the node that was read. This does not confirm every point of presence. |
unknown |
none | Some evidence could not be confirmed. A reason says which. This does not mean the zone is off. |
The ETag header of the answer is the revision of the settings. Keep it: a change needs it in If-Match.
Change the zone
Section titled “Change the zone”Read the zone first to get its ETag, then send it in If-Match, exactly as it came, with its quotes:
ETAG=$(curl -s -o /dev/null -D - "$GDPR/settings/gdpr/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ | tr -d '\r' | awk 'tolower($1) == "etag:" { print $2 }')The body is exactly one of two forms. No other field is accepted.
| You want to | Body |
|---|---|
| Switch the zone on at a location | { "enabled": true, "location_id": "LIS" } |
| Move a zone that is on to another location | { "enabled": true, "location_id": "HKG" } |
| Switch the zone off | { "enabled": false } |
curl -X PATCH "$GDPR/settings/gdpr/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "enabled": true, "location_id": "LIS" }'curl -X PATCH "$GDPR/settings/gdpr/" \ -H "Authorization: Api-Key $DIAMWALL_API_KEY" \ -H "Content-Type: application/json" \ -H "If-Match: $ETAG" \ -d '{ "enabled": false }'The answer is 200 with the settings as they are after the change, in the same form as a read, and a new ETag header to use on your next change.
The body rules are strict, and nothing is converted or repaired:
enabledis required and must be a JSON boolean."true",1andnullare refused.location_idis required withenabled: trueand refused withenabled: false. It is 1 to 128 letters, digits,_or-, sent as the locations list answered it.- A request with no body is refused. It is never read as
enabled: false.
Each of these answers 400 INVALID_REQUEST, usually with the field named in fields.
When a change fails part way
Section titled “When a change fails part way”The CDN changes a zone in several steps. Some 503 answers mean the change may have been made, or was made. For all of them the rule is the same: read the zone before you try anything else, and never repeat the request blindly.
| Code | What it tells you |
|---|---|
503 COMMITTED_CLEANUP_FAILED |
The change was made. A step after it failed. This is not a refusal. |
503 TRANSACTION_PREPARE_FAILED |
The CDN failed while it prepared the change, before it was committed. |
503 TRANSACTION_PREPARE_CLEANUP_FAILED |
The same, and the CDN could not clean up what it had prepared. |
503 TRANSACTION_RECOVERY_FAILED |
An earlier unfinished change could not be recovered. What is published is not known from the answer. |
502 FILE_SERVER_OUTCOME_UNKNOWN, 500 UNEXPECTED_ERROR |
The change may have been made. |
FILE_SERVER_V2_ERROR, under any status |
What happened is not known, so neither is what was written. |
Limits and permissions
Section titled “Limits and permissions”- Plan. GDPR zones are Enterprise only. A domain on any other plan answers
403 FEATURE_NOT_AVAILABLEon all three endpoints, withdetails.feature(gdpr_zones) anddetails.plan. This is true for the owner of the domain too. - Credits. Each domain has a budget of 3000 credits a minute, shared by everyone who calls the API for that domain. Each call on this page costs 8 credits. A request that is refused for its query, body, headers, plan or permissions (
400,403,428) spends none. - Out of credits. The call answers
429 TOO_MANY_REQUESTS, with the wait indetails.retry_after_secondsand in theRetry-Afterheader. - Permissions. Both reads need
ssl.viewon the domain. A change needsssl.edit, plusssl.createforenabled: true(switching on and moving both count) orssl.deleteforenabled: false. Someone withssl.editand neither of the two can read the zone but not change it:403 PERMISSION_DENIED.
Errors you are likely to see
Section titled “Errors you are likely to see”The code is in the message field of the answer.
| Status | Code | What happened |
|---|---|---|
400 |
INVALID_REQUEST |
The body, limit, cursor or an unknown parameter or field is wrong. The answer names the field in fields when it can. |
400 |
INVALID_PRECONDITION |
If-Match is not one quoted ETag as it came from the read. |
403 |
FEATURE_NOT_AVAILABLE |
The domain is not on the Enterprise plan. |
403 |
PERMISSION_DENIED |
You may read the zone but lack ssl.create or ssl.delete for this change. |
404 |
REFERENCE_NOT_FOUND |
The list of locations is not available. It is not an empty list. |
404 |
SETTINGS_GROUP_NOT_FOUND |
The GDPR settings are not available for the domain. It is not a domain with no zone. Nothing was written. |
404 |
DOMAIN_NOT_FOUND |
The CDN does not have the domain. Nothing was read or written. |
409 |
CURSOR_STALE |
The locations changed while you were paging. Start from the first page. |
409 |
ALREADY_IN_STATE |
The zone is already as the body asks. Nothing was written. |
409 |
DOMAIN_WITHOUT_KEY, DOMAIN_REPLACEMENT_PENDING |
The domain is in a state that does not allow the call. |
412 |
REVISION_MISMATCH |
The settings changed since your read. details.current_revision has the current one. Read again and retry. |
415 |
UNSUPPORTED_MEDIA_TYPE |
The body is not JSON. |
428 |
PRECONDITION_REQUIRED |
The If-Match header is missing. |
429 |
TOO_MANY_REQUESTS, RATE_LIMIT_EXCEEDED |
Too many requests. Wait details.retry_after_seconds. |
503 |
STATE_CHANGING, RUNTIME_UNAVAILABLE |
The state of the domain is changing or unavailable. Come back later. |
503 |
UNSAFE_PATH |
The locations could not be read safely. They are unavailable, not empty. |
503 |
COMMITTED_CLEANUP_FAILED, TRANSACTION_... |
See When a change fails part way. |
The errors that come from the key itself, such as API_KEY_IP_NOT_ALLOWED, are on the Errors page.
All GDPR endpoints
Section titled “All GDPR endpoints”Each row opens the endpoint in the API reference, with every parameter, rule and response.
Loading the endpoints...