Apply a one-click fix
Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.
Runs the fix a recommendation offers in action.apply (or alt.apply).
The server re-reads the problem first: if it is gone the answer is
already_done, and if the item no longer offers this fix the answer is
409 with the fresh list. Otherwise it applies the change through the
same code as the feature's own endpoint, tells the edges, checks that
the change took effect, and returns the domain's new checklist.
Fixes: attack_enforce, attack_ignore, under_attack_on (6-hour
timer), under_attack_off, auto_attack_rules_on/_off,
auto_under_attack_on/_off, waf_restore, waf_enable,
waf_enforce, waf_dry_run, login_rate_limit (a per-IP limit of 10
POSTs a minute on wp-login.php and xmlrpc.php, answered with a check),
login_rate_limit_off (send the rule_id from the fix's undo; a rule
edited since is left alone). The _off and waf_dry_run fixes are
undos and need no recommendation.
Needs the permission of the change itself: rules.edit for attack and
WAF fixes, domain.settings for the switches.
Query parameters
- domainstringrequiredquery
The domain name (for example
example.com). These endpoints take the domain as a query parameter rather than a path segment.
Request body
Content type: application/json · required
- applystringrequired
The fix name from the recommendation's action.
- rule_idinteger
Only for login_rate_limit_off: the rule id from the fix's undo.
Responses
200Applied, or already done.
Content type: application/json
- resultstringOne of:
"applied""already_done" - messagestring
- undoobject
Present when the change can be undone in one call.
Fields
- applystring
- labelstring
- rule_idinteger
Send back with the undo (login_rate_limit_off).
- dataarray of object
The domain's checklist after the change.
{
"result": "applied",
"message": "string",
"undo": {
"apply": "string",
"label": "string",
"rule_id": 0
},
"data": [
{}
]
}400Missing domain or apply, or an unknown fix.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"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.
{
"error": "invalid API key"
}403Missing permission, or the plan does not include it (upgrade_required).
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}404No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}409The item no longer offers this fix (the attack ended, someone else fixed it). data is the fresh list.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}500The fix failed or did not take effect.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}Example request
curl -X POST "https://api.nsin.ir/recommendations/fix?domain=example.com" \
-H "Authorization: Bearer $NSIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"apply": "waf_enforce"
}'