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-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 )
- [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-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-04-03 06:03:49 +02:00
### Parameter types
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
When a file parameter is mentioned, a form-encoded upload is expected.
2017-04-03 06:03:49 +02:00
### Selecting ranges
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.
### Errors
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-04-03 06:03:49 +02:00
Returns the authenticated user's [Account ](#account ).
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-06-18 14:28:46 +02: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 | yes |
| `header` | A header image for the user | yes |
2017-04-11 17:48:27 +02:00
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
`max_id` and `since_id` are usually get from the `Link` header.
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
`max_id` and `since_id` are usually get from the `Link` header.
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 |
| `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
`max_id` and `since_id` are usually get from the `Link` header.
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
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
Returns an array of [Relationships ](#relationships ) of the current user to a list of given accounts.
#### 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
`max_id` and `since_id` are usually get from the `Link` header.
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 |
`max_id` and `since_id` are usually get from the `Link` header.
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
`max_id` and `since_id` are usually get from the `Link` header.
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
`max_id` and `since_id` are usually get from the `Link` header.
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-05-01 20:01:32 +02:00
| Field | Description | Optional |
| ----------------- | ------------------------------------------------------------------- | ---------- |
| `file` | Media to be uploaded | no |
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
`max_id` and `since_id` are usually get from the `Link` header.
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-04-19 19:16:57 +02:00
`max_id` and `since_id` are usually get from the `Link` header.
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:
POST /api/v1/notifications/dismiss/:id
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 |
| `comment` | A comment to associate with the report | 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
2017-04-27 11:15:33 +02:00
Does not require authentication.
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
`max_id` and `since_id` are usually get from the `Link` header.
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-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 |
| `media_ids` | Array of media IDs to attach to the status (maximum 4) | yes |
| `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-04-03 06:03:49 +02:00
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-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-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
`max_id` and `since_id` are usually get from the `Link` header.
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
'public' and 'tag' timelines do not require authentication.
2017-05-01 20:01:32 +02:00
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-05-09 10:00:01 +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-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-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 |
| `type` | One of: "image", "video", "gifv" | no |
| `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-05-26 17:29:47 +02:00
| `meta` | `width` , `height` , `size` (width x height), `aspect` | yes |
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
### Error
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-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 |
| `requested` | Whether the user has requested to follow the account | no |
2017-05-26 17:29:47 +02:00
| `domain_blocking` | Whether the user is currently blocking the user'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 |
| ------------------------ | ---------------------------------------- | -------- |
| `accounts` | An array of matched [Accounts ](#account ) | yes |
2017-06-14 17:15:28 +02:00
| `statuses` | An array of matched [Statuses ](#status ) | yes |
2017-05-09 02:45:42 +02:00
| `hashtags` | An array of matched hashtags, as strings | yes |
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 |
| `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 |
| `sensitive` | Whether media attachments should be hidden by default | yes |
| `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-05-25 10:31:17 +02:00
| `language` | The detected language for the status (default: en) | no |
2017-04-03 06:03:49 +02:00
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 |