2020-07-01 02:11:40 +02:00
---
2022-11-20 07:34:38 +01:00
title: announcements API methods
2020-07-01 02:11:40 +02:00
description: For announcements set by administration.
menu:
docs:
weight: 90
2022-11-20 07:34:38 +01:00
name: announcements
parent: methods-instance
identifier: methods-announcements
aliases: [
"/methods/announcements",
"/api/methods/announcements",
"/methods/instance/announcements",
]
2020-07-01 02:11:40 +02:00
---
2022-11-20 07:34:38 +01:00
< style >
#TableOfContents ul ul ul {display: none}
< / style >
## View all announcements {#get}
```http
2022-12-14 22:55:30 +01:00
GET /api/v1/announcements HTTP/1.1
2022-11-20 07:34:38 +01:00
```
2020-07-01 02:11:40 +02:00
See all currently active announcements set by admins.
2022-11-20 07:34:38 +01:00
**Returns:** Array of [Announcement ]({{< relref "entities/announcement">}} )\
2020-07-01 02:11:40 +02:00
**OAuth:** User token\
**Version history:**\
3.1.0 - added
2022-11-20 07:34:38 +01:00
#### Request
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
##### Headers
Authorization
: {{< required > }} Provide this header with `Bearer <user token>` to gain authorized access to this API method.
##### Query parameters
with_dismissed
: Boolean. If true, response will include announcements dismissed by the user. Defaults to false.
#### Response
##### 200: OK
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
Currently active announcements
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
```json
2020-07-03 13:35:55 +02:00
[
{
"id": "8",
"content": "< p > Looks like there was an issue processing audio attachments without embedded art since yesterday due to an experimental new feature. That issue has now been fixed, so you may see older posts with audio from other servers pop up in your feeds now as they are being finally properly processed. Sorry!< / p > ",
"starts_at": null,
"ends_at": null,
"all_day": false,
"published_at": "2020-07-03T01:27:38.726Z",
"updated_at": "2020-07-03T01:27:38.752Z",
"read": true,
"mentions": [],
"statuses": [],
"tags": [],
"emojis": [],
"reactions": [
{
"name": "bongoCat",
"count": 9,
"me": false,
"url": "https://files.mastodon.social/custom_emojis/images/000/067/715/original/fdba57dff7576d53.png",
"static_url": "https://files.mastodon.social/custom_emojis/images/000/067/715/static/fdba57dff7576d53.png"
},
{
"name": "thonking",
"count": 1,
"me": false,
"url": "https://files.mastodon.social/custom_emojis/images/000/098/690/original/a8d36edc4a7032e8.png",
"static_url": "https://files.mastodon.social/custom_emojis/images/000/098/690/static/a8d36edc4a7032e8.png"
},
{
"name": "AAAAAA",
"count": 1,
"me": false,
"url": "https://files.mastodon.social/custom_emojis/images/000/071/387/original/AAAAAA.png",
"static_url": "https://files.mastodon.social/custom_emojis/images/000/071/387/static/AAAAAA.png"
},
{
"name": "🤔",
"count": 1,
"me": true
}
]
}
]
2020-07-01 02:11:40 +02:00
```
2022-11-20 07:34:38 +01:00
##### 401: Unauthorized
Invalid or missing Authorization header.
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
```json
{
"error": "The access token is invalid"
}
```
---
## Dismiss an announcement {#dismiss}
```http
2022-12-14 22:55:30 +01:00
POST /api/v1/announcements/:id/dismiss HTTP/1.1
2022-11-20 07:34:38 +01:00
```
2020-07-01 02:11:40 +02:00
Allows a user to mark the announcement as read.
**Returns:** Empty\
**OAuth:** User token + `write:accounts` \
**Version history:**\
3.1.0 - added
2022-11-20 07:34:38 +01:00
#### Request
##### Path parameters
:id
: {{< required > }} String. The ID of the Announcement in the database.
##### Headers
Authorization
: {{< required > }} Provide this header with `Bearer <user token>` to gain authorized access to this API method.
#### Response
##### 200: OK
```json
2020-07-03 13:35:55 +02:00
{}
2020-07-01 02:11:40 +02:00
```
2022-11-20 07:34:38 +01:00
##### 401: Unauthorized
Invalid or missing Authorization header.
```json
{
"error": "The access token is invalid"
}
```
##### 404: Not found
Announcement with given ID does not exist
```json
{
"error": "Record not found"
}
```
---
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
## Add a reaction to an announcement {#put-reactions}
```http
2022-12-14 22:55:30 +01:00
PUT /api/v1/announcements/:id/reactions/:name HTTP/1.1
2022-11-20 07:34:38 +01:00
```
2020-07-01 02:11:40 +02:00
React to an announcement with an emoji.
**Returns:** Empty\
**OAuth:** User token + `write:favourites` \
**Version history:**\
3.1.0 - added
2022-11-20 07:34:38 +01:00
#### Request
##### Path parameters
:id
: {{< required > }} String. The ID of the Announcement in the database.
:name
: {{< required > }} String. Unicode emoji, or the shortcode of a custom emoji.
##### Headers
Authorization
: {{< required > }} Provide this header with `Bearer <user token>` to gain authorized access to this API method.
#### Response
##### 200: OK
```json
2020-07-03 13:35:55 +02:00
{}
```
2022-11-20 07:34:38 +01:00
##### 401: Unauthorized
Invalid or missing Authorization header.
```json
{
"error": "The access token is invalid"
}
```
##### 404: Not found
Announcement with given ID does not exist
```json
{
"error": "Record not found"
}
```
##### 422: Unprocessable entity
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
```json
{
"error": "Validation failed: Name is not a recognized emoji"
}
2020-07-01 02:11:40 +02:00
```
2022-11-20 07:34:38 +01:00
---
## Remove a reaction from an announcement {#delete-reactions}
```http
2022-12-14 22:55:30 +01:00
DELETE /api/v1/announcements/:id/reactions/:name HTTP/1.1
2022-11-20 07:34:38 +01:00
```
2020-07-01 02:11:40 +02:00
Undo a react emoji to an announcement.
**Returns:** Empty\
**OAuth:** User token + `write:favourites` \
**Version history:**\
3.1.0 - added
2022-11-20 07:34:38 +01:00
#### Request
##### Path parameters
:id
: {{< required > }} String. The ID of the Announcement in the database.
:name
: {{< required > }} String. Unicode emoji, or the shortcode of a custom emoji.
##### Headers
Authorization
: {{< required > }} Provide this header with `Bearer <user token>` to gain authorized access to this API method.
#### Response
##### 200: OK
```json
2020-07-03 13:35:55 +02:00
{}
```
2022-11-20 07:34:38 +01:00
##### 401: Unauthorized
Invalid or missing Authorization header.
```json
{
"error": "The access token is invalid"
}
```
##### 404: Not found
2020-07-01 02:11:40 +02:00
2022-11-20 07:34:38 +01:00
Announcement with given ID does not exist
```json
{
"error": "Record not found"
}
2020-07-01 02:11:40 +02:00
```
2022-11-20 07:34:38 +01:00
##### 422: Unprocessable entity
```json
{
"error": "Validation failed: Name is not a recognized emoji"
}
```
---
## See also
{{< caption-link url = "https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/announcements_controller.rb" caption = "app/controllers/api/v1/announcements_controller.rb" > }}
{{< caption-link url = "https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/announcements/reactions_controller.rb" caption = "app/controllers/api/v1/announcements/reactions_controller.rb" > }}