# dev.knotless.addEmail

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

✓ This is the authoritative definition for this NSID.

## Description

Claims an email address as the account logged in to this appview's pages.

## Links

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

## Definitions

### `dev.knotless.addEmail#email`

**Type**: `object`

An address, as git authors commits with it.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `email` | `string` | Yes | The address. Case and spaces around it do not count. |

### `dev.knotless.addEmail#emailState`

**Type**: `object`

What claiming an address, or taking the claim back, did.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `changed` | `boolean` | Yes | Whether it changed anything: false for an address claimed already, or, taken back, never claimed. |
| `count` | `integer` | Yes | How many addresses the account claims now. |

### `dev.knotless.addEmail`

**Type**: `procedure`

Adds the address's hash to the dev.knotless.emails record of the account logged in to this appview's web pages, as `knotless email add` does, so commits authored with it show as the account's on repositories it owns or pushes to. Requires the session cookie the pages' login sets: the appview writes with the session it keeps for that account.

#### Input

**Encoding**: `application/json`

#### Output

**Encoding**: `application/json`

#### Errors

- **InvalidRequest**: No email address.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "email": {
      "description": "An address, as git authors commits with it.",
      "properties": {
        "email": {
          "description": "The address. Case and spaces around it do not count.",
          "maxLength": 320,
          "type": "string"
        }
      },
      "required": [
        "email"
      ],
      "type": "object"
    },
    "emailState": {
      "description": "What claiming an address, or taking the claim back, did.",
      "properties": {
        "changed": {
          "description": "Whether it changed anything: false for an address claimed already, or, taken back, never claimed.",
          "type": "boolean"
        },
        "count": {
          "description": "How many addresses the account claims now.",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "changed",
        "count"
      ],
      "type": "object"
    },
    "main": {
      "description": "Adds the address's hash to the dev.knotless.emails record of the account logged in to this appview's web pages, as `knotless email add` does, so commits authored with it show as the account's on repositories it owns or pushes to. Requires the session cookie the pages' login sets: the appview writes with the session it keeps for that account.",
      "errors": [
        {
          "description": "No email address.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "ref": "#email",
          "type": "ref"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "ref": "#emailState",
          "type": "ref"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Claims an email address as the account logged in to this appview's pages.",
  "id": "dev.knotless.addEmail",
  "lexicon": 1
}
```
