# tools.ozone.safelink.addRule

> Published by [ozone-lexicons.bsky.social](https://lexicon.garden/identity/did:plc:33dt5kftu3jq2h5h4jjlqezt)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:33dt5kftu3jq2h5h4jjlqezt/tools.ozone.safelink.addRule)
- [Documentation](https://lexicon.garden/lexicon/did:plc:33dt5kftu3jq2h5h4jjlqezt/tools.ozone.safelink.addRule/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:33dt5kftu3jq2h5h4jjlqezt/tools.ozone.safelink.addRule/examples)

## Definitions

### `tools.ozone.safelink.addRule`

**Type**: `procedure`

Add a new URL safety rule

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `url` | `string` | Yes | The URL or domain to apply the rule to |
| `action` | `ref` → `tools.ozone.safelink.defs#actionType` | Yes |  |
| `reason` | `ref` → `tools.ozone.safelink.defs#reasonType` | Yes |  |
| `comment` | `string` | No | Optional comment about the decision |
| `pattern` | `ref` → `tools.ozone.safelink.defs#patternType` | Yes |  |
| `createdBy` | `string` (did) | No | Author DID. Only respected when using admin auth |

#### Output

**Encoding**: `application/json`

#### Errors

- **InvalidUrl**: The provided URL is invalid
- **RuleAlreadyExists**: A rule for this URL/domain already exists

## Raw Schema

```json
{
  "id": "tools.ozone.safelink.addRule",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "url",
            "pattern",
            "action",
            "reason"
          ],
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL or domain to apply the rule to"
            },
            "action": {
              "ref": "tools.ozone.safelink.defs#actionType",
              "type": "ref"
            },
            "reason": {
              "ref": "tools.ozone.safelink.defs#reasonType",
              "type": "ref"
            },
            "comment": {
              "type": "string",
              "description": "Optional comment about the decision"
            },
            "pattern": {
              "ref": "tools.ozone.safelink.defs#patternType",
              "type": "ref"
            },
            "createdBy": {
              "type": "string",
              "format": "did",
              "description": "Author DID. Only respected when using admin auth"
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "InvalidUrl",
          "description": "The provided URL is invalid"
        },
        {
          "name": "RuleAlreadyExists",
          "description": "A rule for this URL/domain already exists"
        }
      ],
      "output": {
        "schema": {
          "ref": "tools.ozone.safelink.defs#event",
          "type": "ref"
        },
        "encoding": "application/json"
      },
      "description": "Add a new URL safety rule"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
