{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Set the caller's contact email in their preferences space, and send a link to it that proves it. Until the link is opened, the address they had stays in use. Setting the proven address they already have drops a change that is waiting. Customers and staff; anyone else is refused.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is neither a customer nor staff, or the provisioner refused them.",
          "name": "Forbidden"
        },
        {
          "description": "The input is malformed, or the provisioner refused it as malformed.",
          "name": "InvalidRequest"
        },
        {
          "description": "The address is not an email address.",
          "name": "InvalidEmail"
        },
        {
          "description": "Five links have been sent to this account in the last 24 hours.",
          "name": "TooManyLinks"
        },
        {
          "description": "The email could not be sent; nothing was recorded, so it is safe to try again.",
          "name": "EmailFailed"
        },
        {
          "description": "Owner email is not switched on yet.",
          "name": "EmailNotConfigured"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every contact-email refusal is mapped the same way.",
          "name": "InvalidLink"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every contact-email refusal is mapped the same way.",
          "name": "ExpiredLink"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner. Not expected here; declared because every provisioner refusal is mapped the same way.",
          "name": "OperationInProgress"
        },
        {
          "description": "The preferences space or the provisioner could not be reached, or answered with an error it does not explain to callers.",
          "name": "Upstream"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "email": {
              "description": "The new contact email.",
              "maxLength": 254,
              "type": "string"
            },
            "idempotencyKey": {
              "description": "A UUID the client generates once per action and resends on every retry of it.",
              "type": "string"
            }
          },
          "required": [
            "email",
            "idempotencyKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "expiresAt": {
              "description": "When the link stops working; present when sent.",
              "format": "datetime",
              "type": "string"
            },
            "sent": {
              "description": "Whether a link was sent. False when the address is already theirs and proven.",
              "type": "boolean"
            },
            "verified": {
              "description": "Whether the address is already proven, so nothing waits.",
              "type": "boolean"
            }
          },
          "required": [
            "sent",
            "verified"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.actor.setContactEmail",
  "lexicon": 1
}
