# List my notifications

`GET /api/v1/users/me/notifications`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `typeOneOf` (query, Array<NotificationType>, optional) - only list notifications of these types
  Type: Array<NotificationType>
  
  Items:
    Reference: [NotificationType](https://sourcey-peertube.pages.dev/api-rest-reference/models/notificationtype.md); Type: NotificationType
    
    Notification type. One of the following values:
    
      - `1` NEW_VIDEO_FROM_SUBSCRIPTION
    
      - `2` NEW_COMMENT_ON_MY_VIDEO
    
      - `3` NEW_ABUSE_FOR_MODERATORS
    
      - `4` BLACKLIST_ON_MY_VIDEO
    
      - `5` UNBLACKLIST_ON_MY_VIDEO
    
      - `6` MY_VIDEO_PUBLISHED
    
      - `7` MY_VIDEO_IMPORT_SUCCESS
    
      - `8` MY_VIDEO_IMPORT_ERROR
    
      - `9` NEW_USER_REGISTRATION
    
      - `10` NEW_FOLLOW
    
      - `11` COMMENT_MENTION
    
      - `12` VIDEO_AUTO_BLACKLIST_FOR_MODERATORS
    
      - `13` NEW_INSTANCE_FOLLOWER
    
      - `14` AUTO_INSTANCE_FOLLOWING
    
      - `15` ABUSE_STATE_CHANGE
    
      - `16` ABUSE_NEW_MESSAGE
    
      - `17` NEW_PLUGIN_VERSION
    
      - `18` NEW_PEERTUBE_VERSION
    
      - `19` MY_VIDEO_STUDIO_EDITION_FINISHED
    
      - `20` NEW_USER_REGISTRATION_REQUEST
    
      - `21` NEW_LIVE_FROM_SUBSCRIPTION
    
      - `22` MY_VIDEO_TRANSCRIPTION_GENERATED
    
      - `23` INVITED_TO_COLLABORATE_TO_CHANNEL
    
      - `24` ACCEPTED_TO_COLLABORATE_TO_CHANNEL
    
      - `25` REFUSED_TO_COLLABORATE_TO_CHANNEL
    
      - `26` VIDEO_OWNERSHIP_CHANGED_REQUEST
    
      - `27` VIDEO_OWNERSHIP_CHANGED_ACCEPTED
    
      - `28` VIDEO_OWNERSHIP_CHANGED_REJECTED
    
      - `29` CHANNEL_OWNERSHIP_CHANGED_REQUEST
    
      - `30` CHANNEL_OWNERSHIP_CHANGED_ACCEPTED
    
      - `31` CHANNEL_OWNERSHIP_CHANGED_REJECTED
    
      - `32` AUTOMATIC_BLOCKLIST_UPDATE
    
      - `33` MY_VIDEO_STUDIO_EDITION_ERROR
    
      - `34` MY_VIDEO_DUPLICATION_ERROR
    
    
    enum: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]

- `unread` (query, boolean, optional) - only list unread notifications
  Type: boolean

- `start` (query, integer, optional) - Offset used to paginate results
  Type: integer
  
  minimum: 0

- `count` (query, integer, optional) - Number of items to return
  Type: integer
  
  default: 15
  
  minimum: 1
  
  maximum: 100

- `sort` (query, string, optional) - Sort column
  Type: string
  
  Example:
  
  ```json
  "-createdAt"
  ```

Responses:

- 200: successful operation

Content type: application/json

Type: NotificationListResponse

Schema: [NotificationListResponse](https://sourcey-peertube.pages.dev/api-rest-reference/models/notificationlistresponse.md)

- `total` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `data` (optional)
  Type: Array<Notification>
  
  maxItems: 100
  
  Items:
    Reference: [Notification](https://sourcey-peertube.pages.dev/api-rest-reference/models/notification.md); Type: Notification

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/users/me/notifications?count=15' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/users/me/notifications?count=15', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://peertube2.cpy.re/api/v1/users/me/notifications?count=15',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```
