# at.happyproto.actor.syncAccount

> Record the email address on the caller's PDS account with HappyProto, read server-side from their PDS session. The dashboard calls it once after each sign-in. The PDS reports the address only when the sign-in granted it (transition:email or account:email); without one, the last recorded address is kept, and an unconfirmed address never replaces a confirmed one. The address itself is never returned. Customers and staff; anyone else gets recorded = false.

- Kind: procedure
- Authority: actor.happyproto.at
- Lexicon: 1
- Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.actor.syncAccount)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.actor.syncAccount/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.actor.syncAccount/analytics)

## Procedure (`at.happyproto.actor.syncAccount`)

Type: procedure · POST

### Input (application/json)

- `idempotencyKey` (string, required): A UUID the client generates once per sign-in and resends on every retry of it.

### Output (application/json)

- `emailConfirmed` (boolean): Whether the PDS reported the held address as confirmed, when it said.
- `emailRecorded` (boolean): Whether HappyProto now holds an address for the caller: this sign-in's, or the last one recorded.
- `recorded` (boolean, required): Whether the caller has a HappyProto account to record it against: false for anyone who is neither a customer nor staff.

### Errors

- `AuthRequired`: This endpoint requires an authenticated caller.
- `InvalidRequest`: idempotencyKey is missing or not a UUID, or the provisioner refused the request as malformed.
- `Forbidden`: Passed through from the provisioner.
- `NotFound`: Passed through from the provisioner.
- `InvalidSlug`: Passed through from the provisioner.
- `SlugTaken`: Passed through from the provisioner.
- `NotEntitled`: Passed through from the provisioner.
- `InstanceLimit`: Passed through from the provisioner.
- `NoCapacity`: Passed through from the provisioner.
- `OperationInProgress`: Passed through from the provisioner.
- `Upstream`: The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Record the email address on the caller's PDS account with HappyProto, read server-side from their PDS session. The dashboard calls it once after each sign-in. The PDS reports the address only when the sign-in granted it (transition:email or account:email); without one, the last recorded address is kept, and an unconfirmed address never replaces a confirmed one. The address itself is never returned. Customers and staff; anyone else gets recorded = false.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "idempotencyKey is missing or not a UUID, or the provisioner refused the request as malformed.",
          "name": "InvalidRequest"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "Forbidden"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "OperationInProgress"
        },
        {
          "description": "The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.",
          "name": "Upstream"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "idempotencyKey": {
              "description": "A UUID the client generates once per sign-in and resends on every retry of it.",
              "type": "string"
            }
          },
          "required": [
            "idempotencyKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "emailConfirmed": {
              "description": "Whether the PDS reported the held address as confirmed, when it said.",
              "type": "boolean"
            },
            "emailRecorded": {
              "description": "Whether HappyProto now holds an address for the caller: this sign-in's, or the last one recorded.",
              "type": "boolean"
            },
            "recorded": {
              "description": "Whether the caller has a HappyProto account to record it against: false for anyone who is neither a customer nor staff.",
              "type": "boolean"
            }
          },
          "required": [
            "recorded"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.actor.syncAccount",
  "lexicon": 1
}
```
