Skip to content

Purge or refresh selected cached entries

POST
/domains/{domain}/cache/keys/purge
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.

domain
required
string

The domain name (for example example.com) — not a numeric id.

Example
example.com
Media type application/json

Supply either entries or filter.

object
mode

delete removes the entry and drops it from the listing; refresh only evicts the stored copy so the next visitor re-fills it.

string
default: delete
Allowed values: delete refresh
entries
Array<object>

One entry’s stored identity. Note the camelCase field names — they differ from the snake_case used in the listing response.

object
domainId
integer
hostname
required

The listing’s hostname.

string
storePath

The listing’s store_path.

string
keyHash
required

The listing’s key_hash.

string
node
required

The listing’s node.

string
filter

Purge everything matching this filter.

object
hostname
string
node
string
path

Path wildcard, e.g. /assets/*.

string

Purge result.

Media type application/json
object
deleted
integer
mode
string
Allowed values: delete refresh
truncated

The filter matched more entries than one call may touch. Repeat the request until this is false.

boolean
Example
{
"mode": "delete"
}

Malformed body, or neither entries nor filter supplied.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

Missing, malformed, revoked or expired API key — or the owning account is inactive.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example invalidKey
{
"error": "invalid API key"
}

Read-only key, insufficient role, or cache purge is not on the plan.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
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.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The domain is disabled.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The key exceeded its request budget (300 requests per minute by default).

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example limited
{
"error": "rate limit exceeded"
}

The cache registry is temporarily unreachable.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}