# pub.chive.governance.grantDelegation

> Published by [chive.pub](https://lexicon.garden/identity/did:plc:7natp5xae72bddaqlkef2t4e)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.governance.grantDelegation)
- [Documentation](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.governance.grantDelegation/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.governance.grantDelegation/examples)

## Definitions

### `pub.chive.governance.grantDelegation`

**Type**: `procedure`

Grant PDS delegation to a trusted editor. Only accessible to administrators. Delegation allows the user to write records to the Governance PDS.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `daysValid` | `integer` | Yes | Number of days the delegation is valid |
| `collections` | `array` | Yes | NSID collections the delegation covers |
| `delegateDid` | `string` (did) | Yes | DID of the user to delegate to |
| `maxRecordsPerDay` | `integer` | No | Maximum records delegate can create per day |

#### Output

**Encoding**: `application/json`

#### Errors

- **AuthenticationRequired**
- **Unauthorized**
- **InvalidRequest**

### `pub.chive.governance.grantDelegation#delegationResult`

**Type**: `object`

Result of delegation operation

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `message` | `string` | Yes | Human-readable result message |
| `success` | `boolean` | Yes | Whether the operation succeeded |
| `delegationId` | `string` | No | Delegation ID (if created) |

## Raw Schema

```json
{
  "id": "pub.chive.governance.grantDelegation",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "delegateDid",
            "collections",
            "daysValid"
          ],
          "properties": {
            "daysValid": {
              "type": "integer",
              "default": 365,
              "maximum": 365,
              "minimum": 1,
              "description": "Number of days the delegation is valid"
            },
            "collections": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minLength": 1,
              "description": "NSID collections the delegation covers"
            },
            "delegateDid": {
              "type": "string",
              "format": "did",
              "description": "DID of the user to delegate to"
            },
            "maxRecordsPerDay": {
              "type": "integer",
              "default": 100,
              "maximum": 1000,
              "minimum": 1,
              "description": "Maximum records delegate can create per day"
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "AuthenticationRequired"
        },
        {
          "name": "Unauthorized"
        },
        {
          "name": "InvalidRequest"
        }
      ],
      "output": {
        "schema": {
          "ref": "#delegationResult",
          "type": "ref"
        },
        "encoding": "application/json"
      },
      "description": "Grant PDS delegation to a trusted editor. Only accessible to administrators. Delegation allows the user to write records to the Governance PDS."
    },
    "delegationResult": {
      "type": "object",
      "required": [
        "success",
        "message"
      ],
      "properties": {
        "message": {
          "type": "string",
          "description": "Human-readable result message"
        },
        "success": {
          "type": "boolean",
          "description": "Whether the operation succeeded"
        },
        "delegationId": {
          "type": "string",
          "description": "Delegation ID (if created)"
        }
      },
      "description": "Result of delegation operation"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "revision": 1
}
```
