Skip to Content
ReferenceAPI referenceCrowdSec

Ban Spamhaus DROP networks through CrowdSec

POST
/api/v1/crowdsec/ban-networks

Bans the DROP networks you name, or with allUnbannedDays every DROP network that sent traffic in that many days and has no active decision, busiest first and at most 1000. A network with an active decision of any type, a captcha included, keeps it and gets no ban, and a named one comes back ok with alreadyBanned, so a retry is safe. After 3 unreachable LAPI answers in a row or 120 seconds, the rest come back with an error that starts with not attempted. Answers 403 when the server has no CrowdSec machine credentials, CROWDSEC_MACHINE_ID and CROWDSEC_MACHINE_PASSWORD. Needs a Read/write API key or a browser session.

Authorization

cookiesession<token>

Session cookie authentication.

Request Body

application/json
  1. body

The DROP networks to ban, by name or as every unbanned network with traffic.

Set exactly one of networks and allUnbannedDays, or the request gets a 400.

allUnbannedDays?|

Ban every DROP network that sent traffic in this many days and has no active decision of any type, 7, 30 or 90.

Value in73090null
duration*string

How long each ban lasts, such as 4h, 30m, 7d or 1d12h.

networks?array<string>|

The networks to ban, as CIDRs from the DROP list, at most 1000. A network named twice gets one result.

Itemsitems <= 1000

Response Body

Request fulfilled, document follows

application/json
  1. response

The outcome for each network.

leftOut*integer

With allUnbannedDays, the networks without a decision past the first 1000, which this run did not try. 0 otherwise.

results*array<>
Example Request
curl -X POST 'https://geometrikks.example.com/api/v1/crowdsec/ban-networks' \  -H 'Content-Type: application/json' \  -d '{  "duration": "string"}'
Example Response
{  "leftOut": 0,  "results": [    {      "alreadyBanned": true,      "error": "string",      "network": "string",      "ok": true    }  ]}