Put Firewall Configuration
PUT
https://api.vercel.com/v1/security/firewall/configSet the firewall configuration to provided rules and settings. Creates or overwrite the existing firewall configuration.
https://api.vercel.com/v1/security/firewall/config
const response = await fetch('https://api.vercel.com/v1/security/firewall/config?projectId=string&teamId=string&slug=string', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ "firewallEnabled": "true", "managedRules": "value", "crs": { "sd": { "active": "true", "action": "deny" }, "ma": { "active": "true", "action": "deny" }, "lfi": { "active": "true", "action": "deny" }, "rfi": { "active": "true", "action": "deny" }, "rce": { "active": "true", "action": "deny" }, "php": { "active": "true", "action": "deny" }, "gen": { "active": "true", "action": "deny" }, "xss": { "active": "true", "action": "deny" }, "sqli": { "active": "true", "action": "deny" }, "sf": { "active": "true", "action": "deny" }, "java": { "active": "true", "action": "deny" } }, "rules": [ { "id": "icfg_1234567890", "name": "Example Name", "description": "string", "active": "true", "conditionGroup": [ { "conditions": [ { "type": "host", "op": "re", "neg": "true", "key": "string", "value": "string" } ] } ], "action": { "mitigate": { "action": "log", "rateLimit": { "algo": "fixed_window", "window": "123", "limit": "123", "keys": [], "action": "log" }, "redirect": { "location": "string", "permanent": "true" }, "actionDuration": "string", "bypassSystem": "true", "logHeaders": "string" } }, "valid": "true", "validationErrors": [] } ], "rulesets": [ { "id": "icfg_1234567890", "name": "Example Name", "description": "string", "active": "true", "conditionGroup": [ { "conditions": [ { "type": "host", "op": "re", "neg": "true", "key": "string", "value": "string" } ] } ], "action": { "mitigate": { "action": "deny" } }, "valid": "true", "validationErrors": [] } ], "ips": [ { "id": "icfg_1234567890", "hostname": "Example Name", "ip": "string", "notes": "string", "action": "deny" } ], "botIdEnabled": "true", "logHeaders": "string" }),});
const data = await response.json();console.log(data);Response
{ "active": { "botIdEnabled": "false", "changes": [ "value" ], "conditions": [ { "active": "false", "conditionGroup": [ { "conditions": [ { "key": "string", "neg": "false", "op": "eq", "type": "bot_category", "value": "string" } ] } ], "description": "string", "id": "icfg_1234567890", "name": "Example Name" } ], "crs": { "gen": { "action": "deny", "active": "false" }, "java": { "action": "deny", "active": "false" }, "lfi": { "action": "deny", "active": "false" }, "ma": { "action": "deny", "active": "false" }, "php": { "action": "deny", "active": "false" }, "rce": { "action": "deny", "active": "false" }, "rfi": { "action": "deny", "active": "false" }, "sd": { "action": "deny", "active": "false" }, "sf": { "action": "deny", "active": "false" }, "sqli": { "action": "deny", "active": "false" }, "xss": { "action": "deny", "active": "false" } }, "firewallEnabled": "false", "id": "icfg_1234567890", "ips": [ { "action": "bypass", "hostname": "Example Name", "id": "icfg_1234567890", "ip": "string", "notes": "string" } ], "logHeaders": [], "managedRules": { "ai_bots": { "action": "challenge", "active": "false", "updatedAt": "string", "userId": "example_id", "username": "string" }, "bot_protection": { "action": "challenge", "active": "false", "updatedAt": "string", "userId": "example_id", "username": "string" }, "owasp": { "action": "challenge", "active": "false", "updatedAt": "string", "userId": "example_id", "username": "string" }, "traffic_sources": { "action": "challenge", "active": "false", "updatedAt": "string", "userId": "example_id", "username": "string" }, "vercel_ruleset": { "action": "challenge", "active": "false", "updatedAt": "string", "userId": "example_id", "username": "string" } }, "ownerId": "example_id", "projectKey": "string", "rules": [ { "action": { "mitigate": { "action": "allow", "actionDuration": "string", "bypassSystem": "false", "logHeaders": [], "rateLimit": { "action": "challenge", "algo": "fixed_window", "keys": [], "limit": "123", "window": "123" }, "redirect": { "location": "string", "permanent": "false" } } }, "active": "false", "conditionGroup": [ { "conditions": [ { "key": "string", "neg": "false", "op": "eq", "type": "bot_category", "value": "string" } ] } ], "description": "string", "id": "icfg_1234567890", "name": "Example Name", "valid": "true", "validationErrors": "value" } ], "rulesets": [ { "active": "false", "conditionGroup": [ { "conditions": [ { "key": "string", "neg": "false", "op": "eq", "type": "bot_category", "value": "string" } ] } ], "description": "string", "id": "icfg_1234567890", "name": "Example Name", "action": { "mitigate": { "action": "allow", "actionDuration": "string", "bypassSystem": "false", "logHeaders": [], "rateLimit": { "action": "challenge", "algo": "fixed_window", "keys": [], "limit": "123", "window": "123" }, "redirect": { "location": "string", "permanent": "false" } } } } ], "updatedAt": "string", "version": "123" }}AuthorizationbearerToken
Default authentication mechanism