# fyi.opensocial.importAccount

> Published by [lexicons.opensocial.fyi](https://lexicon.garden/identity/did:plc:2gqnilpksz2e7faj3bwvo6qc)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:2gqnilpksz2e7faj3bwvo6qc/fyi.opensocial.importAccount)
- [Documentation](https://lexicon.garden/lexicon/did:plc:2gqnilpksz2e7faj3bwvo6qc/fyi.opensocial.importAccount/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:2gqnilpksz2e7faj3bwvo6qc/fyi.opensocial.importAccount/examples)

## Definitions

### `fyi.opensocial.importAccount`

**Type**: `procedure`

Start moving an account that already exists on the network, on any server, here to become a group: check the account's proof that it hands its DID to this host, make it here switched off with new keys, and copy its whole repo and its files from its server. Answers with the credentials the account's PLC operation should name; once its server has signed one, completeImport finishes the move. The caller becomes the group's admin. Only a did:plc account, and never the caller's own. Starting again for an account the caller started on discards what the first start copied.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `address` | `string` | No | The label of its address on this host; by default its handle's first label. |
| `serviceJwt` | `string` | Yes | A service token from the account's own server (com.atproto.server.getServiceAuth), with this host's DID as aud and com.atproto.server.createAccount as lxm. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `address` | `string` (handle) | Yes |  |
| `blobs` | `integer` | Yes | Files copied. |
| `did` | `string` (did) | Yes |  |
| `displayName` | `string` | Yes |  |
| `handle` | `string` (handle) | Yes | Its handle once moved: its own domain if it has one that still names it, otherwise its address. |
| `recommendedCreds` | `unknown` | Yes | rotationKeys, alsoKnownAs, verificationMethods and services, as com.atproto.identity.getRecommendedDidCredentials answers: what the account's server signs into its PLC operation (com.atproto.identity.signPlcOperation). |
| `records` | `integer` | Yes | Records copied. |

#### Errors

- **NotAllowed**
- **InvalidToken**
- **NotPlc**
- **SameAccount**
- **AlreadyHere**
- **InvalidHandle**
- **HandleNotAvailable**
- **InvalidRepo**
- **UpstreamFailure**

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Start moving an account that already exists on the network, on any server, here to become a group: check the account's proof that it hands its DID to this host, make it here switched off with new keys, and copy its whole repo and its files from its server. Answers with the credentials the account's PLC operation should name; once its server has signed one, completeImport finishes the move. The caller becomes the group's admin. Only a did:plc account, and never the caller's own. Starting again for an account the caller started on discards what the first start copied.",
      "errors": [
        {
          "name": "NotAllowed"
        },
        {
          "name": "InvalidToken"
        },
        {
          "name": "NotPlc"
        },
        {
          "name": "SameAccount"
        },
        {
          "name": "AlreadyHere"
        },
        {
          "name": "InvalidHandle"
        },
        {
          "name": "HandleNotAvailable"
        },
        {
          "name": "InvalidRepo"
        },
        {
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "address": {
              "description": "The label of its address on this host; by default its handle's first label.",
              "type": "string"
            },
            "serviceJwt": {
              "description": "A service token from the account's own server (com.atproto.server.getServiceAuth), with this host's DID as aud and com.atproto.server.createAccount as lxm.",
              "type": "string"
            }
          },
          "required": [
            "serviceJwt"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "address": {
              "format": "handle",
              "type": "string"
            },
            "blobs": {
              "description": "Files copied.",
              "type": "integer"
            },
            "did": {
              "format": "did",
              "type": "string"
            },
            "displayName": {
              "type": "string"
            },
            "handle": {
              "description": "Its handle once moved: its own domain if it has one that still names it, otherwise its address.",
              "format": "handle",
              "type": "string"
            },
            "recommendedCreds": {
              "description": "rotationKeys, alsoKnownAs, verificationMethods and services, as com.atproto.identity.getRecommendedDidCredentials answers: what the account's server signs into its PLC operation (com.atproto.identity.signPlcOperation).",
              "type": "unknown"
            },
            "records": {
              "description": "Records copied.",
              "type": "integer"
            }
          },
          "required": [
            "did",
            "handle",
            "address",
            "displayName",
            "records",
            "blobs",
            "recommendedCreds"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "fyi.opensocial.importAccount",
  "lexicon": 1
}
```
