# List abuses

`GET /api/v1/abuses`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": [
      "admin",
      "moderator"
    ]
  }
]
```

- 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
; scopes: admin, moderator

Parameters:

- `id` (query, integer, optional) - only list the report with this id
  Type: integer

- `predefinedReason` (query, Array<string>, optional) - predefined reason the listed reports should contain
  Type: Array<string>
  
  Reason categories that help triage reports
  
  Schema: [PredefinedAbuseReasons](https://sourcey-peertube.pages.dev/api-rest-reference/models/predefinedabusereasons.md)
  
  maxItems: 8
  
  Items:
    Type: string
    
    enum: ["violentOrAbusive","hatefulOrAbusive","spamOrMisleading","privacy","rights","serverRules","thumbnails","captions"]

- `search` (query, string, optional) - plain search that will match with video titles, reporter names and more
  Type: string

- `state` (query, AbuseStateSet, optional)
  Type: AbuseStateSet
  
  The abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`)
  
  Schema: [AbuseStateSet](https://sourcey-peertube.pages.dev/api-rest-reference/models/abusestateset.md)
  
  enum: [1,2,3]

- `searchReporter` (query, string, optional) - only list reports of a specific reporter
  Type: string

- `searchReportee` (query, string, optional) - only list reports of a specific reportee
  Type: string

- `searchVideo` (query, string, optional) - only list reports of a specific video
  Type: string

- `searchVideoChannel` (query, string, optional) - only list reports of a specific video channel
  Type: string

- `videoIs` (query, string, optional) - only list deleted or blocklisted videos
  Type: string
  
  enum: ["deleted","blacklisted"]

- `filter` (query, string, optional) - only list account, comment or video reports
  Type: string
  
  enum: ["video","comment","account"]

- `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 abuses by criteria
  Type: string
  
  enum: ["-id","-createdAt","-state"]

Responses:

- 200: successful operation

Content type: application/json

Type: object

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

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

## Examples

### cURL

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

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/abuses?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/abuses?count=15',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```
