# Create video

`POST /api/plugins/videos`

This API Endpoint allows uploading the video file along with related metadata.

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [CreateVideoDTO](https://sourcey-gauzy.pages.dev/api-reference/models/createvideodto/index.md)

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `title` (required)
  Type: string
  
  The title of the video
  
  minLength: 3
  
  maxLength: 255
  
  Example:
  
  ```json
  "My Project Demo Video 2024"
  ```

- `recordedAt` (optional)
  Type: timestamptz
  
  Date when the video was recorded

- `duration` (required)
  Type: number
  
  Duration of the video in seconds

- `size` (required)
  Type: number
  
  Size of the video file in bytes

- `fullUrl` (required)
  Type: string
  
  Full URL to access the video

- `description` (required)
  Type: string
  
  Video description

- `storageProvider` (optional)
  Type: string
  
  enum: ["LOCAL","S3","WASABI","CLOUDINARY","DIGITALOCEAN"]

- `resolution` (optional)
  Type: string
  
  Video resolution in format WIDTH:HEIGHT (e.g., 1920:1080, 3840:2160)

- `codec` (optional)
  Type: string
  
  Video codec used for encoding (e.g., libx264, libx265, vp9)

- `frameRate` (required)
  Type: number
  
  Video frame rate

- `timeSlotId` (optional)
  Type: string
  
  The UUID of the associated TimeSlot

- `file` (required)
  Type: unknown
  
  The uploaded video file object containing metadata and properties
  
  allOf:
    Reference: [FileDTO](https://sourcey-gauzy.pages.dev/api-reference/models/filedto/index.md); Type: object

Responses:

- 200: Video successfully.

Content type: application/json

Type: object

Schema: [Video](https://sourcey-gauzy.pages.dev/api-reference/models/video/index.md)

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `title` (required)
  Type: string
  
  Title of the video

- `file` (required)
  Type: string
  
  Video file path or identifier

- `recordedAt` (optional)
  Type: timestamptz
  
  Date when the video was recorded

- `duration` (required)
  Type: number
  
  Duration of the video in seconds

- `size` (required)
  Type: number
  
  Size of the video file in bytes

- `fullUrl` (required)
  Type: string
  
  Full URL to access the video

- `description` (required)
  Type: string
  
  Video description

- `storageProvider` (optional)
  Type: string
  
  enum: ["LOCAL","S3","WASABI","CLOUDINARY","DIGITALOCEAN"]

- `resolution` (optional)
  Type: string
  
  Video resolution in format WIDTH:HEIGHT (e.g., 1920:1080, 3840:2160)

- `codec` (optional)
  Type: string
  
  Video codec used for encoding (e.g., libx264, libx265, vp9)

- `frameRate` (required)
  Type: number
  
  Video frame rate

- `timeSlotId` (optional)
  Type: string
  
  The UUID of the associated TimeSlot

- 400: Invalid input provided. Check the response body for error details.

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/videos' \
  --form-string 'isActive=true' \
  --form-string 'isArchived=false' \
  --form-string 'archivedAt=2018-11-21T06:20:32.232Z' \
  --form-string 'tenantId=string' \
  --form-string 'organizationId=string' \
  --form-string 'title=My Project Demo Video 2024' \
  --form-string 'duration=0' \
  --form-string 'size=0' \
  --form-string 'fullUrl=string' \
  --form-string 'description=string' \
  --form-string 'storageProvider=LOCAL' \
  --form-string 'resolution=string' \
  --form-string 'codec=string' \
  --form-string 'frameRate=0' \
  --form-string 'timeSlotId=string' \
  --form-string 'file={"fieldname":"videoFile","key":"project-demo-2024.mp4","originalname":"project-demo-original.mp4","size":10485760,"encoding":"7bit","mimetype":"video/mp4","filename":"project-demo-2024.mp4","url":"https://example.com/project-demo-2024.mp4","path":"/uploads/project-demo-2024.mp4"}'
```

### JavaScript

```javascript
const form = new FormData();
form.append('isActive', 'true');
form.append('isArchived', 'false');
form.append('archivedAt', '2018-11-21T06:20:32.232Z');
form.append('tenantId', 'string');
form.append('organizationId', 'string');
form.append('title', 'My Project Demo Video 2024');
form.append('duration', '0');
form.append('size', '0');
form.append('fullUrl', 'string');
form.append('description', 'string');
form.append('storageProvider', 'LOCAL');
form.append('resolution', 'string');
form.append('codec', 'string');
form.append('frameRate', '0');
form.append('timeSlotId', 'string');
form.append('file', '{"fieldname":"videoFile","key":"project-demo-2024.mp4","originalname":"project-demo-original.mp4","size":10485760,"encoding":"7bit","mimetype":"video/mp4","filename":"project-demo-2024.mp4","url":"https://example.com/project-demo-2024.mp4","path":"/uploads/project-demo-2024.mp4"}');
const response = await fetch('http://localhost:3000/api/plugins/videos', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('isActive', (None, 'true')),
        ('isArchived', (None, 'false')),
        ('archivedAt', (None, '2018-11-21T06:20:32.232Z')),
        ('tenantId', (None, 'string')),
        ('organizationId', (None, 'string')),
        ('title', (None, 'My Project Demo Video 2024')),
        ('duration', (None, '0')),
        ('size', (None, '0')),
        ('fullUrl', (None, 'string')),
        ('description', (None, 'string')),
        ('storageProvider', (None, 'LOCAL')),
        ('resolution', (None, 'string')),
        ('codec', (None, 'string')),
        ('frameRate', (None, '0')),
        ('timeSlotId', (None, 'string')),
        ('file', (None, '{"fieldname":"videoFile","key":"project-demo-2024.mp4","originalname":"project-demo-original.mp4","size":10485760,"encoding":"7bit","mimetype":"video/mp4","filename":"project-demo-2024.mp4","url":"https://example.com/project-demo-2024.mp4","path":"/uploads/project-demo-2024.mp4"}')),
    ]
    response = requests.request('POST', 'http://localhost:3000/api/plugins/videos', headers={}, files=files)
    print(response.text)
```
