# Runner Jobs

Manage runner jobs and runner-side job execution.

## Request a new job

`POST /api/v1/runners/jobs/request`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

- `jobTypes` (optional)
  Type: Array<string>
  
  Filter jobs depending on their types
  
  Items:
    Type: string

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `availableJobs` (optional)
  Type: Array<object>
  
  Items:
    Type: object
    
    - `uuid` (optional)
      Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
      
      minLength: 36
      
      maxLength: 36
      
      pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      
      Example:
      
      ```json
      "9c9de5e8-0a1e-484a-b099-e80766180a6d"
      ```
    
    - `type` (optional)
      Reference: [RunnerJobType](https://docs.joinpeertube.org/api-rest-reference/api/models/runnerjobtype.md); Type: RunnerJobType
      
      enum: ["vod-web-video-transcoding","vod-hls-transcoding","vod-audio-merge-transcoding","live-rtmp-hls-transcoding"]
    
    - `payload` (optional)
      Reference: [RunnerJobPayload](https://docs.joinpeertube.org/api-rest-reference/api/models/runnerjobpayload.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/request' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobTypes": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobTypes": [
    "string"
  ]
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/request', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobTypes": [
    "string"
  ]
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/request',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Accept job

`POST /api/v1/runners/jobs/{jobUUID}/accept`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `job` (optional)
  Type: RunnerJob & object
  
  allOf:
    Reference: [RunnerJob](https://docs.joinpeertube.org/api-rest-reference/api/models/runnerjob.md); Type: RunnerJob
  
    Type: object
    
    - `jobToken` (optional)
      Type: string

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/accept' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/accept', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/accept',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Abort job

`POST /api/v1/runners/jobs/{jobUUID}/abort`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

- `reason` (required)
  Type: string
  
  Why the runner aborts this job

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/abort' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string",
  "reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string",
  "reason": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/abort', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string",
  "reason": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/abort',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update job

`POST /api/v1/runners/jobs/{jobUUID}/update`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

- `progress` (optional)
  Type: integer
  
  Update job progression percentage (optional)

- `payload` (optional)
  Type: object
  
  anyOf:
    Type: object
    
    Provide live transcoding chunks update
    
    - `type` (optional)
      Type: string
      
      enum: ["add-chunk","remove-chunk"]
    
    - `masterPlaylistFile` (optional)
      Type: string, binary
    
    - `resolutionPlaylistFile` (optional)
      Type: string, binary
    
    - `resolutionPlaylistFilename` (optional)
      Type: string
    
    - `videoChunkFile` (optional)
      Type: string, binary
    
    - `videoChunkFilename` (optional)
      Type: string

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/update' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string",
  "progress": 0,
  "payload": {
    "type": "add-chunk",
    "masterPlaylistFile": "<binary>",
    "resolutionPlaylistFile": "<binary>",
    "resolutionPlaylistFilename": "string",
    "videoChunkFile": "<binary>",
    "videoChunkFilename": "string"
  }
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string",
  "progress": 0,
  "payload": {
    "type": "add-chunk",
    "masterPlaylistFile": "<binary>",
    "resolutionPlaylistFile": "<binary>",
    "resolutionPlaylistFilename": "string",
    "videoChunkFile": "<binary>",
    "videoChunkFilename": "string"
  }
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/update', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string",
  "progress": 0,
  "payload": {
    "type": "add-chunk",
    "masterPlaylistFile": "<binary>",
    "resolutionPlaylistFile": "<binary>",
    "resolutionPlaylistFilename": "string",
    "videoChunkFile": "<binary>",
    "videoChunkFilename": "string"
  }
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/update',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Post job error

`POST /api/v1/runners/jobs/{jobUUID}/error`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

- `message` (required)
  Type: string
  
  Why the runner failed to process this job

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/error' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string",
  "message": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string",
  "message": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/error', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string",
  "message": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/error',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Post job success

`POST /api/v1/runners/jobs/{jobUUID}/success`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

- `payload` (required)
  Type: object
  
  anyOf:
    Type: object
    
    - `videoFile` (optional)
      Type: string, binary
  
    Type: object
    
    - `videoFile` (optional)
      Type: string, binary
    
    - `resolutionPlaylistFile` (optional)
      Type: string, binary
  
    Type: object
    
    - `videoFile` (optional)
      Type: string, binary
  
    Type: object

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/success' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string",
  "payload": {
    "videoFile": "<binary>"
  }
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string",
  "payload": {
    "videoFile": "<binary>"
  }
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/success', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string",
  "payload": {
    "videoFile": "<binary>"
  }
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/success',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download the max-quality audio file for a job video

`POST /api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/max-quality/audio`

API used by PeerTube runners.

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

- `videoIdOrUUID` (path, id | UUIDv4 | shortUUID, required) - Video id or UUID
  Type: id | UUIDv4 | shortUUID
  
  oneOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
    Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
    Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID
    
    translation of a uuid v4 with a bigger alphabet to have a shorter uuid
    
    Example:
    
    ```json
    "2y84q2MQUMWPbiEcxNXMgC"
    ```

Request body: application/json (required)

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

Responses:

- 200: successful operation

Content type: application/octet-stream

Type: string, binary

- 403: the job is not associated with this video

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/max-quality/audio' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/max-quality/audio', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/max-quality/audio',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download the max-quality video file for a job video

`POST /api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/max-quality`

API used by PeerTube runners.

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

- `videoIdOrUUID` (path, id | UUIDv4 | shortUUID, required) - Video id or UUID
  Type: id | UUIDv4 | shortUUID
  
  oneOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
    Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
    Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID
    
    translation of a uuid v4 with a bigger alphabet to have a shorter uuid
    
    Example:
    
    ```json
    "2y84q2MQUMWPbiEcxNXMgC"
    ```

Request body: application/json (required)

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

Responses:

- 200: successful operation

Content type: application/octet-stream

Type: string, binary

- 403: the job is not associated with this video

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/max-quality' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/max-quality', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/max-quality',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download the max-quality thumbnail for a job video

`POST /api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/thumbnails/max-quality`

API used by PeerTube runners.

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

- `videoIdOrUUID` (path, id | UUIDv4 | shortUUID, required) - Video id or UUID
  Type: id | UUIDv4 | shortUUID
  
  oneOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
    Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
    Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID
    
    translation of a uuid v4 with a bigger alphabet to have a shorter uuid
    
    Example:
    
    ```json
    "2y84q2MQUMWPbiEcxNXMgC"
    ```

Request body: application/json (required)

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

Responses:

- 200: successful operation

Content type: application/octet-stream

Type: string, binary

- 403: the job is not associated with this video

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/thumbnails/max-quality' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/thumbnails/max-quality', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/thumbnails/max-quality',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download the max-quality preview for a job video

`POST /api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/previews/max-quality`

API used by PeerTube runners.

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

- `videoIdOrUUID` (path, id | UUIDv4 | shortUUID, required) - Video id or UUID
  Type: id | UUIDv4 | shortUUID
  
  oneOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
    Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
    Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID
    
    translation of a uuid v4 with a bigger alphabet to have a shorter uuid
    
    Example:
    
    ```json
    "2y84q2MQUMWPbiEcxNXMgC"
    ```

Request body: application/json (required)

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

Responses:

- 200: successful operation

Content type: application/octet-stream

Type: string, binary

- 403: the job is not associated with this video

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/previews/max-quality' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/previews/max-quality', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/previews/max-quality',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download a video studio task file for a job video

`POST /api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/studio/task-files/{filename}`

API used by PeerTube runners.

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

- `videoIdOrUUID` (path, id | UUIDv4 | shortUUID, required) - Video id or UUID
  Type: id | UUIDv4 | shortUUID
  
  oneOf:
    Reference: [id](https://docs.joinpeertube.org/api-rest-reference/api/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
    Reference: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
    Reference: [shortUUID](https://docs.joinpeertube.org/api-rest-reference/api/models/shortuuid.md); Type: shortUUID
    
    translation of a uuid v4 with a bigger alphabet to have a shorter uuid
    
    Example:
    
    ```json
    "2y84q2MQUMWPbiEcxNXMgC"
    ```

- `filename` (path, string, required) - Name of the task file to download
  Type: string

Request body: application/json (required)

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

Responses:

- 200: successful operation

Content type: application/octet-stream

Type: string, binary

- 400: the file is not associated with this edition task

- 403: the job is not associated with this video

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/studio/task-files/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/studio/task-files/string', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/files/videos/42/studio/task-files/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Cancel a job

`POST /api/v1/runners/jobs/{jobUUID}/cancel`

Authentication (security requirement alternatives):

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

- 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

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/cancel' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/cancel', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/cancel',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Delete a job

`DELETE /api/v1/runners/jobs/{jobUUID}`

The endpoint will first cancel the job if needed, and then remove it from the database. Children jobs will also be removed

Authentication (security requirement alternatives):

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

- 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

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://docs.joinpeertube.org/api-rest-reference/api/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X DELETE 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List jobs

`GET /api/v1/runners/jobs`

Authentication (security requirement alternatives):

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

- 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

Parameters:

- `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 runner jobs by criteria
  Type: string
  
  enum: ["updatedAt","createdAt","priority","state","progress"]

- `search` (query, string, optional) - Plain text search, applied to various parts of the model depending on endpoint
  Type: string

- `stateOneOf` (query, Array<RunnerJobState>, optional)
  Type: Array<RunnerJobState>
  
  Items:
    Reference: [RunnerJobState](https://docs.joinpeertube.org/api-rest-reference/api/models/runnerjobstate.md); Type: RunnerJobState
    
    The runner job state:
      - `1` Pending
      - `2` Processing
      - `3` Completed
      - `4` Errored
      - `5` Waiting for a parent job
      - `6` Cancelled
      - `7` Parent had an error
      - `8` Parent has been cancelled
    
    
    enum: [1,2,3,4,5,6,7,8]

- `typeOneOf` (query, Array<RunnerJobType>, optional)
  Type: Array<RunnerJobType>
  
  Items:
    Reference: [RunnerJobType](https://docs.joinpeertube.org/api-rest-reference/api/models/runnerjobtype.md); Type: RunnerJobType
    
    enum: ["vod-web-video-transcoding","vod-hls-transcoding","vod-audio-merge-transcoding","live-rtmp-hls-transcoding"]

Responses:

- 200: successful operation

Content type: application/json

Type: object

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

- `data` (optional)
  Type: Array<RunnerJobAdmin>
  
  Items:
    Reference: [RunnerJobAdmin](https://docs.joinpeertube.org/api-rest-reference/api/models/runnerjobadmin.md); Type: RunnerJob & object

## Examples

### cURL

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

### JavaScript

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