nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Rules

Reorder header rules

patchhttps://api.nsin.ir/domains/{domain}/rules/header/reorder

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

Sets the priority of several header rules at once. Lower priority values are evaluated first, and because header rules compose rather than stopping at the first match, order decides which rule wins when two of them write the same header name — the later one does. The body is a bare array. Requires rules.edit.

Path parameters

  • domainstringrequiredpath

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

Request body

Content type: application/json · required

  • idintegerrequired
  • priorityintegerrequired

Responses

200Number of rules whose priority changed.

Content type: application/json

  • updatedinteger

    How many rules were changed.

json
{
  "updated": 0
}
400Malformed body, or a negative priority.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
401Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "invalid API key"
}
403The key is read-only and this endpoint is a write. Read-only keys may only issue GET, HEAD and OPTIONS.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such domain, or your role on it does not permit this operation. The rules endpoints deliberately answer 404 rather than 403 for an insufficient role, so they never confirm that a domain exists to someone who cannot use it.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "not found"
}
429The key exceeded its request budget (300 requests per minute by default).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "rate limit exceeded"
}

Example request

bash
curl -X PATCH "https://api.nsin.ir/domains/example.com/rules/header/reorder" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
  {
    "id": 0,
    "priority": 0
  }
]'
esc