Skip to main content

Video Assignments API

Assign videos to projects manually or through automated rules. Manage assignment rules for automatic video-to-project mapping based on metadata conditions.

List Project Videos

List all videos assigned to a project. Requires project membership or system_admin.

Request

GET /api/projects/:projectId/videos

Auth: requireAuth, buildAbilities

Parameters

ParameterTypeDescription
projectIdUUIDProject identifier

Response

Status: 200 OK

[
{
"id": "ff0e8400-e29b-41d4-a716-446655440070",
"projectId": "990e8400-e29b-41d4-a716-446655440010",
"videoId": "110e8400-e29b-41d4-a716-446655440080",
"assignedUserId": null,
"source": "manual",
"ruleDefinition": null,
"assignedBy": "660e8400-e29b-41d4-a716-446655440001",
"assignedAt": "2026-02-23T10:00:00.000Z"
}
]

Response Fields

FieldTypeDescription
idUUIDAssignment record identifier
projectIdUUIDProject the video is assigned to
videoIdUUIDAssigned video identifier
assignedUserIdUUID or nullUser the video is assigned to for annotation (optional)
sourcestringmanual or rule
ruleDefinitionobject or nullRule metadata when source is rule
assignedBystring or nullUser who created the assignment
assignedAtdatetimeWhen the assignment was created

Status Codes

CodeDescription
200Assignments listed
403Not a project member or system admin
404Project not found

Assign Video to Project

Assign a single video to a project. Requires project_owner or project_manager role (or system_admin).

Request

POST /api/projects/:projectId/videos

Auth: requireAuth, buildAbilities

Content-Type: application/json

{
"videoId": "110e8400-e29b-41d4-a716-446655440080",
"assignedUserId": "880e8400-e29b-41d4-a716-446655440003"
}

Parameters

ParameterTypeDescription
projectIdUUIDProject identifier

Request Body

FieldTypeRequiredDescription
videoIdUUIDYesID of the video to assign
assignedUserIdUUIDNoUser to assign the video to for annotation

Response

Status: 201 Created

Returns the created assignment object.

Status Codes

CodeDescription
201Video assigned
403Insufficient role
404Project, video, or assigned user not found

Notes

The project-video pair has a unique constraint. Attempting to assign the same video twice returns an error.


Unassign Video from Project

Remove a video assignment from a project. Requires project_owner or project_manager role (or system_admin).

Request

DELETE /api/projects/:projectId/videos/:videoId

Auth: requireAuth, buildAbilities

Parameters

ParameterTypeDescription
projectIdUUIDProject identifier
videoIdUUIDVideo identifier

Response

Status: 200 OK

{
"success": true
}

Status Codes

CodeDescription
200Video unassigned
403Insufficient role
404Assignment not found

Bulk Assign Videos

Assign multiple videos to a project in a single operation. Requires system_admin. Videos already assigned to the project are skipped.

Request

POST /api/admin/video-assignments/bulk

Auth: requireAdmin

Content-Type: application/json

{
"videoIds": [
"110e8400-e29b-41d4-a716-446655440080",
"220e8400-e29b-41d4-a716-446655440081",
"330e8400-e29b-41d4-a716-446655440082"
],
"projectId": "990e8400-e29b-41d4-a716-446655440010",
"assignedUserId": "880e8400-e29b-41d4-a716-446655440003"
}

Request Body

FieldTypeRequiredDescription
videoIdsUUID[]YesArray of video IDs (minimum 1)
projectIdUUIDYesTarget project
assignedUserIdUUIDNoUser to assign videos to

Response

Status: 200 OK

{
"created": 2
}

Response Fields

FieldTypeDescription
creatednumberNumber of new assignments created (excludes already-assigned videos)

Status Codes

CodeDescription
200Bulk assignment completed
400One or more videos not found
401Not authenticated
403Not a system admin
404Project not found

List Assignment Rules

List all video assignment rules. Requires system_admin.

Request

GET /api/admin/video-assignments/rules

Auth: requireAdmin

Response

Status: 200 OK

