entities.md 10.1 KB
Newer Older
Eugen Rochko's avatar
Eugen Rochko committed
1 2
---
title: Entities
3
description: Overview of entities returned from Mastodon's REST API
Eugen Rochko's avatar
Eugen Rochko committed
4 5 6
menu:
  docs:
    parent: api
Eugen Rochko's avatar
Eugen Rochko committed
7
    weight: 3
Eugen Rochko's avatar
Eugen Rochko committed
8
---
Eugen Rochko's avatar
Eugen Rochko committed
9 10

- All IDs are encoded as strings
11
- All datetimes are in ISO 8601 format
Eugen Rochko's avatar
Eugen Rochko committed
12
- All HTML strings are sanitized by the server
13
- All language codes are in ISO 6391 format
Eugen Rochko's avatar
Eugen Rochko committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

## Account

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `id` | String |{{< no >}}|0.1.0|
| `username` | String |{{< no >}}|0.1.0|
| `acct` | String |{{< no >}}|0.1.0|
| `display_name` | String |{{< no >}}|0.1.0|
| `locked` | Boolean |{{< no >}}|0.1.0|
| `created_at` | String (Datetime) |{{< no >}}|0.1.0|
| `followers_count` | Number |{{< no >}}|0.1.0|
| `following_count` | Number |{{< no >}}|0.1.0|
| `statuses_count` | Number |{{< no >}}|0.1.0|
| `note` | String |{{< no >}}|0.1.0|
| `url` | String (URL) |{{< no >}}|0.1.0|
| `avatar` | String (URL) |{{< no >}}|0.1.0|
| `avatar_static` | String (URL) |{{< no >}}|1.1.2|
| `header` | String (URL) |{{< no >}}|0.1.0|
| `header_static` | String (URL) |{{< no >}}|1.1.2|
| `emojis` | Array of [Emoji](#emoji) |{{< no >}}|2.4.0|
| `moved` | [Account](#account) |{{< yes >}}|2.1.0|
| `fields` | Array of [Hash](#field) |{{< yes >}}|2.4.0|
| `bot` | Boolean |{{< yes >}}|2.4.0|

### Field

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `name` | String |{{< no >}}|2.4.0|
Eugen Rochko's avatar
Eugen Rochko committed
44
| `value` | String (HTML) |{{< no >}}|2.4.0|
Eugen Rochko's avatar
Eugen Rochko committed
45 46
| `verified_at` | String (Datetime) |{{< yes >}}|2.6.0|

Eugen Rochko's avatar
Eugen Rochko committed
47 48 49 50 51 52 53 54 55 56
### Source

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `privacy` | String |{{< yes >}}|1.5.0|
| `sensitive` | Boolean |{{< yes >}}|1.5.0|
| `language` | String (ISO6391) |{{< yes >}}|2.4.2|
| `note` | String |{{< no >}}|1.5.0|
| `fields` | Array of Hash |{{< no >}}|2.4.0|

Eugen Rochko's avatar
Eugen Rochko committed
57 58 59 60
## Application

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
61 62
| `name` | String |{{< no >}}|0.9.9|
| `website` | String (URL) |{{< yes >}}|0.9.9|
Eugen Rochko's avatar
Eugen Rochko committed
63 64 65 66 67

## Attachment

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
68 69 70 71 72 73 74 75
| `id` |  String |{{< no >}}|0.6.0|
| `type` | [String (Enum)](#type) |{{< no >}}|0.6.0|
| `url` | String (URL) |{{< no >}}|0.6.0|
| `remote_url` | String (URL) |{{< yes >}}|0.6.0|
| `preview_url` | String (URL) |{{< no >}}|0.6.0|
| `text_url` | String (URL) |{{< yes >}}|0.6.0|
| `meta` | [Hash](#meta) |{{< yes >}}|1.5.0|
| `description` | String |{{< yes >}}|2.0.0|
Eugen Rochko's avatar
Eugen Rochko committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

### Type

- `unknown`
- `image`
- `gifv`
- `video`

### Meta

May contain subtrees `small` and `original`.

Images may contain `width`, `height`, `size`, `aspect`, while videos (including GIFV) may contain `width`, `height`, `frame_rate`, `duration` and `bitrate`.

There may be another top-level object, `focus` with the coordinates `x` and `y`. These coordinates can be used for smart thumbnail cropping, [see this for reference](https://github.com/jonom/jquery-focuspoint#1-calculate-your-images-focus-point).

## Card

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
96 97 98 99 100 101 102 103 104 105 106 107
| `url` | String (URL) |{{< no >}}|1.0.0|
| `title` | String |{{< no >}}|1.0.0|
| `description` | String |{{< no >}}|1.0.0|
| `image` | String (URL) |{{< yes >}}|1.0.0|
| `type` | [String (Enum)](#type-1) |{{< no >}}|1.3.0|
| `author_name` | String |{{< yes >}}|1.3.0|
| `author_url` | String (URL) |{{< yes >}}|1.3.0|
| `provider_name` | String |{{< yes >}}|1.3.0|
| `provider_url` | String (URL) |{{< yes >}}|1.3.0|
| `html` | String (HTML) |{{< yes >}}|1.3.0|
| `width` | Number |{{< yes >}}|1.3.0|
| `height` | Number |{{< yes >}}|1.3.0|
Eugen Rochko's avatar
Eugen Rochko committed
108 109 110 111 112 113 114 115 116 117 118 119

### Type

- `link`
- `photo`
- `video`
- `rich`

## Context

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
120 121
| `ancestors` | Array of [Status](#status) |{{< no >}}|0.6.0|
| `descendants` | Array of [Status](#status) |{{< no >}}|0.6.0|
Eugen Rochko's avatar
Eugen Rochko committed
122 123 124 125 126

## Emoji

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
127 128 129 130
| `shortcode` | String |{{< no >}}|2.0.0|
| `static_url` | String (URL) |{{< no >}}|2.0.0|
| `url` | String (URL) |{{< no >}}|2.0.0|
| `visible_in_picker` | Boolean |{{< no >}}|2.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
131 132 133 134 135 136 137

## Error

The most important part of an error response is the HTTP status code. Standard semantics are followed. The body of an error is a JSON object with this structure:

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
138
| `error` | String |{{< no >}}|0.6.0|
Eugen Rochko's avatar
Eugen Rochko committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171

## Filter

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `id` | String |{{< no >}}|2.4.3|
| `phrase` | String |{{< no >}}|2.4.3|
| `context` | Array of [String (Enum)](#context) |{{< no >}}|2.4.3|
| `expires_at` | String (Datetime) |{{< yes >}}|2.4.3|
| `irreversible` | Boolean |{{< no >}}|2.4.3|
| `whole_word` | Boolean |{{< no >}}|2.4.3|

### Context

- `home`
- `notifications`
- `public`
- `thread`

### Implementation notes

If `whole_word` is true , client app should do:

- Define 'word constituent character' for your app. In the official implementation, it's `[A-Za-z0-9_]` in JavaScript, and `[[:word:]]` in Ruby. In Ruby case it's the POSIX character class (Letter | Mark | Decimal_Number | Connector_Punctuation).
- If the phrase starts with a word character, and if the previous character before matched range is a word character, its matched range should be treated to not match.
- If the phrase ends with a word character, and if the next character after matched range is a word character, its matched range should be treated to not match.

Please check `app/javascript/mastodon/selectors/index.js` and `app/lib/feed_manager.rb` in the Mastodon source code for more details.

## Instance

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
172 173 174 175 176 177 178 179 180 181
| `uri` | String |{{< no >}}|1.1.0|
| `title` | String |{{< no >}}|1.1.0|
| `description` | String |{{< no >}}|1.1.0|
| `email` | String |{{< no >}}|1.1.0|
| `version` | String |{{< no >}}|1.3.0|#
| `thumbnail` | String (URL) |{{< yes >}}|1.6.1|
| `urls` | [Hash](#urls) |{{< no >}}|1.4.2|
| `stats` | [Hash](#stats) |{{< no >}}|1.6.0|
| `languages` | Array of String (ISO6391) |{{< no >}}|2.3.0|
| `contact_account` | [Account](#account) |{{< yes >}}|2.3.0|
Eugen Rochko's avatar
Eugen Rochko committed
182 183 184 185 186

### URLs

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
187 188 189 190 191 192 193 194 195
|`streaming_api`| String (URL) |{{< no >}}|1.4.2|

### Stats

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
|`user_count`| Number |{{< no >}}|1.6.0|
|`status_count`| Number |{{< no >}}|1.6.0|
|`domain_count`| Number |{{< no >}}|1.6.0|
Eugen Rochko's avatar
Eugen Rochko committed
196 197 198 199 200

## List

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
201 202
| `id` | String |{{< no >}}|2.1.0|
| `title` | String |{{< no >}}|2.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
203 204 205 206 207

## Mention

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
208 209 210 211
| `url` | String (URL) |{{< no >}}|0.6.0|
| `username` | String |{{< no >}}|0.6.0|
| `acct` | String |{{< no >}}|0.6.0|
| `id` | String |{{< no >}}|0.6.0|
Eugen Rochko's avatar
Eugen Rochko committed
212 213 214 215 216

## Notification

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
217 218 219 220 221
| `id` | String |{{< no >}}|0.9.9|
| `type` | [String (Enum)](#type-2) |{{< no >}}|0.9.9|
| `created_at` | String (Datetime) |{{< no >}}|0.9.9|
| `account` | [Account](#account) |{{< no >}}|0.9.9|
| `status` | [Status](#status) |{{< yes >}}|0.9.9|
Eugen Rochko's avatar
Eugen Rochko committed
222 223 224 225 226 227 228 229 230 231 232 233

### Type

- `follow`
- `mention`
- `reblog`
- `favourite`

## Push subscription

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
234 235 236 237
| `id` | String |{{< no >}}|2.4.0|
| `endpoint` | String (URL) |{{< no >}}|2.4.0|
| `server_key` | String |{{< no >}}|2.4.0|
| `alerts` | [Hash](#alerts) |{{< no >}}|2.4.0|
Eugen Rochko's avatar
Eugen Rochko committed
238 239 240 241 242 243 244 245 246

### Alerts

???

## Relationship

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
247 248 249 250 251 252 253 254 255
| `id` | String |{{< no >}}|0.6.0|
| `following` | Boolean |{{< no >}}|0.6.0|
| `followed_by` | Boolean |{{< no >}}|0.6.0|
| `blocking` | Boolean |{{< no >}}|0.6.0|
| `muting` | Boolean |{{< no >}}|1.1.0|
| `muting_notifications` | Boolean |{{< no >}}|2.1.0|
| `requested` | Boolean |{{< no >}}|0.9.9|
| `domain_blocking` | Boolean |{{< no >}}|1.4.0|
| `showing_reblogs` | Boolean |{{< no >}}|2.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
256 257 258 259 260 261
| `endorsed` | Boolean |{{< no >}}|2.5.0|

## Results

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
262 263
| `accounts` | Array of [Account](#account) |{{< no >}}|1.1.0|
| `statuses` | Array of [Status](#status)  |{{< no >}}|1.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
264
| `hashtags` | Array of [Tag](#tag) |{{< no >}}|1.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
265 266 267 268 269

## Status

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
| `id` | String |{{< no >}}|0.1.0|
| `uri` | String |{{< no >}}|0.1.0|
| `url` | String (URL) |{{< yes >}}|0.1.0|
| `account` | [Account](#account) |{{< no >}}|0.1.0|
| `in_reply_to_id` | String |{{< yes >}}|0.1.0|
| `in_reply_to_account_id` | String |{{< yes >}}|1.0.0|
| `reblog` | [Status](#status) |{{< yes >}}|0.1.0|
| `content` | String (HTML) |{{< no >}}|0.1.0|
| `created_at` | String (Datetime) |{{< no >}}|0.1.0|
| `emojis` | Array of [Emoji](#emoji) |{{< no >}}|2.0.0|
| `replies_count` | Number |{{< no >}}|2.5.0|
| `reblogs_count` | Number |{{< no >}}|0.1.0|
| `favourites_count` | Number |{{< no >}}|0.1.0|
| `reblogged` | Boolean |{{< yes >}}|0.1.0|
| `favourited` | Boolean |{{< yes >}}|0.1.0|
| `muted` | Boolean |{{< yes >}}|1.4.0|
| `sensitive` | Boolean |{{< no >}}|0.9.9|
| `spoiler_text` | String |{{< no >}}|1.0.0|
| `visibility` | [String (Enum)](#visibility) |{{< no >}}|0.9.9|
| `media_attachments` | Array of [Attachment](#attachment) |{{< no >}}|0.6.0|
| `mentions` | Array of [Mention](#mention) |{{< no >}}|0.6.0|
| `tags` | Array of [Tag](#tag) |{{< no >}}|0.9.0|
moko256's avatar
moko256 committed
292
| `card` | [Card](#card) |{{< yes >}}|2.6.0|
293 294 295
| `application` | [Application](#application) |{{< no >}}|0.9.9|
| `language` | String (ISO6391) |{{< yes >}}|1.4.0|
| `pinned` | Boolean |{{< yes >}}|1.6.0|
Eugen Rochko's avatar
Eugen Rochko committed
296 297 298 299 300 301 302 303 304 305 306 307

### Visibility

- `public`
- `unlisted`
- `private`
- `direct`

## Tag

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
308 309
| `name` | String |{{< no >}}|0.9.0|
| `url` | String (URL) |{{< no >}}|0.9.0|
Eugen Rochko's avatar
Eugen Rochko committed
310 311 312 313 314 315 316 317 318
| `history` | Array of [History](#history) |{{< yes >}}|2.4.1|

### History

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `day` | String (UNIX timestamp) |{{< no >}}|2.4.1|
| `uses` | Number |{{< no >}}|2.4.1|
| `accounts` | Number |{{< no >}}|2.4.1|