# Video Slug Feature - API Changes --- ## Summary Videos now support slugs (handles). Slugs are auto-generated on video creation and can be updated on video edit. A new endpoint is available to check slug availability before submitting. --- ## New Endpoints ### GET /studio/v1/slugs/check/{slug} **Auth:** Creator authorization required Checks if a slug is available and returns a suggested alternative if taken. **Response (available):** ```json { "slug": "my-video-slug", "isAvailable": true, "suggestedSlug": null } ``` **Response (taken):** ```json { "slug": "my-video-slug", "isAvailable": false, "suggestedSlug": "my-video-slug-1" } ``` **Errors:** Returns `400` if slug format is invalid or exceeds 150 characters. ### GET /admin/v1/slugs/check/{slug} **Auth:** Admin authorization required — same behavior as studio endpoint. --- ## Updated Requests ### PUT /studio/v1/videos/{id} New optional field: **`handle`** (string, nullable) ```json { "videoId": "string", "eventId": "string?", "name": "string", "handle": "string?", // NEW "shortDescription": "string?", "description": "object?", "thumbnail": "string?", "visibility": 0, "scheduledAt": "datetime", "isPremium": false, "payToViewProductId": "string?" } ``` ### PUT /admin/v1/videos/{id} New optional field: **`handle`** (string, nullable) ```json { "videoId": "string", "channelId": "string", "eventId": "string?", "name": "string", "handle": "string?", // NEW "shortDescription": "string?", "description": "object?", "thumbnail": "string?", "visibility": 0, "scheduledAt": "datetime", "isPremium": false, "payToViewProductId": "string?" } ``` --- ## Updated Responses A new **`handle`** field (string, nullable) is now included in all video response DTOs: | DTO | Context | |-----|---------| | VideoDto | Video detail (studio/client) | | ListVideoDto | Video listing (client) | | SearchListVideoDto | Video search results (client) | | SearchStudioListVideoDto | Video search results (studio) | | AdminVideoDto | Video detail (admin) | | AdminListVideoDto | Video listing (admin) | | AdminListLiveVideoDto | Live video listing (admin) | | AdminLiveVideoDto | Live video detail (admin) | | StudioLiveVideoDto | Live video detail (studio) | | SearchStudioListLiveVideoDto | Live video search results (studio) | Example: ```json { "id": "encoded-id", "name": "My Video", "handle": "my-video" } ``` --- ## Slug Validation Rules - Max length: **150 characters** - Allowed characters: `a-z`, `0-9`, `-`, `_` - Format regex: `^[A-Za-z0-9]+(?:[-_][A-Za-z0-9]+)*$` - Must be unique across all entities (channels, content, videos) --- ## Slug Behavior - **On create:** auto-generated from video title — no action needed from the client. - **On update:** send the new value in the `handle` field. If `handle` is `null` or omitted, the current slug is kept.