Skip to main content
Contents

Cache

Purges and cache statistics of a resource.

Literal response from the frozen contract

GET/api/v1/resources/{resource}/cache

Popular files

Returns up to 20 of the most requested files of the resource in the last 24 hours.

Authentication
HTTP Basic with the user API key
Host
https://api.cdnify.lat, https://reseller.cdnify.lat
In CDNify
Same behaviour as before
Rate limited
Yes
API v2 equivalent

Parameters

Parameters v1GetPopularFiles
NameInTypeRequiredRules
resourcePathstringYes
  • Pattern: ^[a-z0-9]{7}$

Responses

  • 200OKapplication/json

    Headers: X-RateLimit-Limit: 1000, X-RateLimit-Remaining: 999, X-RateLimit-Reset: 1768474800

    Fields (4)
    Responses v1GetPopularFiles 200
    FieldTypeRequiredRules
    filesarray<object>Yes
    • At most 20 items
    files[].uristringYes
    files[].hitsintegerYes
    files[].bytesintegerYes
    Example
    {
      "files": [
        {
          "uri": "/img/logo.png",
          "hits": 40,
          "bytes": 2048000
        }
      ]
    }
  • 401Unauthorized

    Headers: WWW-Authenticate: Basic realm="Secured Area"

  • 404Not foundapplication/json

    Fields (3)
    Responses v1GetPopularFiles 404
    FieldTypeRequiredRules
    errorsarray<object>Yes
    • At least 1 items
    errors[].codeintegerYes
    errors[].messagestringYes
    Example
    {
      "errors": [
        {
          "code": 404,
          "message": "HTTP: Failed to find resource"
        }
      ]
    }
  • 429Too many requeststext/plain

    Example
    You have reached the rate limit
curl
curl 'https://api.cdnify.lat/api/v1/resources/a1b2c3d/cache' \
  -u "$CDNIFY_API_KEY:x"
DELETE/api/v1/resources/{resource}/cache

Purge the cache

Purges the whole cache of the resource, or only the URIs listed in files. The answer does not wait for the purge to finish.

Send JSON with Content-Type exactly application/json, or a form: a JSON body that is not read means that the whole cache is purged.

Authentication
HTTP Basic with the user API key
Host
https://api.cdnify.lat, https://reseller.cdnify.lat
In CDNify
Same behaviour as before
Rate limited
Yes
API v2 equivalent

Parameters

Parameters v1PurgeCache
NameInTypeRequiredRules
resourcePathstringYes
  • Pattern: ^[a-z0-9]{7}$

Request body

Content types: application/x-www-form-urlencoded, application/json

Request body v1PurgeCache
FieldTypeRequiredRules
filesarray<string>No
Example
{
  "files": [
    "/css/site.css",
    "/img/logo.png"
  ]
}

Responses

  • 204No content

    Headers: X-RateLimit-Limit: 1000, X-RateLimit-Remaining: 999, X-RateLimit-Reset: 1768474800

  • 401Unauthorized

    Headers: WWW-Authenticate: Basic realm="Secured Area"

  • 404Not foundapplication/json

    Fields (3)
    Responses v1PurgeCache 404
    FieldTypeRequiredRules
    errorsarray<object>Yes
    • At least 1 items
    errors[].codeintegerYes
    errors[].messagestringYes
    Example
    {
      "errors": [
        {
          "code": 404,
          "message": "HTTP: Failed to find resource"
        }
      ]
    }
  • 429Too many requeststext/plain

    Example
    You have reached the rate limit
  • 500Internal server errortext/html

curl
curl -X DELETE 'https://api.cdnify.lat/api/v1/resources/a1b2c3d/cache' \
  -u "$CDNIFY_API_KEY:x" \
  --data-urlencode 'files[]=/css/site.css' \
  --data-urlencode 'files[]=/img/logo.png'
GET/api/v1/resources/{resource}/cache/{period}

Cache statistics

Returns the bandwidth and the popular files of the resource for a period, or between custom dates.

Authentication
HTTP Basic with the user API key
Host
https://api.cdnify.lat, https://reseller.cdnify.lat
In CDNify
Same contract, with a defect corrected
Rate limited
Yes
API v2 equivalent

Parameters

Parameters v1GetCacheStats
NameInTypeRequiredRules
resourcePathstringYes
  • Pattern: ^[a-z0-9]{7}$
periodPathstringYes
  • One of: day, week, month, custom