[
{
"id": "440e8400-e29b-41d4-a716-446655440090",
"name": "YouTube videos to research project",
"description": "Auto-assign YouTube-sourced videos",
"conditions": [
{
"field": "sourcePlatform",
"operator": "equals",
"value": "youtube"
}
],
"targetType": "project",
"targetId": "990e8400-e29b-41d4-a716-446655440010",
"isActive": true,
"createdBy": "660e8400-e29b-41d4-a716-446655440001",
"createdAt": "2026-02-23T10:00:00.000Z",
"updatedAt": "2026-02-23T10:00:00.000Z"
}
]

Status Codes

CodeDescription
200Rules listed
401Not authenticated
403Not a system admin

Create Assignment Rule

Create a new video assignment rule. Requires system_admin.

Request

POST /api/admin/video-assignments/rules

Auth: requireAdmin

Content-Type: application/json

{
"name": "YouTube videos to research project",
"description": "Auto-assign YouTube-sourced videos",
"conditions": [
{
"field": "sourcePlatform",
"operator": "equals",
"value": "youtube"
}
],
"targetType": "project",
"targetId": "990e8400-e29b-41d4-a716-446655440010"
}

Request Body

FieldTypeRequiredDescription
namestringYesRule name (minimum 1 character)
descriptionstringNoRule description
conditionsarrayYesArray of condition objects (minimum 1)
targetTypestringYesOne of: user, project, group
targetIdUUIDYesID of the target entity

Condition Object

FieldTypeRequiredDescription
fieldstringYesMetadata field name to match against
operatorstringYesOne of: equals, contains, startsWith, endsWith, regex
valuestringYesValue to compare against

Response

Status: 201 Created

Returns the created rule object.

Status Codes

CodeDescription
201Rule created
400Invalid request body
401Not authenticated
403Not a system admin

Update Assignment Rule

Update an existing assignment rule. Requires system_admin.

Request

PUT /api/admin/video-assignments/rules/:ruleId

Auth: requireAdmin

Content-Type: application/json

{
"name": "Updated rule name",
"isActive": false
}

Parameters

ParameterTypeDescription
ruleIdUUIDRule identifier

Request Body

FieldTypeRequiredDescription
namestringNoNew rule name
descriptionstring or nullNoNew description (null to clear)
conditionsarrayNoNew conditions array
targetTypestringNoNew target type
targetIdUUIDNoNew target ID
isActivebooleanNoActive/inactive status

Response

Status: 200 OK

Returns the updated rule object.

Status Codes

CodeDescription
200Rule updated
400Invalid request body
401Not authenticated
403Not a system admin
404Rule not found

Delete Assignment Rule

Delete an assignment rule. Requires system_admin.

Request

DELETE /api/admin/video-assignments/rules/:ruleId

Auth: requireAdmin

Parameters

ParameterTypeDescription
ruleIdUUIDRule identifier

Response

Status: 200 OK

{
"success": true
}

Status Codes

CodeDescription
200Rule deleted
401Not authenticated
403Not a system admin
404Rule not found

Evaluate Rule (Dry Run)

Evaluate a single rule against all videos without creating any assignments. Returns the count and IDs of matching videos.

Request

POST /api/admin/video-assignments/rules/:ruleId/evaluate

Auth: requireAdmin

Parameters

ParameterTypeDescription
ruleIdUUIDRule identifier

Response

Status: 200 OK

{
"ruleId": "440e8400-e29b-41d4-a716-446655440090",
"matchingVideoCount": 15,
"matchingVideoIds": [
"110e8400-e29b-41d4-a716-446655440080",
"220e8400-e29b-41d4-a716-446655440081"
]
}

Status Codes

CodeDescription
200Evaluation completed
401Not authenticated
403Not a system admin
404Rule not found

Evaluate All Rules

Evaluate all active rules against all videos and create assignments for matches. Only rules with targetType: "project" create ProjectVideoAssignment records. Existing assignments are not duplicated.

Request

POST /api/admin/video-assignments/rules/evaluate-all

Auth: requireAdmin

Response

Status: 200 OK

{
"rulesEvaluated": 3,
"assignmentsCreated": 27
}

Response Fields

FieldTypeDescription
rulesEvaluatednumberNumber of active rules processed
assignmentsCreatednumberNumber of new assignments created

Status Codes

CodeDescription
200Evaluation completed
401Not authenticated
403Not a system admin