# User

An account on an instance: its profile fields, address and username rules.

The `User` entity represents an account on a Versia instance. Users can subscribe to other users, and post and interact with content through extensions such as [Social](/extensions/social). Users are identified by their `id` property, which is unique within the instance. Only the instance a User is on may send or serve that User. A User holds only what every instance needs to show and address it. A bio and custom fields are in the [Profile extension](/extensions/profile), and images such as a header are in the [Decorations extension](/extensions/decorations).

## Definition

- Type: `"User"`

- Fetch: `GET /.versia/v0.7/entities/User/{id}`

- Collections:

  - `subscribers`: [Reference Collection](/structures/collection#reference-collection) of users subscribed to the user.
  - `subscriptions`: [Reference Collection](/structures/collection#reference-collection) of users that the user is subscribed to. It lists only Users: an extension whose types accept subscriptions can add a collection of its own for them.

**Fields**

- `avatar` (`Media`): The user's avatar. **MUST** be an image (`image/*`).

- `display_name` (`string`): Display name, as shown to other users. Can contain emojis and any Unicode character.

- `username` (`string`, required): The user's username. **MUST** be unique within the instance, and at least 1 character long. **MUST** be treated as changeable by the user.

  **MUST** contain only the following characters: `a-z`, `A-Z` (case-insensitive), `0-9`, `_` and `-`.

- `manually_approves_subscribers` (`boolean`, required): If `true`, the user approves new subscribers manually. If `false`, subscribers are automatically approved. This does not affect federation, and is meant to be used for clients to display correct UI: [every `Subscribe` is still answered](/entities/subscribe#accepting-the-subscription-request).

- `indexable` (`boolean`, required): User consent to be indexed by search engines. If `false`, the user's profile **SHOULD NOT** be indexed.

- `url` (`URI`): Address of the user's profile page on their instance, for people to open in a browser. Software that shows the user elsewhere can link to it.

Inherited from [Entity](/entities):

- [`id`](/entities#entity-id) (`string`, required)
- [`type`](/entities#entity-type) (`string`, required)
- [`created_at`](/entities#entity-created-at) (`RFC3339`, required)
- [`updated_at`](/entities#entity-updated-at) (`RFC3339`)
- [`extensions`](/entities#entity-extensions) (`Extensions`)

```jsonc title="Example User"
{
    "id": "033p0g85e2000",
    "type": "User",
    "created_at": "2024-04-09T01:38:51Z",
    "avatar": {
        "url": "https://cdn.example.com/avatars/april.png",
        "media_type": "image/png"
    },
    "display_name": "April The Pink (limited Sand Edition)",
    "extensions": {
        "pub.versia:custom_emojis": {
            "emojis": []
        },
        "pub.versia:profile": {
            "bio": "<p>🌸🌸🌸</p>",
            "fields": [
                {
                    "key": "Website",
                    "value": "<a href=\"https://april.example\">april.example</a>"
                }
            ]
        }
    },
    "username": "april",
    "manually_approves_subscribers": false,
    "indexable": false,
    "url": "https://versia.example/@april"
}
```

## Subscriptions

Users accept [subscriptions](/entities/subscribe). A user's subscribers receive the entities that [Delivery](/federation#delivery) sends to them, such as changes to the user.

## Addresses

Users may be represented by a shorthand address, in the following format:

```
@username@instance
```

For example:

```
@alice@versia.example
```

This is similar to an email address or an ActivityPub address. Usernames are case-insensitive.

With the [Domain Handles extension](/extensions/domain-handles), a user can also be shown by a domain they own, such as `@alice.example`.

### Username

Username **MUST** be the user's `username`.

Usernames can be changed by the user, so an address may stop working. Use a [Reference](/entities#reference) for long-term references.

### Instance

Instance **MUST** be the [Domain](/entities#domain) that the user is on.
