Skip to content
Dashboard

Protection

View as Markdown

GDPR

Read the GDPR zone of a domain, switch it on at a location, move it or switch it off.

zone

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"
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.

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 id is what you send as location_id when you change the zone.
  • city, country and continent are labels. country and continent are not ISO codes: show them as they are and do not compare them with a code. name is only there for some locations.
  • limit goes from 1 to 100. Without it a page holds 50 locations.
  • To read the next page, send data.page.next_cursor back as cursor, until it is null. data.page.total is 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.
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" }
}
}

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.

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" }'

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:

  • enabled is required and must be a JSON boolean. "true", 1 and null are refused.
  • location_id is required with enabled: true and refused with enabled: 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.

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.
  • Plan. GDPR zones are Enterprise only. A domain on any other plan answers 403 FEATURE_NOT_AVAILABLE on all three endpoints, with details.feature (gdpr_zones) and details.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 in details.retry_after_seconds and in the Retry-After header.
  • Permissions. Both reads need ssl.view on the domain. A change needs ssl.edit, plus ssl.create for enabled: true (switching on and moving both count) or ssl.delete for enabled: false. Someone with ssl.edit and neither of the two can read the zone but not change it: 403 PERMISSION_DENIED.

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.

Each row opens the endpoint in the API reference, with every parameter, rule and response.

Loading the endpoints...