# Set the rule for declared agents

`PUT /protection/agents` · Rivier · hosting

Set the rule for declared agents: `default` and/or `agents` (host of the agent's key directory to { mode, perMinute (only with ceiling), note }). A field sent replaces that field whole, so send the full list of rules; a field left out is kept. Needs a person who may configure (an agent needs approval); audited. Protection must be on.

- Scope: hosting:write
- Mcp: rivier_protection_set_agents
- Graphql: Mutation.hostingProtectionSetagents
- Sdk: hosting.protection.setagents
- Cli: hosting protection setagents

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "default": {
      "type": "string",
      "enum": [
        "welcome",
        "read_only",
        "refuse",
        "accountable_only"
      ]
    },
    "agents": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "welcome",
              "read_only",
              "ceiling",
              "refuse"
            ]
          },
          "perMinute": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100000
          },
          "note": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "mode"
        ],
        "additionalProperties": false
      },
      "propertyNames": {
        "minLength": 3,
        "maxLength": 253,
        "pattern": "^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$"
      }
    }
  },
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PUT 'https://api.rivier.ai/protection/agents' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "default": "welcome",
  "agents": {}
}'
```
