# dev.knotless.delegateWrites

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

Starts delegating the writes of the account logged in to this appview's pages to the appview's gateway, as `knotless delegate` does.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.delegateWrites)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.delegateWrites/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.delegateWrites/examples)

## Definitions

### `dev.knotless.delegateWrites`

**Type**: `procedure`

Asks this appview's gateway, with a service token the account's PDS mints for the session the appview keeps for it, to take its writes (dev.knotless.putDelegation). The gateway asks the account's authorization server for a grant of its own, of the knotless records and blobs alone, which the account approves at the page this answers with; dev.knotless.awaitDelegation then waits for that. Once approved, sharing a repository for writing names the gateway, through which collaborators push. Requires the session cookie the pages' login sets.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `state` | `string` | Yes | What names this delegation to dev.knotless.awaitDelegation. |
| `url` | `string` (uri) | Yes | The page at the account's authorization server where it approves the grant. |

#### Errors

- **InvalidRequest**: The gateway or the account's PDS refused to start it.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Asks this appview's gateway, with a service token the account's PDS mints for the session the appview keeps for it, to take its writes (dev.knotless.putDelegation). The gateway asks the account's authorization server for a grant of its own, of the knotless records and blobs alone, which the account approves at the page this answers with; dev.knotless.awaitDelegation then waits for that. Once approved, sharing a repository for writing names the gateway, through which collaborators push. Requires the session cookie the pages' login sets.",
      "errors": [
        {
          "description": "The gateway or the account's PDS refused to start it.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {},
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "state": {
              "description": "What names this delegation to dev.knotless.awaitDelegation.",
              "maxLength": 256,
              "type": "string"
            },
            "url": {
              "description": "The page at the account's authorization server where it approves the grant.",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "url",
            "state"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Starts delegating the writes of the account logged in to this appview's pages to the appview's gateway, as `knotless delegate` does.",
  "id": "dev.knotless.delegateWrites",
  "lexicon": 1
}
```
