---
title: "Apply Ip Rule"
method: POST
path: "/api/domains/{domain_id}/agent-desk/analytics/bans"
tags: ["agent_desk"]
---

# Apply Ip Rule

`POST /api/domains/{domain_id}/agent-desk/analytics/bans`

## Request

- Base URL: `https://api-v1.unusual.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api-v1.unusual.ai/api/domains/{domain_id}/agent-desk/analytics/bans`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/login`

Apply an owner override on this desk, then return the full bans payload
so the UI re-renders from one response instead of a write + refetch.

``allow`` / ``block`` upsert the desk's single row for that IP (unique on
``(domain_id, ip_address)``) and clear any ``expires_at`` — re-deciding an
IP means the new decision is open-ended until someone says otherwise.
``clear`` deletes the row, dropping the IP back to the derived threshold
behavior. A ``block`` on a protected AI-provider address is refused (422):
the address is shared by everyone using that assistant.

## Path parameters

- `domain_id` string, required

## Headers

- `x-view-as` string, nullable

## Request body

- IpRuleRequest: An owner's action on one IP, on this desk. ``ip`` and ``action`` are plain strings rather than constrained types on purpose: the handler validates them and raises an explicit 422 with a useful detail, which also means the contract is exercised identically when the handler is called directly from a test.
  - `ip` string, required
  - `action` string, required
  - `reason` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/unusual/apis/dashboard-server.md) - [All operations](https://skmtc.dev/unusual/apis/dashboard-server/llms.txt) - [OpenAPI document](https://skmtc.dev/unusual/apis/dashboard-server/revisions/89f716930ead?raw)
