# Automatic Tags

Automatic tags set on objects (like comments or videos) by specific rules (external link, watched words, etc.)

## Get account auto tag policies on comments

`GET /api/v1/automatic-tags/policies/accounts/{accountName}/comments`

**PeerTube >= 6.2**

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:

- `accountName` (path, string, required) - account name to get auto tag policies
  Type: string

Responses:

- 200: successful operation

Content type: application/json

Type: CommentAutoTagPolicies

Schema: [CommentAutoTagPolicies](https://docs.joinpeertube.org/api-rest-reference/api/models/commentautotagpolicies.md)

- `review` (optional)
  Type: Array<string>
  
  Auto tags that automatically set the comment in review state
  
  Items:
    Type: string

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/automatic-tags/policies/accounts/string/comments' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/automatic-tags/policies/accounts/string/comments', {
  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/automatic-tags/policies/accounts/string/comments',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update account auto tag policies on comments

`PUT /api/v1/automatic-tags/policies/accounts/{accountName}/comments`

**PeerTube >= 6.2**

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:

- `accountName` (path, string, required) - account name to update auto tag policies
  Type: string

Request body: application/json

Type: object

- `review` (optional)
  Type: Array<string>
  
  Auto tags that automatically set the comment in review state
  
  Items:
    Type: string

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X PUT 'https://peertube2.cpy.re/api/v1/automatic-tags/policies/accounts/string/comments' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "review": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "review": [
    "string"
  ]
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/automatic-tags/policies/accounts/string/comments', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "review": [
    "string"
  ]
}'''

response = requests.put(
    'https://peertube2.cpy.re/api/v1/automatic-tags/policies/accounts/string/comments',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get account available auto tags

`GET /api/v1/automatic-tags/accounts/{accountName}/available`

**PeerTube >= 6.2**

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:

- `accountName` (path, string, required) - account name to get auto tag policies
  Type: string

Responses:

- 200: successful operation

Content type: application/json

Type: AutomaticTagAvailable

Schema: [AutomaticTagAvailable](https://docs.joinpeertube.org/api-rest-reference/api/models/automatictagavailable.md)

- `available` (optional)
  Type: Array<object>
  
  Available auto tags that can be used to filter objects or set a comment in review state
  
  Items:
    Type: object
    
    - `name` (optional)
      Type: string
      
      tag name
    
    - `type` (optional)
      Type: string
      
      enum: ["core","watched-words-list"]

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/automatic-tags/accounts/string/available' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

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


## Get server available auto tags

`GET /api/v1/automatic-tags/server/available`

**PeerTube >= 6.2**

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

Responses:

- 200: successful operation

Content type: application/json

Type: AutomaticTagAvailable

Schema: [AutomaticTagAvailable](https://docs.joinpeertube.org/api-rest-reference/api/models/automatictagavailable.md)

- `available` (optional)
  Type: Array<object>
  
  Available auto tags that can be used to filter objects or set a comment in review state
  
  Items:
    Type: object
    
    - `name` (optional)
      Type: string
      
      tag name
    
    - `type` (optional)
      Type: string
      
      enum: ["core","watched-words-list"]

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/automatic-tags/server/available' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

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


## Get server auto tag policies for videos

`GET /api/v1/automatic-tags/policies/server/videos`

**PeerTube >= 8.3**

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

Responses:

- 200: successful operation

Content type: application/json

Type: VideoAutoTagPolicies

Schema: [VideoAutoTagPolicies](https://docs.joinpeertube.org/api-rest-reference/api/models/videoautotagpolicies.md)

- `autoBlock` (optional)
  Type: Array<string>
  
  Auto tags that will automatically block videos matching these tags
  
  Items:
    Type: string

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/automatic-tags/policies/server/videos' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

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


## Update server auto tag policies for videos

`PUT /api/v1/automatic-tags/policies/server/videos`

**PeerTube >= 8.3**

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

Request body: application/json

Type: object

- `autoBlock` (optional)
  Type: Array<string>
  
  Auto tags that will automatically block videos matching these tags
  
  Items:
    Type: string

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X PUT 'https://peertube2.cpy.re/api/v1/automatic-tags/policies/server/videos' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "autoBlock": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "autoBlock": [
    "string"
  ]
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/automatic-tags/policies/server/videos', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "autoBlock": [
    "string"
  ]
}'''

response = requests.put(
    'https://peertube2.cpy.re/api/v1/automatic-tags/policies/server/videos',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
