# party.whey.writeproxy.createDelegation

> Create a pending write delegation for one (space, repo) pair and return an OAuth authorization URL for the delegator to open. The delegation starts with an empty caller allowlist.

- Kind: procedure
- Authority: writeproxy.whey.party
- Lexicon: 1
- Published by [whey.party](https://lexicon.garden/identity/did:plc:mn45tewwnse5btfftvd3powc), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.writeproxy.createDelegation)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.writeproxy.createDelegation/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.writeproxy.createDelegation/analytics)

## Procedure (`party.whey.writeproxy.createDelegation`)

Type: procedure · POST

### Input (application/json)

- `actions` (array, required)
  - Constraints: minLength: 1, maxLength: 3
  - `items` (string)
    - Constraints: enum: create | update | delete
- `blob` (ref)
  - Reference: `party.whey.writeproxy.defs#blobPolicy`
- `collections` (array, required)
  - Constraints: minLength: 1, maxLength: 100
  - `items` (string · nsid)
- `contact` (string)
  - Constraints: maxLength: 320
- `label` (string)
  - Constraints: maxLength: 128
- `returnTo` (string · uri): Absolute http(s) URL the proxy redirects to after the OAuth callback, with the outcome appended as query parameters.
  - Constraints: maxLength: 2048
- `space` (string · space-ref, required)

### Output (application/json)

- `authorizationUrl` (string · uri, required)
- `clientMetadataUrl` (string · uri, required)
- `delegation` (ref, required)
  - Reference: `party.whey.writeproxy.defs#delegation`
- `expiresAt` (string · datetime, required)

### Errors

- `InvalidRequest`: No description in schema.
- `InvalidSpace`: No description in schema.
- `InvalidRepo`: No description in schema.
- `InvalidCollections`: No description in schema.
- `InvalidActions`: No description in schema.
- `InvalidBlobPolicy`: No description in schema.
- `RegistrationRequired`: No description in schema.
- `DelegationExists`: No description in schema.
- `RateLimited`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "errors": [
        {
          "name": "InvalidRequest"
        },
        {
          "name": "InvalidSpace"
        },
        {
          "name": "InvalidRepo"
        },
        {
          "name": "InvalidCollections"
        },
        {
          "name": "InvalidActions"
        },
        {
          "name": "InvalidBlobPolicy"
        },
        {
          "name": "RegistrationRequired"
        },
        {
          "name": "DelegationExists"
        },
        {
          "name": "RateLimited"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "actions": {
              "items": {
                "enum": [
                  "create",
                  "update",
                  "delete"
                ],
                "type": "string"
              },
              "maxLength": 3,
              "minLength": 1,
              "type": "array"
            },
            "blob": {
              "ref": "party.whey.writeproxy.defs#blobPolicy",
              "type": "ref"
            },
            "collections": {
              "items": {
                "format": "nsid",
                "type": "string"
              },
              "maxLength": 100,
              "minLength": 1,
              "type": "array"
            },
            "contact": {
              "maxLength": 320,
              "type": "string"
            },
            "label": {
              "maxLength": 128,
              "type": "string"
            },
            "returnTo": {
              "description": "Absolute http(s) URL the proxy redirects to after the OAuth callback, with the outcome appended as query parameters.",
              "format": "uri",
              "maxLength": 2048,
              "type": "string"
            },
            "space": {
              "format": "space-ref",
              "type": "string"
            }
          },
          "required": [
            "space",
            "collections",
            "actions"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "authorizationUrl": {
              "format": "uri",
              "type": "string"
            },
            "clientMetadataUrl": {
              "format": "uri",
              "type": "string"
            },
            "delegation": {
              "ref": "party.whey.writeproxy.defs#delegation",
              "type": "ref"
            },
            "expiresAt": {
              "format": "datetime",
              "type": "string"
            }
          },
          "required": [
            "delegation",
            "authorizationUrl",
            "clientMetadataUrl",
            "expiresAt"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Create a pending write delegation for one (space, repo) pair and return an OAuth authorization URL for the delegator to open. The delegation starts with an empty caller allowlist.",
  "id": "party.whey.writeproxy.createDelegation",
  "lexicon": 1
}
```
