Skip to main content
CDN configuration endpoints accept the complete configuration for one area, such as cache or TLS. Sending only the field you want to change can fail validation or reset other settings. This example changes an existing edge-cache TTL to 3,600 seconds while preserving the other cache fields. Use a non-production distribution first.

Before you begin

  • Complete your first API request; the Bash examples use the same credential variables.
  • Have permission to read and modify the distribution’s cache configuration.
  • Install jq for JSON editing and use curl 7.76 or later for --fail-with-body.
  • Choose an existing distribution in the key’s project. The examples use ID 73; replace it in every URL.
  • Confirm edge caching is already enabled with controlled_by: "cdn". This example does not change who controls freshness.

1. Read and save the current configuration

Run these commands in a private working directory. The files contain distribution settings, not API credentials.
Continue only if the request succeeded and cache-before.json contains the cache configuration rather than an error document. Keep the original file for comparison and rollback.

2. Prepare the change

This command checks the required cache mode before changing the TTL:
Stop if jq fails. A successful diff comparison with changes exits with code 1; review the output and confirm that the TTL is the only intended change. Formatting may also differ.

3. Submit the full document

A successful update does not mean previously cached objects were removed. Use a targeted purge if you also need to invalidate existing content.

4. Read back and test delivery

Repeat the GET request from step 1 with --output cache-verified.json. Compare its edge_cache fields with the intended state, then request a representative public file through the distribution. The saved configuration verifies the control-plane change. Inspect actual responses and request logs to verify delivery behavior.

Recover from a failed or unwanted change

Restoring the saved document replaces all settings in that configuration area. Check for changes made by other operators before restoring it. The API does not document a general conditional-write or idempotency-key mechanism. See request conventions for other configuration areas and caching for the meaning of each control.