Edge Image CDN

On-the-fly image optimization, resizing and delivery from globally distributed edge nodes. A single REST endpoint handles format negotiation, compression and cache invalidation.

Access is restricted to authorized origins only. Contact your administrator to obtain an API token.

Base URL

Base URL https://cdn-edge.djrafik.ru/v1

All API requests must use HTTPS. Plain HTTP connections are rejected.

Authentication

All requests require a Bearer token in the Authorization header.

Header Authorization: Bearer <token>

Tokens are scoped to a single delivery zone. A missing or invalid token returns 401 Unauthorized.

Endpoints

POST /v1/optimize Optimize and re-encode an image

Fetches the source image, strips metadata and re-encodes it to the most efficient format supported by the client (AVIF, WebP or JPEG) based on the Accept header.

Request body

JSON
{
  "source":  "https://origin.example/img/hero.jpg",
  "quality": 82,
  "strip":   true
}

Response

200 OK
{
  "id":      "img_01J9X3K2P7",
  "url":     "https://cdn-edge.djrafik.ru/c/01J9X3K2P7.avif",
  "bytes":   48213,
  "format":  "avif"
}
GET /v1/resize Resize via query parameters

Returns a resized variant of a previously stored asset. Width and height are clamped to the zone's configured maximums.

Example GET /v1/resize?id=img_01J9X3K2P7&w=640&h=360&fit=cover
POST /v1/purge Invalidate cached variants

Purges all cached variants for the given asset IDs across every edge location. Propagation completes within ~30 seconds.

JSON
{
  "ids": ["img_01J9X3K2P7", "img_01J9X4M0QZ"]
}
200 OK
{
  "purged": 2,
  "status": "scheduled"
}

Error codes

HTTPCodeDescription
400invalid_sourceSource URL is missing or unreachable
401unauthorizedMissing or invalid Bearer token
413source_too_largeSource exceeds the 25 MB limit
429rate_limitedToo many requests — see rate limits
502origin_errorUpstream origin returned an error

Rate limits

Limits apply per token, per minute:

  • POST /v1/optimize — 300 req / min
  • GET /v1/resize — 1 200 req / min
  • POST /v1/purge — 30 req / min

Exceeded limits return 429 with a Retry-After header.

Changelog

v2.3.0 2026-04-22

Added AVIF encoding on the fast path and per-zone quality presets.

v2.2.1 2026-02-09

Reduced purge propagation time to under 30 seconds globally.

v2.1.0 2025-11-30

Introduced the fit=cover resize mode and smart cropping.