Purge or refresh selected cached entries
const url = 'https://api.nsin.ir/domains/example.com/cache/keys/purge';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"mode":"delete","entries":[{"domainId":1,"hostname":"example","storePath":"example","keyHash":"example","node":"example"}],"filter":{"hostname":"example","node":"example","path":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.nsin.ir/domains/example.com/cache/keys/purge \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "mode": "delete", "entries": [ { "domainId": 1, "hostname": "example", "storePath": "example", "keyHash": "example", "node": "example" } ], "filter": { "hostname": "example", "node": "example", "path": "example" } }'Targets specific entries — either by listing them in entries, or by
matching a filter. Supply one or the other.
mode: "delete"(default) removes the entry and drops it from the listing.mode: "refresh"only evicts the stored copy, so the next visitor re-fills it. The row stays and updates itself.
entries must carry each row’s stored identity — copy hostname,
store_path, key_hash and node straight from the listing (note the
request body uses camelCase for these). Entries belonging to another
domain are rejected.
truncated is true when a filter matched more entries than one call
may touch — repeat the call until it is false. Requires cache.edit
and a plan including cache purge.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comRequest Body required
Section titled “Request Body required ”Supply either entries or filter.
object
delete removes the entry and drops it from the listing;
refresh only evicts the stored copy so the next visitor re-fills it.
One entry’s stored identity. Note the camelCase field names — they differ from the snake_case used in the listing response.
object
The listing’s hostname.
The listing’s store_path.
The listing’s key_hash.
The listing’s node.
Purge everything matching this filter.
object
Path wildcard, e.g. /assets/*.
Responses
Section titled “ Responses ”Purge result.
object
The filter matched more entries than one call may touch. Repeat the request until this is false.
Example
{ "mode": "delete"}Malformed body, or neither entries nor filter supplied.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Missing, malformed, revoked or expired API key — or the owning account is inactive.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}Read-only key, insufficient role, or cache purge is not on the plan.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The domain is disabled.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}The cache registry is temporarily unreachable.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}