Skip to Content
ReferenceAPI referenceCrowdSec

Ban an IP or range through CrowdSec

POST
/api/v1/crowdsec/ban

Creates a ban or captcha decision with origin geometrikks on one IP or CIDR, and answers 204 with no body. The bouncers attached to the LAPI enforce it. A CIDR that covers every address gets a 400. 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

What to ban, for how long and why.

duration?|

How long the decision lasts, such as 4h, 30m, 7d or 1d12h. Defaults to CROWDSEC_DEFAULT_BAN_DURATION, 4h by default.

ip*string

An IP, or a range in CIDR form such as 203.0.113.0/24. A /32 or /128 becomes an IP decision.

reason?|

The reason the decision carries. Defaults to manual ban from GeoMetrikks, or manual captcha from GeoMetrikks for a captcha.

type?string

ban or captcha. Defaults to ban.

Default"ban"
Value in"ban""captcha"

Response Body

Request fulfilled, nothing follows

Example Request
curl -X POST 'https://geometrikks.example.com/api/v1/crowdsec/ban' \  -H 'Content-Type: application/json' \  -d '{  "ip": "string"}'
Example Response
Empty