2017-01-21 22:53:02 +01:00
API overview
============
## Contents
2017-01-21 22:49:08 +01:00
- [Available libraries ](#available-libraries )
- [Notes ](#notes )
- [Methods ](#methods )
2017-04-03 06:03:49 +02:00
- [Accounts ](#accounts )
- [Apps ](#apps )
- [Blocks ](#blocks )
2017-05-26 17:29:47 +02:00
- [Domain blocks ](#domain-blocks )
2017-04-03 06:03:49 +02:00
- [Favourites ](#favourites )
- [Follow Requests ](#follow-requests )
- [Follows ](#follows )
- [Instances ](#instances )
- [Media ](#media )
- [Mutes ](#mutes )
- [Notifications ](#notifications )
- [Reports ](#reports )
- [Search ](#search )
- [Statuses ](#statuses )
- [Timelines ](#timelines )
2017-12-13 15:12:12 +01:00
- [Lists ](#lists )
2017-01-21 22:49:08 +01:00
- [Entities ](#entities )
2017-04-03 06:03:49 +02:00
- [Account ](#account )
- [Application ](#application )
- [Attachment ](#attachment )
- [Card ](#card )
- [Context ](#context )
2017-10-20 16:26:58 +02:00
- [Emoji ](#emoji )
2017-04-03 06:03:49 +02:00
- [Error ](#error )
- [Instance ](#instance )
- [Mention ](#mention )
- [Notification ](#notification )
2017-04-11 17:48:27 +02:00
- [Relationship ](#relationship )
2017-04-03 06:03:49 +02:00
- [Results ](#results )
- [Status ](#status )
- [Tag ](#tag )
2017-12-13 15:12:12 +01:00
- [List ](#list )
2017-04-03 06:03:49 +02:00
___
2017-01-21 22:49:08 +01:00
2017-01-21 22:53:02 +01:00
## Available libraries
2017-01-21 22:49:08 +01:00
2017-05-11 08:35:12 +02:00
There are several libraries to interact with the Mastodon API. The list of libraries can be found on the [Libraries page ](Libraries.md ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
___
2017-01-21 22:53:02 +01:00
## Notes
2017-01-21 22:49:08 +01:00
2017-07-29 22:01:21 +02:00
###### Parameter types
2017-04-03 06:03:49 +02:00
When an array parameter is mentioned, the Rails convention of specifying array parameters in query strings is meant.
2017-05-09 14:14:33 +02:00
For example, a ruby array like `foo = [1, 2, 3]` should be encoded in the params as `foo[]=1&foo[]=2&foo[]=3` , with empty square brackets.
2017-01-21 22:49:08 +01:00
2017-12-22 14:34:12 +01:00
When sending binary data, such as files, Mastodon expects clients to use the `multipart/form-data` MIME type. This applies to media attachments, account avatars and account headers.
2017-01-21 22:49:08 +01:00
2017-07-29 22:01:21 +02:00
###### Selecting ranges
2017-04-03 06:03:49 +02:00
For most `GET` operations that return arrays, the query parameters `max_id` and `since_id` can be used to specify the range of IDs to return.
API methods that return collections of items can return a `Link` header containing URLs for the `next` and `prev` pages.
See the [Link header RFC ](https://tools.ietf.org/html/rfc5988 ) for more information.
2017-07-29 22:01:21 +02:00
###### Errors
2017-04-03 06:03:49 +02:00
If the request you make doesn't go through, Mastodon will usually respond with an [Error ](#error ).
___
2017-01-21 22:53:02 +01:00
## Methods
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
### Accounts
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching an account:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/:id
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns an [Account ](#account ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Getting the current user:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/verify_credentials
2017-01-21 22:49:08 +01:00
2017-12-13 15:43:16 +01:00
Returns the authenticated user's [Account ](#account ) with an extra attribute `source` which contains these keys:
| Attribute | Description |
| ----------- | -------------------------------------------------------- |
| `privacy` | Selected preference: Default privacy of new toots |
| `sensitive` | Selected preference: Mark media as sensitive by default? |
| `note` | Plain-text version of the account's `note` |
2017-01-21 22:49:08 +01:00
2017-04-11 17:48:27 +02:00
#### Updating the current user:
PATCH /api/v1/accounts/update_credentials
Form data:
2017-12-22 14:34:12 +01:00
| Field | Description | Optional |
| -------------- | ----------------------------------------------------------------- | ---------- |
| `display_name` | The name to display in the user's profile | yes |
| `note` | A new biography for the user | yes |
| `avatar` | An avatar for the user (encoded using `multipart/form-data` ) | yes |
| `header` | A header image for the user (encoded using `multipart/form-data` ) | yes |
2017-04-11 17:48:27 +02:00
2017-11-10 16:55:47 +01:00
Returns the authenticated user's [Account ](#account ).
2017-04-03 06:03:49 +02:00
#### Getting an account's followers:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/:id/followers
2017-01-21 22:49:08 +01:00
2017-04-19 18:42:12 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ---------- | -------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of followers with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of followers with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of followers to get (Default 40, Max 80) | yes |
2017-04-19 18:42:12 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 18:42:12 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Accounts ](#account ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Getting who account is following:
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/:id/following
2017-04-03 06:03:49 +02:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ---------- | -------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of followings with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of followings with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of followings to get (Default 40, Max 80) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Accounts ](#account ).
#### Getting an account's statuses:
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/:id/statuses
2017-01-21 22:49:08 +01:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ----------------------------------------------------------- | ---------- |
| `only_media` | Only return statuses that have media attachments | yes |
2017-11-08 15:21:02 +01:00
| `pinned` | Only return statuses that have been pinned | yes |
2017-05-01 20:01:32 +02:00
| `exclude_replies` | Skip statuses that reply to other statuses | yes |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of statuses with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of statuses with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of statuses to get (Default 20, Max 40) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. However, it is possible to use the `id` of the returned objects to construct your own URLs.
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns an array of [Statuses ](#status ).
2017-03-05 17:27:17 +01:00
2017-04-03 06:03:49 +02:00
#### Following/unfollowing an account:
2017-03-05 17:27:17 +01:00
2017-04-14 11:31:01 +02:00
POST /api/v1/accounts/:id/follow
POST /api/v1/accounts/:id/unfollow
2017-01-21 22:49:08 +01:00
2017-04-15 12:13:29 +02:00
Returns the target account's [Relationship ](#relationship ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Blocking/unblocking an account:
2017-01-21 22:49:08 +01:00
2017-04-15 12:13:29 +02:00
POST /api/v1/accounts/:id/block
POST /api/v1/accounts/:id/unblock
2017-01-29 12:53:50 +01:00
2017-04-15 12:13:29 +02:00
Returns the target account's [Relationship ](#relationship ).
2017-01-29 12:53:50 +01:00
2017-04-03 06:03:49 +02:00
#### Muting/unmuting an account:
2017-01-29 12:53:50 +01:00
2017-04-15 12:13:29 +02:00
POST /api/v1/accounts/:id/mute
2017-12-17 15:08:21 +01:00
Form data:
| Field | Description | Optional |
| -------------- | ----------------------------------------- | ---------- |
| `notifications` | Determines whether the mute will mute notifications or not. Default(true) | yes |
Returns the target account's [Relationship ](#relationship ).
2017-04-15 12:13:29 +02:00
POST /api/v1/accounts/:id/unmute
2017-01-29 12:53:50 +01:00
2017-04-15 12:13:29 +02:00
Returns the target account's [Relationship ](#relationship ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Getting an account's relationships:
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/relationships
2017-04-03 06:03:49 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----- | ---------------------------- | ---------- |
| `id` | Account IDs (can be an array) | no |
2017-04-03 06:03:49 +02:00
2017-07-25 16:47:29 +02:00
Returns an array of [Relationships ](#relationship ) of the current user to a list of given accounts.
2017-04-03 06:03:49 +02:00
#### Searching for accounts:
2017-04-03 06:13:15 +02:00
GET /api/v1/accounts/search
2017-04-03 06:03:49 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------- | ---------- |
| `q` | What to search for | no |
| `limit` | Maximum number of matching accounts to return (default: `40` ) | yes |
2017-04-03 06:03:49 +02:00
Returns an array of matching [Accounts ](#accounts ).
2017-05-01 19:13:17 +02:00
2017-04-03 06:03:49 +02:00
Will lookup an account remotely if the search term is in the `username@domain` format and not yet in the database.
### Apps
#### Registering an application:
2017-04-03 06:13:15 +02:00
POST /api/v1/apps
2017-01-21 22:49:08 +01:00
Form data:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `client_name` | Name of your application | no |
| `redirect_uris` | Where the user should be redirected after authorization (for no redirect, use `urn:ietf:wg:oauth:2.0:oob` ) | no |
| `scopes` | This can be a space-separated list of the following items: "read", "write" and "follow" (see [this page ](OAuth-details.md ) for details on what the scopes do) | no |
| `website` | URL to the homepage of your app | yes |
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Creates a new OAuth app.
2017-05-01 19:13:17 +02:00
2017-04-03 06:03:49 +02:00
Returns `id` , `client_id` and `client_secret` which can be used with [OAuth authentication in your 3rd party app ](Testing-with-cURL.md ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
These values should be requested in the app itself from the API for each new app install + mastodon domain combo, and stored in the app for future requests.
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
### Blocks
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching a user's blocks:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/blocks
2017-01-21 22:49:08 +01:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of blocks with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of blocks with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of blocks to get (Default 40, Max 80) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Accounts ](#account ) blocked by the authenticated user.
2017-01-21 22:49:08 +01:00
2017-05-26 17:29:47 +02:00
### Domain blocks
#### Fetching a user's blocked domains:
GET /api/v1/domain_blocks
Query parameters:
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of blocks with ID less than this value | yes |
2017-05-26 17:29:47 +02:00
| `since_id` | Get a list of blocks with ID greater than this value | yes |
| `limit` | Maximum number of blocks to get (Default 40, Max 80) | yes |
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-05-26 17:29:47 +02:00
Returns an array of strings.
#### Blocking a domain
POST /api/v1/domain_blocks
Parameters:
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
| `domain` | Domain to block | no |
Returns an empty object.
#### Unblocking a domain
DELETE /api/v1/domain_blocks
Parameters:
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
| `domain` | Domain to unblock | no |
Returns an empty object.
2017-04-03 06:03:49 +02:00
### Favourites
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching a user's favourites:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/favourites
2017-01-21 22:49:08 +01:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | -------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of favourites with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of favourites with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of favourites to get (Default 20, Max 40) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Statuses ](#status ) favourited by the authenticated user.
2017-03-05 17:27:17 +01:00
2017-04-03 06:03:49 +02:00
### Follow Requests
2017-03-05 17:27:17 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching a list of follow requests:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/follow_requests
2017-01-21 22:49:08 +01:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of follow requests with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of follow requests with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of requests to get (Default 40, Max 80) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Accounts ](#account ) which have requested to follow the authenticated user.
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Authorizing or rejecting follow requests:
2017-01-21 22:49:08 +01:00
2017-04-16 15:32:35 +02:00
POST /api/v1/follow_requests/:id/authorize
POST /api/v1/follow_requests/:id/reject
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns an empty object.
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
### Follows
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Following a remote user:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
POST /api/v1/follows
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Form data:
2017-01-21 22:49:08 +01:00
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
| `uri` | `username@domain` of the person you want to follow | no |
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns the local representation of the followed account, as an [Account ](#account ).
### Instances
#### Getting instance information:
2017-04-03 06:13:15 +02:00
GET /api/v1/instance
2017-04-03 06:03:49 +02:00
Returns the current [Instance ](#instance ).
2017-04-27 11:15:33 +02:00
2017-04-03 06:03:49 +02:00
Does not require authentication.
### Media
#### Uploading a media attachment:
2017-04-03 06:13:15 +02:00
POST /api/v1/media
2017-04-03 06:03:49 +02:00
Form data:
2017-12-22 14:34:12 +01:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------------- | ---------- |
| `file` | Media to be uploaded (encoded using `multipart/form-data` ) | no |
| `description` | A plain-text description of the media, for accessibility (max 420 chars) | yes |
2017-04-03 06:03:49 +02:00
Returns an [Attachment ](#attachment ) that can be used when creating a status.
### Mutes
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching a user's mutes:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/mutes
2017-03-05 17:27:17 +01:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of mutes with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of mutes with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of mutes to get (Default 40, Max 80) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Accounts ](#account ) muted by the authenticated user.
2017-03-05 17:27:17 +01:00
2017-04-03 06:03:49 +02:00
### Notifications
2017-03-05 17:27:17 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching a user's notifications:
2017-03-05 17:27:17 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/notifications
2017-01-21 22:49:08 +01:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of notifications with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of notifications with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of notifications to get (Default 15, Max 30) | yes |
2017-11-07 15:26:26 +01:00
| `exclude_types` | Array of notifications to exclude (Allowed values: "follow", "favourite", "reblog", "mention") | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. However, it is possible to use the `id` of the returned objects to construct your own URLs.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns a list of [Notifications ](#notification ) for the authenticated user.
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Getting a single notification:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/notifications/:id
2017-04-03 06:03:49 +02:00
Returns the [Notification ](#notification ).
#### Clearing notifications:
2017-04-03 06:13:15 +02:00
POST /api/v1/notifications/clear
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Deletes all notifications from the Mastodon server for the authenticated user.
2017-01-21 22:49:08 +01:00
Returns an empty object.
2017-05-25 17:46:01 +02:00
#### Dismissing a single notification:
2017-07-30 12:53:07 +02:00
POST /api/v1/notifications/dismiss
Form data:
| Field | Description | Optional |
| ----- | ---------------------------- | ---------- |
| `id` | Notification ID | no |
2017-05-25 17:46:01 +02:00
Deletes a single notification from the Mastodon server for the authenticated user.
Returns an empty object.
2017-04-03 06:03:49 +02:00
### Reports
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Fetching a user's reports:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/reports
2017-01-21 22:49:08 +01:00
2017-05-26 17:29:47 +02:00
Returns a list of [Reports ](#report ) made by the authenticated user. (This method is not entirely implemented and contains no useful information at this point)
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Reporting a user:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
POST /api/v1/reports
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Form data:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
| `account_id` | The ID of the account to report | no |
| `status_ids` | The IDs of statuses to report (can be an array) | no |
2017-09-19 16:30:58 +02:00
| `comment` | A comment to associate with the report (up to 1000 characters) | no |
2017-04-03 06:03:49 +02:00
Returns the finished [Report ](#report ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
### Search
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Searching for content:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/search
2017-04-03 06:03:49 +02:00
Form data:
2017-01-21 22:49:08 +01:00
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
| `q` | The search query | no |
2017-05-20 10:04:56 +02:00
| `resolve` | Whether to resolve non-local accounts (default: don't resolve) | yes |
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns [Results ](#results ).
2017-05-01 19:13:17 +02:00
If `q` is a URL, Mastodon will attempt to fetch the provided account or status. Otherwise, it will do a local account and hashtag search.
2017-04-03 06:03:49 +02:00
### Statuses
#### Fetching a status:
2017-04-03 06:13:15 +02:00
GET /api/v1/statuses/:id
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns a [Status ](#status ).
2017-01-21 22:49:08 +01:00
2017-04-27 11:15:33 +02:00
Does not require authentication.
2017-04-03 06:03:49 +02:00
#### Getting status context:
2017-01-21 22:49:08 +01:00
2017-04-05 10:25:05 +02:00
GET /api/v1/statuses/:id/context
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns a [Context ](#context ).
2017-01-21 22:49:08 +01:00
2017-04-27 11:15:33 +02:00
Does not require authentication.
2017-04-03 06:17:07 +02:00
#### Getting a card associated with a status:
2017-04-03 06:03:49 +02:00
2017-04-03 06:13:15 +02:00
GET /api/v1/statuses/:id/card
2017-04-03 06:03:49 +02:00
Returns a [Card ](#card ).
2017-04-27 11:15:33 +02:00
Does not require authentication.
2017-04-03 06:03:49 +02:00
#### Getting who reblogged/favourited a status:
2017-04-03 06:13:15 +02:00
GET /api/v1/statuses/:id/reblogged_by
GET /api/v1/statuses/:id/favourited_by
2017-01-21 22:49:08 +01:00
2017-04-19 19:16:57 +02:00
Query parameters:
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------------ | ---------- |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of reblogged/favourited with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of reblogged/favourited with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of reblogged/favourited to get (Default 40, Max 80) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. It is **not** possible to use the `id` of the returned objects to construct your own URLs, because the results are sorted by an internal key.
2017-04-19 19:16:57 +02:00
2017-04-03 06:03:49 +02:00
Returns an array of [Accounts ](#account ).
2017-01-21 22:49:08 +01:00
2017-04-27 11:15:33 +02:00
Does not require authentication.
2017-11-29 16:09:56 +01:00
#### Fetching custom emoji for an instance:
GET /api/v1/custom_emojis
Returns a list of [Emoji ](#emoji )
Does not require authentication.
2017-04-03 06:03:49 +02:00
#### Posting a new status:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
POST /api/v1/statuses
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Form data:
2017-01-21 22:49:08 +01:00
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------------ | ---------- |
| `status` | The text of the status | no |
| `in_reply_to_id` | local ID of the status you want to reply to | yes |
2017-09-21 04:19:47 +02:00
| `media_ids` | [Array ](#parameter-types ) of media IDs to attach to the status (maximum 4) | yes |
2017-05-01 20:01:32 +02:00
| `sensitive` | Set this to mark the media of the status as NSFW | yes |
| `spoiler_text` | Text to be shown as a warning before the actual content | yes |
| `visibility` | Either "direct", "private", "unlisted" or "public" | yes |
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns the new [Status ](#status ).
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Deleting a status:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
DELETE /api/v1/statuses/:id
2017-02-27 13:06:25 +01:00
2017-04-03 06:03:49 +02:00
Returns an empty object.
2017-02-27 13:06:25 +01:00
2017-04-03 06:03:49 +02:00
#### Reblogging/unreblogging a status:
2017-02-27 13:06:25 +01:00
2017-04-11 17:48:27 +02:00
POST /api/v1/statuses/:id/reblog
POST /api/v1/statuses/:id/unreblog
2017-03-05 17:27:17 +01:00
2017-11-13 09:45:36 +01:00
Reblog: Returns the reblog [Status ](#status ).
Unreblog: Returns the target [Status ](#status ).
2017-03-05 17:27:17 +01:00
2017-04-03 06:03:49 +02:00
#### Favouriting/unfavouriting a status:
2017-03-05 17:27:17 +01:00
2017-04-11 17:48:27 +02:00
POST /api/v1/statuses/:id/favourite
POST /api/v1/statuses/:id/unfavourite
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Returns the target [Status ](#status ).
2017-01-21 22:49:08 +01:00
2017-11-08 15:21:26 +01:00
#### Pinning/unpinning a status:
POST /api/v1/statuses/:id/pin
POST /api/v1/statuses/:id/unpin
Returns the target [Status ](#status ).
2017-07-29 22:01:21 +02:00
#### Muting/unmuting a conversation of a status
POST /api/v1/statuses/:id/mute
POST /api/v1/statuses/:id/unmute
Only makes sense for statuses featured inside notifications directed at the user. Muting a status will prevent replies to it, favourites and replies of it from appearing in the user's notifications.
Returns the target [Status ](#status ).
2017-04-03 06:03:49 +02:00
### Timelines
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
#### Retrieving a timeline:
2017-01-21 22:49:08 +01:00
2017-04-03 06:13:15 +02:00
GET /api/v1/timelines/home
GET /api/v1/timelines/public
GET /api/v1/timelines/tag/:hashtag
2017-12-13 15:12:12 +01:00
GET /api/v1/timelines/list/:list_id
2017-01-21 22:49:08 +01:00
2017-04-03 06:03:49 +02:00
Query parameters:
2017-01-25 18:31:15 +01:00
2017-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ----------------------------------------------------------------------------------- | ---------- |
| `local` | Only return statuses originating from this instance (public and tag timelines only) | yes |
2017-06-04 23:24:28 +02:00
| `max_id` | Get a list of timelines with ID less than this value | yes |
2017-05-01 20:01:32 +02:00
| `since_id` | Get a list of timelines with ID greater than this value | yes |
2017-05-07 09:45:52 +02:00
| `limit` | Maximum number of statuses on the requested timeline to get (Default 20, Max 40) | yes |
2017-04-19 19:16:57 +02:00
2017-07-29 22:01:21 +02:00
> **Note:** `max_id` and `since_id` for next and previous pages are provided in the `Link` header. However, it is possible to use the `id` of the returned objects to construct your own URLs.
2017-04-03 06:03:49 +02:00
Returns an array of [Statuses ](#status ), most recent ones first.
2017-04-27 11:15:33 +02:00
2017-07-29 22:01:21 +02:00
Public and tag timelines do not require authentication.
2017-05-01 20:01:32 +02:00
2017-12-13 15:12:12 +01:00
### Lists
#### Retrieving lists
GET /api/v1/lists
2017-12-13 15:43:16 +01:00
Returns at most 50 [Lists ](#list ) without pagination.
2017-12-13 15:12:12 +01:00
#### Retrieving lists by membership
GET /api/v1/accounts/:id/lists
2017-12-13 20:34:31 +01:00
Returns at most 50 [Lists ](#list ) without pagination.
2017-12-13 15:12:12 +01:00
#### Retrieving accounts in a list
GET /api/v1/lists/:id/accounts
2017-12-13 15:43:16 +01:00
Returns [Accounts ](#account ) in the list. If you specify `limit=0` in the query, all accounts will be returned without pagination. Otherwise, standard account pagination rules apply.
2017-12-13 15:12:12 +01:00
#### Retrieving, creating, updating, deleting a list
GET /api/v1/lists/:id
POST /api/v1/lists
PUT /api/v1/lists/:id
DELETE /api/v1/lists/:id
Form data:
| Field | Description | Optional |
| ---------------- | --------------------- | --------- |
| `title` | The title of the list | no |
> **Note:** There is a limit of 50 lists.
#### Adding/removing accounts to/from a list
POST /api/v1/lists/:id/accounts
DELETE /api/v1/lists/:id/accounts
Form data:
| Field | Description | Optional |
| ---------------- | ----------------------------------------- | --------- |
| `account_ids` | [Array ](#parameter-types ) of account IDs | no |
> **Note:** Only accounts already followed by the authenticated user can be added to a list.
2017-01-21 22:49:08 +01:00
___
2017-01-21 22:53:02 +01:00
## Entities
2017-01-21 22:49:08 +01:00
2017-07-29 22:01:21 +02:00
> **Note:** Some attributes in the entity payload can have ``null`` value and are marked as _nullable_ on the tables below. Attributes that are not nullable are guaranteed to return a valid value.
2017-05-09 10:00:01 +02:00
2017-04-03 06:03:49 +02:00
### Account
2017-01-21 22:49:08 +01:00
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ---------------------------------------------------------------------------------- | -------- |
| `id` | The ID of the account | no |
| `username` | The username of the account | no |
| `acct` | Equals `username` for local users, includes `@domain` for remote ones | no |
| `display_name` | The account's display name | no |
| `locked` | Boolean for when the account cannot be followed without waiting for approval first | no |
| `created_at` | The time the account was created | no |
| `followers_count` | The number of followers for the account | no |
| `following_count` | The number of accounts the given account is following | no |
| `statuses_count` | The number of statuses the account has made | no |
| `note` | Biography of user | no |
| `url` | URL of the user's profile page (can be remote) | no |
| `avatar` | URL to the avatar image | no |
| `avatar_static` | URL to the avatar static image (gif) | no |
| `header` | URL to the header image | no |
| `header_static` | URL to the header static image (gif) | no |
2017-12-22 07:14:45 +01:00
| `moved` | If the owner decided to switch accounts, new account is in this attribute | yes |
2017-04-03 06:03:49 +02:00
### Application
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ----------------------- | -------- |
| `name` | Name of the app | no |
| `website` | Homepage URL of the app | yes |
2017-04-03 06:03:49 +02:00
### Attachment
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | --------------------------------------------------------------------------------- | -------- |
| `id` | ID of the attachment | no |
2017-07-29 22:01:21 +02:00
| `type` | One of: "image", "video", "gifv", "unknown" | no |
2017-05-09 02:45:42 +02:00
| `url` | URL of the locally hosted version of the image | no |
| `remote_url` | For remote images, the remote URL of the original image | yes |
| `preview_url` | URL of the preview image | no |
2017-05-10 15:34:52 +02:00
| `text_url` | Shorter URL for the image, for insertion into text (only present on local images) | yes |
2017-07-29 22:01:21 +02:00
| `meta` | `small` and `original` containing: `width` , `height` , `size` , `aspect` | yes |
2017-12-22 07:14:45 +01:00
| `description` | A description of the image for the visually impaired (maximum 420 characters), or `null` if none provided | yes |
2017-07-29 22:01:21 +02:00
> **Note**: When the type is "unknown", it is likely only `remote_url` is available and local `url` is missing
2017-04-03 06:03:49 +02:00
### Card
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ------------------------------------------ | -------- |
| `url` | The url associated with the card | no |
| `title` | The title of the card | no |
| `description` | The card description | no |
| `image` | The image associated with the card, if any | yes |
2017-05-26 17:29:47 +02:00
| `type` | "link", "photo", "video", or "rich" | no |
| `author_name` | OEmbed data | yes |
| `author_url` | OEmbed data | yes |
| `provider_name` | OEmbed data | yes |
| `provider_url` | OEmbed data | yes |
| `html` | OEmbed data | yes |
| `width` | OEmbed data | yes |
| `height` | OEmbed data | yes |
2017-04-03 06:03:49 +02:00
### Context
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ----------------------------------------------------------------------------------- | -------- |
| `ancestors` | The ancestors of the status in the conversation, as a list of [Statuses ](#status ) | no |
| `descendants` | The descendants of the status in the conversation, as a list of [Statuses ](#status ) | no |
2017-04-03 06:03:49 +02:00
2017-10-20 16:26:58 +02:00
### Emoji
| Attribute | Description | Nullable |
|--------------------------|------------------------------------|----------|
| `shortcode` | The shortcode of the emoji | no |
| `static_url` | URL to the emoji static image | no |
| `url` | URL to the emoji image | no |
2017-04-03 06:03:49 +02:00
### Error
2017-12-13 15:43:16 +01:00
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:
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ---------------------------------- | -------- |
| `error` | A textual description of the error | no |
2017-04-03 06:03:49 +02:00
### Instance
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ------------------------------------------------------------------------ | -------- |
| `uri` | URI of the current instance | no |
| `title` | The instance's title | no |
| `description` | A description for the instance | no |
| `email` | An email address which can be used to contact the instance administrator | no |
2017-05-25 09:04:29 +02:00
| `version` | The Mastodon version used by instance. | no |
2017-07-29 22:01:21 +02:00
| `urls` | `streaming_api` | no |
2017-04-03 06:03:49 +02:00
### Mention
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | --------------------------------------------------------------------- | -------- |
| `url` | URL of user's profile (can be remote) | no |
| `username` | The username of the account | no |
| `acct` | Equals `username` for local users, includes `@domain` for remote ones | no |
| `id` | Account ID | no |
2017-01-21 22:49:08 +01:00
2017-04-11 17:48:27 +02:00
### Notification
2017-04-03 06:03:49 +02:00
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | --------------------------------------------------------------------- | -------- |
| `id` | The notification ID | no |
| `type` | One of: "mention", "reblog", "favourite", "follow" | no |
| `created_at` | The time the notification was created | no |
| `account` | The [Account ](#account ) sending the notification to the user | no |
| `status` | The [Status ](#status ) associated with the notification, if applicable | yes |
2017-04-03 06:03:49 +02:00
2017-04-11 17:48:27 +02:00
### Relationship
2017-04-03 06:03:49 +02:00
2017-05-24 23:50:16 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ------------------------------------------------------------ | -------- |
| `id` | Target account id | no |
| `following` | Whether the user is currently following the account | no |
| `followed_by` | Whether the user is currently being followed by the account | no |
| `blocking` | Whether the user is currently blocking the account | no |
| `muting` | Whether the user is currently muting the account | no |
2017-12-17 15:08:30 +01:00
| `muting_notifications` | Whether the user is also muting notifications | no |
2017-05-24 23:50:16 +02:00
| `requested` | Whether the user has requested to follow the account | no |
2017-09-19 16:38:01 +02:00
| `domain_blocking` | Whether the user is currently blocking the accounts's domain | no |
2017-04-03 06:03:49 +02:00
### Report
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ------------------------------------------ | -------- |
| `id` | The ID of the report | no |
| `action_taken` | The action taken in response to the report | no |
2017-04-03 06:03:49 +02:00
### Results
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ---------------------------------------- | -------- |
2017-07-29 22:01:21 +02:00
| `accounts` | An array of matched [Accounts ](#account ) | no |
| `statuses` | An array of matched [Statuses ](#status ) | no |
| `hashtags` | An array of matched hashtags, as strings | no |
2017-04-03 06:03:49 +02:00
### Status
2017-01-21 22:49:08 +01:00
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | ----------------------------------------------------------------------------- | -------- |
| `id` | The ID of the status | no |
| `uri` | A Fediverse-unique resource ID | no |
| `url` | URL to the status page (can be remote) | no |
| `account` | The [Account ](#account ) which posted the status | no |
| `in_reply_to_id` | `null` or the ID of the status it replies to | yes |
| `in_reply_to_account_id` | `null` or the ID of the account it replies to | yes |
| `reblog` | `null` or the reblogged [Status ](#status ) | yes |
| `content` | Body of the status; this will contain HTML (remote HTML already sanitized) | no |
| `created_at` | The time the status was created | no |
2017-10-20 16:26:58 +02:00
| `emojis` | An array of [Emoji ](#emoji ) | yes |
2017-05-09 02:45:42 +02:00
| `reblogs_count` | The number of reblogs for the status | no |
| `favourites_count` | The number of favourites for the status | no |
| `reblogged` | Whether the authenticated user has reblogged the status | yes |
| `favourited` | Whether the authenticated user has favourited the status | yes |
2017-07-29 22:01:21 +02:00
| `muted` | Whether the authenticated user has muted the conversation this status from | yes |
| `sensitive` | Whether media attachments should be hidden by default | no |
2017-05-09 02:45:42 +02:00
| `spoiler_text` | If not empty, warning text that should be displayed before the actual content | no |
| `visibility` | One of: `public` , `unlisted` , `private` , `direct` | no |
| `media_attachments` | An array of [Attachments ](#attachment ) | no |
| `mentions` | An array of [Mentions ](#mention ) | no |
| `tags` | An array of [Tags ](#tag ) | no |
| `application` | [Application ](#application ) from which the status was posted | yes |
2017-07-29 22:01:21 +02:00
| `language` | The detected language for the status, if detected | yes |
2017-12-22 07:14:45 +01:00
| `pinned` | Whether this is the pinned status for the account that posted it | yes |
2017-04-03 06:03:49 +02:00
2017-09-21 04:15:37 +02:00
> **NOTE**: When `spoiler_text` is present, `sensitive` is true
2017-04-11 17:48:27 +02:00
### Tag
2017-04-03 06:03:49 +02:00
2017-05-09 02:45:42 +02:00
| Attribute | Description | Nullable |
| ------------------------ | -------------------------------------------- | -------- |
| `name` | The hashtag, not including the preceding `#` | no |
| `url` | The URL of the hashtag | no |
2017-12-13 15:12:12 +01:00
### List
| Attribute | Description | Nullable |
|-----------|-------------------|----------|
| `id` | ID of the list | no |
| `title` | Title of the list | no |