Firewall
A firewall per project, run by the edge servers before the code: always-on flood and malformed-request protection, and custom rules on address, country, method, path, host and headers that deny, allow, log or rate limit. Checks are free; stopped requests are not billed.
/v1/functions/{name}/firewallThe firewall#
Status (normal, or mitigating when a system mitigation stopped a request in the last ten minutes), the always-on system mitigations, the custom rules in the order they run, the plan's limits, the rule model and the country data's source and attribution.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Response
200Firewall
activebooleanstatusstringone of
normal,mitigatingsystemFirewallMitigation[]idstringone of
sys:flood,sys:malformednameobjectenstringfastring
descriptionobjectenstringfastring
activebooleanhits_10mintegerrequests it stopped in the last ten minutes
rulesFirewallRule[]idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
publishedbooleanfalse when no rule is enabled
limitsobjectplanstringcustom_rulesintegerrate_limit_rulesintegerconditions_per_ruleintegervalues_per_conditionintegercustom_rules_usedintegerrate_limit_rules_usedinteger
modelobjectfieldsstring[]actionsstring[]windowsinteger[]
geoipobjectwhere the country of an address comes from: DB-IP IP to Country Lite, CC BY 4.0 (IP geolocation by DB-IP)
sourcestringlicensestringattributionstringurlstring
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/functions/my-api/firewall" \
-H "Authorization: Bearer $KEY"/v1/functions/{name}/firewall/rulesAdd a firewall rule#
Add a custom rule at position (0 runs first; default last). Published at once to every server; nothing restarts. The plan caps the rules and the rate limit rules per project.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Request bodyapplication/json
namestringrequired1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]requiredgroups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringrequireddeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
positioninteger0 runs first; default last
at least 0
Response
201FirewallRule
idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_rule, firewall_bad_condition, firewall_bad_regex, firewall_bad_rate, firewall_bad_position |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 409 | firewall_limit |
| 500 | internal: an unexpected failure |
Example
curl -X POST "https://api.ibel.ai/v1/functions/my-api/firewall/rules" \
-H "Authorization: Bearer $KEY" \
-d '{"name":"my-api","if":[[{"field":"ip","op":"in","values":["…"],"name":"my-api","neg":true}]],"action":"deny"}'- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersidstringpathrequiredthe rule's id
pattern
^fwr_[a-z0-9]{12}$
Response
200FirewallRule
idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/functions/my-api/firewall/rules/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
-H "Authorization: Bearer $KEY"/v1/functions/{name}/firewall/rules/{id}Delete a firewall rule#
Delete a custom rule; the ones after it move up.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersidstringpathrequiredthe rule's id
pattern
^fwr_[a-z0-9]{12}$
Response
200FirewallDeleted
deletedstringthe rule's id
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl -X DELETE "https://api.ibel.ai/v1/functions/my-api/firewall/rules/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
-H "Authorization: Bearer $KEY"/v1/functions/{name}/firewall/rules/{id}Change a firewall rule#
Any of the rule's fields; the others stay. {"enabled": false} switches it off; if replaces its conditions.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersidstringpathrequiredthe rule's id
pattern
^fwr_[a-z0-9]{12}$
Request bodyapplication/json
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
Response
200FirewallRule
idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_rule, firewall_bad_condition, firewall_bad_regex, firewall_bad_rate |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 409 | firewall_limit |
| 500 | internal: an unexpected failure |
Example
curl -X PATCH "https://api.ibel.ai/v1/functions/my-api/firewall/rules/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
-H "Authorization: Bearer $KEY" \
-d '{"name":"my-api","description":"…","enabled":true,"if":[[{"field":"ip","op":"in","values":["…"],"name":"my-api","neg":true}]],"action":"deny","rate":{"limit":1,"window":60,"key":"ip","then":"deny"}}'/v1/functions/{name}/firewall/orderReorder the firewall rules#
Every rule id of the project once, in the new order (the first runs first). Answers with the firewall.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Request bodyapplication/json
idsstring[]requiredevery rule id once, in the new order
Response
200Firewall
activebooleanstatusstringone of
normal,mitigatingsystemFirewallMitigation[]idstringone of
sys:flood,sys:malformednameobjectenstringfastring
descriptionobjectenstringfastring
activebooleanhits_10mintegerrequests it stopped in the last ten minutes
rulesFirewallRule[]idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
publishedbooleanfalse when no rule is enabled
limitsobjectplanstringcustom_rulesintegerrate_limit_rulesintegerconditions_per_ruleintegervalues_per_conditionintegercustom_rules_usedintegerrate_limit_rules_usedinteger
modelobjectfieldsstring[]actionsstring[]windowsinteger[]
geoipobjectwhere the country of an address comes from: DB-IP IP to Country Lite, CC BY 4.0 (IP geolocation by DB-IP)
sourcestringlicensestringattributionstringurlstring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_order |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl -X PUT "https://api.ibel.ai/v1/functions/my-api/firewall/order" \
-H "Authorization: Bearer $KEY" \
-d '{"ids":["…"]}'/v1/functions/{name}/firewall/checkTest a request against the firewall#
What the rules would do with a request; nothing is sent to the project. Rate limits are not counted (one request is never over a limit).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Request bodyapplication/json
ipstringrequiredcountrystringtwo letters
methodstringdefault
"GET"pathstringdefault
"/"hoststringuser_agentstringheadersmap of string
Response
200FirewallVerdict
outcomestringone of
allowed,denied,rate_limitedrulestring | nullrule_namestring | nullloggedobject[]idstringnamestring | null
statusinteger403, 429, or 0 when allowed
notestring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_check |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl -X POST "https://api.ibel.ai/v1/functions/my-api/firewall/check" \
-H "Authorization: Bearer $KEY" \
-d '{"ip":"…"}'/v1/functions/{name}/firewall/metricsFirewall metrics#
Requests allowed, denied, logged and rate limited over time, hits per rule (every rule and system mitigation, with no hits too), and the top 20 addresses and countries the firewall stopped. Counts are kept 31 days.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersrangestringquery1h (1-minute steps), 24h (15 minutes, the default) or 7d (2 hours)
one of
1h,24h,7d· default"24h"
Response
200FirewallMetrics
rangestringstepstringtotalsobjectallowedintegerdeniedintegerloggedintegerrate_limitedinteger
seriesobject[]tstring (date-time)allowedintegerdeniedintegerloggedintegerrate_limitedinteger
rulesobject[]idstringnamestring | nullsystembooleanhitsintegeroutcomesmap of integerseriesobject[]tstring (date-time)ninteger
ipsobject[]ipstringcountrystring | nulloutcomestringninteger
countriesobject[]countrystringninteger
notestring
Errors
| Status | Description |
|---|---|
| 400 | bad_range |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/functions/my-api/firewall/metrics" \
-H "Authorization: Bearer $KEY"/v1/functions/{name}/firewall/auditFirewall changes#
The firewall's rule changes, newest first, with who, when and the before and after. Page with before (the next of the last page).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersbeforeintegerqueryonly entries older than this id
at least 1
limitintegerqueryhow many (default 50)
1–200 · default
50
Response
200FirewallAudit
entriesobject[]idintegeratstring (date-time)actorstringactionstringone of
rule.create,rule.update,rule.enable,rule.disable,rule.delete,rule.reorderrule_idstringnamestringbeforeanyafterany
nextinteger | nullthe
beforeof the next page
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/functions/my-api/firewall/audit" \
-H "Authorization: Bearer $KEY"/v1/apps/{name}/firewallThe firewall#
Status (normal, or mitigating when a system mitigation stopped a request in the last ten minutes), the always-on system mitigations, the custom rules in the order they run, the plan's limits, the rule model and the country data's source and attribution.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Response
200Firewall
activebooleanstatusstringone of
normal,mitigatingsystemFirewallMitigation[]idstringone of
sys:flood,sys:malformednameobjectenstringfastring
descriptionobjectenstringfastring
activebooleanhits_10mintegerrequests it stopped in the last ten minutes
rulesFirewallRule[]idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
publishedbooleanfalse when no rule is enabled
limitsobjectplanstringcustom_rulesintegerrate_limit_rulesintegerconditions_per_ruleintegervalues_per_conditionintegercustom_rules_usedintegerrate_limit_rules_usedinteger
modelobjectfieldsstring[]actionsstring[]windowsinteger[]
geoipobjectwhere the country of an address comes from: DB-IP IP to Country Lite, CC BY 4.0 (IP geolocation by DB-IP)
sourcestringlicensestringattributionstringurlstring
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/apps/my-api/firewall" \
-H "Authorization: Bearer $KEY"/v1/apps/{name}/firewall/rulesAdd a firewall rule#
Add a custom rule at position (0 runs first; default last). Published at once to every server; nothing restarts. The plan caps the rules and the rate limit rules per project.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Request bodyapplication/json
namestringrequired1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]requiredgroups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringrequireddeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
positioninteger0 runs first; default last
at least 0
Response
201FirewallRule
idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_rule, firewall_bad_condition, firewall_bad_regex, firewall_bad_rate, firewall_bad_position |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 409 | firewall_limit |
| 500 | internal: an unexpected failure |
Example
curl -X POST "https://api.ibel.ai/v1/apps/my-api/firewall/rules" \
-H "Authorization: Bearer $KEY" \
-d '{"name":"my-api","if":[[{"field":"ip","op":"in","values":["…"],"name":"my-api","neg":true}]],"action":"deny"}'- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersidstringpathrequiredthe rule's id
pattern
^fwr_[a-z0-9]{12}$
Response
200FirewallRule
idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/apps/my-api/firewall/rules/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
-H "Authorization: Bearer $KEY"/v1/apps/{name}/firewall/rules/{id}Delete a firewall rule#
Delete a custom rule; the ones after it move up.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersidstringpathrequiredthe rule's id
pattern
^fwr_[a-z0-9]{12}$
Response
200FirewallDeleted
deletedstringthe rule's id
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl -X DELETE "https://api.ibel.ai/v1/apps/my-api/firewall/rules/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
-H "Authorization: Bearer $KEY"/v1/apps/{name}/firewall/rules/{id}Change a firewall rule#
Any of the rule's fields; the others stay. {"enabled": false} switches it off; if replaces its conditions.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersidstringpathrequiredthe rule's id
pattern
^fwr_[a-z0-9]{12}$
Request bodyapplication/json
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
Response
200FirewallRule
idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_rule, firewall_bad_condition, firewall_bad_regex, firewall_bad_rate |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 409 | firewall_limit |
| 500 | internal: an unexpected failure |
Example
curl -X PATCH "https://api.ibel.ai/v1/apps/my-api/firewall/rules/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
-H "Authorization: Bearer $KEY" \
-d '{"name":"my-api","description":"…","enabled":true,"if":[[{"field":"ip","op":"in","values":["…"],"name":"my-api","neg":true}]],"action":"deny","rate":{"limit":1,"window":60,"key":"ip","then":"deny"}}'/v1/apps/{name}/firewall/orderReorder the firewall rules#
Every rule id of the project once, in the new order (the first runs first). Answers with the firewall.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Request bodyapplication/json
idsstring[]requiredevery rule id once, in the new order
Response
200Firewall
activebooleanstatusstringone of
normal,mitigatingsystemFirewallMitigation[]idstringone of
sys:flood,sys:malformednameobjectenstringfastring
descriptionobjectenstringfastring
activebooleanhits_10mintegerrequests it stopped in the last ten minutes
rulesFirewallRule[]idstringpattern
^fwr_[a-z0-9]{12}$positioninteger0 runs first
namestring1–80 characters
descriptionstringup to 500 characters
enabledbooleandefault
trueifFirewallCondition[][]groups of conditions: the rule matches when every condition of at least one group matches (a flat list is one group)
1–… items
fieldstringrequiredone of
ip,country,method,path,host,user_agent,headeropstringip, country, method:
in; path, host, user_agent, header: eq, starts, ends, contains, in, re; header also existsone of
eq,starts,ends,contains,in,re,exists· default"in"valuesstring[]ip: addresses or CIDR ranges (IPv4, IPv6); country: two-letter codes; method: GET, POST…; one value except for
in; none forexists.re: 256 characters at most, no lookaround or backreferences,(?i)to ignore casenamestringheader: the header's name
negboolean
actionstringdeny: 403, the code does not run; allow: skip the rules after it; log: count and go on; rate_limit: needs
rateone of
deny,allow,log,rate_limitrateFirewallRatelimitintegerrequiredrequests per window, per key
1–1000000
windowintegerseconds
one of
10,60,300,600,3600· default60keystringiporheader:<name>default
"ip"thenstringabove the limit: 429, or only log
one of
deny,log· default"deny"
created_atstring (date-time)updated_atstring (date-time)created_bystringan email or key name
updated_bystring
publishedbooleanfalse when no rule is enabled
limitsobjectplanstringcustom_rulesintegerrate_limit_rulesintegerconditions_per_ruleintegervalues_per_conditionintegercustom_rules_usedintegerrate_limit_rules_usedinteger
modelobjectfieldsstring[]actionsstring[]windowsinteger[]
geoipobjectwhere the country of an address comes from: DB-IP IP to Country Lite, CC BY 4.0 (IP geolocation by DB-IP)
sourcestringlicensestringattributionstringurlstring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_order |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl -X PUT "https://api.ibel.ai/v1/apps/my-api/firewall/order" \
-H "Authorization: Bearer $KEY" \
-d '{"ids":["…"]}'/v1/apps/{name}/firewall/checkTest a request against the firewall#
What the rules would do with a request; nothing is sent to the project. Rate limits are not counted (one request is never over a limit).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 characters
Request bodyapplication/json
ipstringrequiredcountrystringtwo letters
methodstringdefault
"GET"pathstringdefault
"/"hoststringuser_agentstringheadersmap of string
Response
200FirewallVerdict
outcomestringone of
allowed,denied,rate_limitedrulestring | nullrule_namestring | nullloggedobject[]idstringnamestring | null
statusinteger403, 429, or 0 when allowed
notestring
Errors
| Status | Description |
|---|---|
| 400 | firewall_bad_check |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl -X POST "https://api.ibel.ai/v1/apps/my-api/firewall/check" \
-H "Authorization: Bearer $KEY" \
-d '{"ip":"…"}'/v1/apps/{name}/firewall/metricsFirewall metrics#
Requests allowed, denied, logged and rate limited over time, hits per rule (every rule and system mitigation, with no hits too), and the top 20 addresses and countries the firewall stopped. Counts are kept 31 days.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersrangestringquery1h (1-minute steps), 24h (15 minutes, the default) or 7d (2 hours)
one of
1h,24h,7d· default"24h"
Response
200FirewallMetrics
rangestringstepstringtotalsobjectallowedintegerdeniedintegerloggedintegerrate_limitedinteger
seriesobject[]tstring (date-time)allowedintegerdeniedintegerloggedintegerrate_limitedinteger
rulesobject[]idstringnamestring | nullsystembooleanhitsintegeroutcomesmap of integerseriesobject[]tstring (date-time)ninteger
ipsobject[]ipstringcountrystring | nulloutcomestringninteger
countriesobject[]countrystringninteger
notestring
Errors
| Status | Description |
|---|---|
| 400 | bad_range |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/apps/my-api/firewall/metrics" \
-H "Authorization: Bearer $KEY"/v1/apps/{name}/firewall/auditFirewall changes#
The firewall's rule changes, newest first, with who, when and the before and after. Page with before (the next of the last page).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
namestringpathrequiredthe function's or app's name
pattern
^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$· up to 63 charactersbeforeintegerqueryonly entries older than this id
at least 1
limitintegerqueryhow many (default 50)
1–200 · default
50
Response
200FirewallAudit
entriesobject[]idintegeratstring (date-time)actorstringactionstringone of
rule.create,rule.update,rule.enable,rule.disable,rule.delete,rule.reorderrule_idstringnamestringbeforeanyafterany
nextinteger | nullthe
beforeof the next page
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/apps/my-api/firewall/audit" \
-H "Authorization: Bearer $KEY"