Skip to content
nsin docs

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", "enc": "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. When a storage node that may hold the entries does not confirm, the answer is 502 with complete: false and unreached — the purge did not fully happen. 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
enc

The listing’s enc. Optional — when omitted, every stored encoding of the entry is targeted.

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
complete

Every storage node that could hold the entries confirmed. false only on a 502: the purge did not fully happen.

boolean
unreached

What could not be reached and why. Present when complete is false.

Array<string>
error

Explanation on a 502.

string
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. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

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"
}

The domain has no active 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"
}

Read-only key, your role on the domain lacks cache.edit, or cache purge is not on the domain’s 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 or banned.

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"
}

A storage node that may hold the entries did not confirm. unreached says which and why; retry.

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
complete

Every storage node that could hold the entries confirmed. false only on a 502: the purge did not fully happen.

boolean
unreached

What could not be reached and why. Present when complete is false.

Array<string>
error

Explanation on a 502.

string
Example
{
"mode": "delete"
}

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"
}