entities.md 12.2 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 11
- All IDs are encoded as string representations of integers.
    - IDs can be sorted first by size, and then lexically, to produce a chronological ordering of resources.
12
- All datetimes are in ISO 8601 format
Eugen Rochko's avatar
Eugen Rochko committed
13
- All HTML strings are sanitized by the server
14
- All language codes are in ISO 6391 format
Eugen Rochko's avatar
Eugen Rochko committed
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 44

## 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
45
| `value` | String (HTML) |{{< no >}}|2.4.0|
Eugen Rochko's avatar
Eugen Rochko committed
46 47
| `verified_at` | String (Datetime) |{{< yes >}}|2.6.0|

Eugen Rochko's avatar
Eugen Rochko committed
48 49 50 51 52 53 54 55 56 57
### 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|

58 59 60 61 62 63 64 65 66
### Token

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `access_token` | String |{{< no >}}|0.1.0|
| `token_type` | String |{{< no >}}|0.1.0|
| `scope` | String |{{< no >}}|0.1.0|
| `created_at` | Number |{{< no >}}|0.1.0|

Eugen Rochko's avatar
Eugen Rochko committed
67 68 69 70
## Application

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
71 72
| `name` | String |{{< no >}}|0.9.9|
| `website` | String (URL) |{{< yes >}}|0.9.9|
Eugen Rochko's avatar
Eugen Rochko committed
73 74 75 76 77

## Attachment

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
78 79 80 81 82 83 84 85
| `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
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

### 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|
|---------|-----------|:------:|:------:|
106 107 108 109 110 111 112 113 114 115 116 117
| `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
118 119 120 121 122 123 124 125 126 127 128 129

### Type

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

## Context

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
130 131
| `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
132 133 134 135 136

## Emoji

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
137 138 139 140
| `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
141 142 143 144 145 146 147

## 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|
|---------|-----------|:------:|:------:|
148
| `error` | String |{{< no >}}|0.6.0|
Eugen Rochko's avatar
Eugen Rochko committed
149 150 151 152 153 154 155

## Filter

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `id` | String |{{< no >}}|2.4.3|
| `phrase` | String |{{< no >}}|2.4.3|
tastytea's avatar
tastytea committed
156
| `context` | Array of [String (Enum)](#context-1) |{{< no >}}|2.4.3|
Eugen Rochko's avatar
Eugen Rochko committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
| `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|
|---------|-----------|:------:|:------:|
182 183 184 185 186 187 188 189
| `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|
Hakaba Hitoyo's avatar
Hakaba Hitoyo committed
190
| `languages` | Array of String (ISO 639, Part 1-5) |{{< no >}}|2.3.0|
191
| `contact_account` | [Account](#account) |{{< yes >}}|2.3.0|
Eugen Rochko's avatar
Eugen Rochko committed
192 193 194 195 196

### URLs

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
197 198 199 200 201 202 203 204 205
|`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
206 207 208 209 210

## List

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
211 212
| `id` | String |{{< no >}}|2.1.0|
| `title` | String |{{< no >}}|2.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
213 214 215 216 217

## Mention

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
218 219 220 221
| `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
222 223 224 225 226

## Notification

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
227 228 229 230 231
| `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
232 233 234 235 236 237 238 239

### Type

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

Eugen Rochko's avatar
Eugen Rochko committed
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
## Poll

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `id` | String |{{< no >}}|2.8.0|
| `expires_at` | String (Datetime) |{{< yes >}}|2.8.0|
| `expired` | Boolean |{{< no >}}|2.8.0|
| `multiple` | Boolean |{{< no >}}|2.8.0|
| `votes_count` | Number |{{< no >}}|2.8.0|
| `options` | Array of [Poll option](#poll-option) |{{< no >}}|2.8.0|
| `voted` | Boolean |{{< yes >}}|2.8.0|

### Poll option

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `title` | String |{{< no >}}|2.8.0|
| `votes_count` | Number |{{< yes >}}|2.8.0|

Eugen Rochko's avatar
Eugen Rochko committed
259 260 261 262
## Push subscription

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
263 264 265 266
| `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
267 268 269 270 271 272 273 274 275

### Alerts

???

## Relationship

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
276 277 278 279 280 281 282 283 284
| `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
285 286 287 288 289 290
| `endorsed` | Boolean |{{< no >}}|2.5.0|

## Results

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
291 292
| `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
293
| `hashtags` | Array of [Tag](#tag) |{{< no >}}|1.1.0|
Eugen Rochko's avatar
Eugen Rochko committed
294 295 296 297 298

## Status

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
| `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
321
| `card` | [Card](#card) |{{< yes >}}|2.6.0|
322
| `poll` | [Poll](#poll) |{{< yes >}}|2.8.0|
323 324 325
| `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
326 327 328 329 330 331 332 333

### Visibility

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

334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
## ScheduledStatus

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `id` | String |{{< no >}}|2.7.0|
| `scheduled_at` | String (Datetime) |{{< no >}}|2.7.0|
| `params` | Array of [Hash](#statusparams) |{{< no >}}|2.7.0|
| `media_attachments` | Array of [Attachment](#attachment) |{{< no >}}|2.7.0|

### StatusParams

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `text` | String |{{< no >}}|2.7.0|
| `in_reply_to_id` | String |{{< yes >}}|2.7.0|
| `media_ids` | Array of String |{{< yes >}}|2.7.0|
| `sensitive` | Boolean |{{< yes >}}|2.7.0|
| `spoiler_text` | String |{{< yes >}}|2.7.0|
| `visibility` | [String (Enum)](#visibility) |{{< no >}}|2.7.0|
| `scheduled_at` | String (Datetime) |{{< yes >}}|2.7.0|
| `application_id` | String |{{< no >}}|2.7.0|

Eugen Rochko's avatar
Eugen Rochko committed
356 357 358 359
## Tag

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
360 361
| `name` | String |{{< no >}}|0.9.0|
| `url` | String (URL) |{{< no >}}|0.9.0|
Eugen Rochko's avatar
Eugen Rochko committed
362 363 364 365 366 367 368 369 370
| `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|
Thomas's avatar
Thomas committed
371

372
## Conversation
Thomas's avatar
Thomas committed
373 374 375 376 377

|Attribute|Type|Nullable|Added in|
|---------|-----------|:------:|:------:|
| `id` | String  |{{< no >}}|2.6.0|
| `accounts` | Array of [Account](#account) |{{< no >}}|2.6.0|
Thomas's avatar
Thomas committed
378
| `last_status` | [Status](#status) |{{< yes >}}|2.6.0|
Thomas's avatar
Thomas committed
379
| `unread` | Boolean |{{< no >}}|2.6.0|