# GET /security/bans

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the security group.

List bans that match the filters

- Who may call it: administrator
- Token scope, any of: security, read, all
- Answers: 200 OK

The API returns one page of matching bans from the past 30 days, with pagination details and counts by service and state. The events field contains up to 100 of the latest bans and unbans, newest first, regardless of the filters.

Empty filter values are treated as omitted. The API returns 400 for invalid nonempty values of jail, service, since, until, q, or state.

## Parameters

- `address` (query, string, up to 64 characters): IP address to match exactly or CIDR network to match bans for IP addresses within that network.
- `jail` (query, string, matching ^[a-z0-9][a-z0-9-]{0,31}$): Name of the rule that issued the ban, using 1 to 32 lowercase letters, digits, or hyphens and starting with a letter or digit. The names default and includes are reserved.
- `service` (query, string, one of ssh, panel, mail, webmail, phpmyadmin, ftp, sites, repeat, own): Service protected by the rule, one of ssh, panel, mail, webmail, phpmyadmin, ftp, sites, repeat, or own. Use own for rules outside UrbeStack's built-in service groups.
- `q` (query, string, up to 200 characters): IP address, CIDR network, or case-sensitive substring of the IP address or triggering log line, such as a mailbox or login. The search accepts up to 200 characters and excludes ASCII control characters.
- `since` (query, string, matching ^\d{4}-\d\d-\d\d(?:[T ]\d\d:\d\d(?::\d\d)?)?Z?$): Inclusive lower bound on when the ban began, as a UTC date or date and time, such as 2026-09-17 or 2026-09-17T14:02:00Z. A date alone means 00:00:00 UTC on that date.
- `until` (query, string, matching ^\d{4}-\d\d-\d\d(?:[T ]\d\d:\d\d(?::\d\d)?)?Z?$): Inclusive upper bound on when the ban began, as a UTC date or date and time, such as 2026-09-17 or 2026-09-17T14:02:00Z. A date alone means 23:59:59 UTC on that date.
- `state` (query, string, one of active, expired, unblocked, all): Ban state to match, one of active, expired, unblocked, or all. Defaults to all.
- `page` (query, integer, 1 or more): Page number from 1 to 999999. Missing or invalid values default to 1, and a valid number past the last page returns the last page.
- `per_page` (query, integer, 1 to 1000): Number of bans per page, from 1 to 1000. Defaults to 200 if omitted or invalid.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X GET "$API/security/bans?address=info@example.com&jail=text&service=ssh&q=text&since=text&until=text&state=active&page=1&per_page=1" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

```
{
  "active": 1,
  "bans": [
    {
      "address": "info@example.com",
      "banned_at": "text",
      "id": 1,
      "jail": "text",
      "line": "text",
      "scope": "all",
      "service": "ssh",
      "state": "active",
      "unbanned_at": "text",
      "unbanned_by": "text",
      "until": "text"
    }
  ],
  "events": [
    {
      "address": "info@example.com",
      "at": "text",
      "by": "text",
      "jail": "text",
      "kind": "ban",
      "line": "text",
      "until": "text"
    }
  ],
  "page": 1,
  "pages": 1,
  "per_page": 1,
  "service_list": [
    {
      "key": "panel.port",
      "label": "my laptop"
    }
  ],
  "services": {},
  "states": {},
  "total": 1
}
```

## Errors

- 400: '<n>' is a name fail2ban keeps for itself
- 400: <what> is a date (2026-09-17) or a date and time (2026-09-17T14:02:00Z), UTC
- 400: <what> is not a real date
- 400: A rule name is 1 to 32 lowercase letters, digits and dashes
- 400: A service is one of ssh, panel, mail, webmail, phpmyadmin, ftp, sites, repeat or own
- 400: The search is up to 200 characters
- 400: The state is active, expired, unblocked or all
- 401: Authentication required
