Purge Endpoint Cache

POST /v1/endpoints/{id}/cache/purge

Drop cached responses for an endpoint. Pass an empty body to purge everything; pass a path_pattern regex to purge only matching paths.

Useful when you've deployed new content and want clients to see it immediately, instead of waiting for the cache TTL to expire. The purge is synchronous — by the time this endpoint returns, the listed entries are gone from the cache.

On deployments without a Redis cache backend, the call is a no-op and returns {"purged": 0} with a friendly message.

Path parameters

id string (uuid) Req
Endpoint UUID.

Request body

path_pattern string (regex)
Optional regex matched against the cached request path. Only entries whose path matches are purged. Max length 500 chars; invalid regex returns 400. Example: "^/api/products" drops everything under /api/products. Omit to purge the whole endpoint.

Response (200 OK)

purged int
Number of cache entries actually removed. 0 can mean "nothing matched" or "cache backend isn't configured" — check the message field in the latter case.
message string?
Set only when there's something noteworthy ("Response cache not configured" on deployments without Redis).

Errors

400 Bad Request
path_pattern not valid regex, or longer than 500 chars.
401 Unauthorized
Missing auth.
403 Forbidden
Endpoint doesn't exist or belongs to another user.
500
Redis error during purge. Safe to retry; partial purges are possible (some entries may already have been removed).
Request — purge everything
curl -X POST "https://api.ngris.com/v1/endpoints/<uuid>/cache/purge" \ -H "X-API-KEY: <your_api_key>"
Request — narrow to /api/products
curl -X POST "https://api.ngris.com/v1/endpoints/<uuid>/cache/purge" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{"path_pattern": "^/api/products"}'
Python
from ngris import Ngris client = Ngris(api_key="<your_api_key>") result = client._post_raw( "/endpoints/<endpoint_uuid>/cache/purge", {"path_pattern": "^/api/products"}, ) print(f"Purged {result['purged']} entries")
Response — 200 OK
{ "purged": 84 }
On this page
Purge Endpoint Cache
Iris