custom_date_fromQuerystringNo
custom_date_toQuerystringNo

Responses

  • 200OKapplication/json

    Headers: X-RateLimit-Limit: 1000, X-RateLimit-Remaining: 999, X-RateLimit-Reset: 1768474800

    Fields (24)
    Responses v1GetCacheStats 200
    FieldTypeRequiredRules
    statsobjectYes
    stats.dataarray<object>Yes
    stats.data[].timestampstringYes
    stats.data[].cachednumberYes
    stats.data[].non_cachednumberYes
    stats.data[].hitsintegerYes
    stats.popsoneOfYes
    stats.pops.#1objectNo
    stats.pops.#1.*objectNo
    stats.pops.#1.*.namestringYes
    stats.pops.#1.*.hitsintegerYes
    stats.pops.#1.*.bytesnumberYes
    stats.pops.#2arrayNo
    • At most 0 items
    stats.hitsintegerYes
    stats.bandwidthnumberYes
    filesarray<object>Yes
    • At most 20 items
    files[].uristringYes
    files[].hitsintegerYes
    files[].bytesintegerYes
    resourceobjectYes
    resource.idstringYes
    resource.hostnamestringYes
    resource.aliasstringYes
    resource.cache_expiryintegerYes
    Example
    {
      "stats": {
        "data": [
          {
            "timestamp": "2026-01-15 00:00:00",
            "cached": 1048576,
            "non_cached": 2097152,
            "hits": 42
          }
        ],
        "pops": {
          "Amsterdam": {
            "name": "Amsterdam",
            "hits": 42,
            "bytes": 3145728
          }
        },
        "hits": 42,
        "bandwidth": 3145728
      },
      "files": [
        {
          "uri": "/img/logo.png",
          "hits": 40,
          "bytes": 2048000
        }
      ],
      "resource": {
        "id": "a1b2c3d",
        "hostname": "example.a.cdnify.io",
        "alias": "example",
        "cache_expiry": 0
      }
    }
  • 401Unauthorized

    Headers: WWW-Authenticate: Basic realm="Secured Area"

  • 404Not foundapplication/json

    Fields (3)
    Responses v1GetCacheStats 404
    FieldTypeRequiredRules
    errorsarray<object>Yes
    • At least 1 items
    errors[].codeintegerYes
    errors[].messagestringYes
    Example
    {
      "errors": [
        {
          "code": 404,
          "message": "HTTP: Failed to find resource"
        }
      ]
    }
  • 429Too many requeststext/plain

    Example
    You have reached the rate limit
  • 500Internal server errortext/html

curl
curl 'https://api.cdnify.lat/api/v1/resources/a1b2c3d/cache/day' \
  -u "$CDNIFY_API_KEY:x"
POST/api/v1/resources/{resource}/purge-cache-stats

Purge from the web form

Purge action of the previous web panel, declared under the API. It answers with a redirect; integrations should use the cache purge route.

Authentication
HTTP Basic with the user API key
Host
https://api.cdnify.lat, https://reseller.cdnify.lat
In CDNify
Same contract, with a defect corrected
Rate limited
Yes
API v2 equivalent

Parameters

Parameters v1PurgeCacheFromForm
NameInTypeRequiredRules
resourcePathstringYes
  • Pattern: ^[a-z0-9]{7}$

Request body

Content types: application/x-www-form-urlencoded

Request body v1PurgeCacheFromForm
FieldTypeRequiredRules
filesstringNo
Example
{
  "files": "/css/site.css\n/img/logo.png"
}

Responses

  • 302Found (redirect)

    Headers: Location: /resource/a1b2c3d/cache

  • 401Unauthorized

    Headers: WWW-Authenticate: Basic realm="Secured Area"

  • 404Not foundapplication/json

    Fields (3)
    Responses v1PurgeCacheFromForm 404
    FieldTypeRequiredRules
    errorsarray<object>Yes
    • At least 1 items
    errors[].codeintegerYes
    errors[].messagestringYes
    Example
    {
      "errors": [
        {
          "code": 404,
          "message": "HTTP: Failed to find resource"
        }
      ]
    }
  • 429Too many requeststext/plain

    Example
    You have reached the rate limit
curl
curl -X POST 'https://api.cdnify.lat/api/v1/resources/a1b2c3d/purge-cache-stats' \
  -u "$CDNIFY_API_KEY:x" \
  --data-urlencode 'files=/css/site.css
/img/logo.png'