From a1d9147abb7fbb1c30e87bcfba3d7db51360c826 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 8 Oct 2025 07:49:24 -0600 Subject: [PATCH] Update classification API docs --- docs/static/frigate-api.yaml | 1771 ++++++++++++----- frigate/api/classification.py | 148 +- .../api/defs/request/classification_body.py | 10 +- .../defs/response/classification_response.py | 38 + 4 files changed, 1406 insertions(+), 561 deletions(-) create mode 100644 frigate/api/defs/response/classification_response.py diff --git a/docs/static/frigate-api.yaml b/docs/static/frigate-api.yaml index ca53bdcf7..ab53f7604 100644 --- a/docs/static/frigate-api.yaml +++ b/docs/static/frigate-api.yaml @@ -17,7 +17,7 @@ paths: summary: Auth operationId: auth_auth_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -29,7 +29,7 @@ paths: summary: Profile operationId: profile_profile_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -41,7 +41,7 @@ paths: summary: Logout operationId: logout_logout_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -57,19 +57,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AppPostLoginBody" + $ref: '#/components/schemas/AppPostLoginBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /users: get: tags: @@ -77,7 +77,7 @@ paths: summary: Get Users operationId: get_users_users_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -92,19 +92,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AppPostUsersBody" + $ref: '#/components/schemas/AppPostUsersBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /users/{username}: delete: tags: @@ -119,17 +119,17 @@ paths: type: string title: Username responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /users/{username}/password: put: tags: @@ -148,19 +148,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AppPutPasswordBody" + $ref: '#/components/schemas/AppPutPasswordBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /users/{username}/role: put: tags: @@ -179,36 +179,47 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AppPutRoleBody" + $ref: '#/components/schemas/AppPutRoleBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /faces: get: tags: - - Events - summary: Get Faces + - classification + summary: Get all registered faces + description: |- + Returns a dictionary mapping face names to lists of image filenames. + Each key represents a registered face name, and the value is a list of image + files associated with that face. Supported image formats include .webp, .png, + .jpg, and .jpeg. operationId: get_faces_faces_get responses: - "200": + '200': description: Successful Response content: application/json: - schema: {} + schema: + $ref: '#/components/schemas/FacesResponse' /faces/reprocess: post: tags: - - Events - summary: Reclassify Face + - classification + summary: Reprocess a face training image + description: |- + Reprocesses a face training image to update the prediction. + Requires face recognition to be enabled in the configuration. The training file + must exist in the faces/train directory. Returns a success response or an error + message if face recognition is not enabled or the training file is invalid. operationId: reclassify_face_faces_reprocess_post requestBody: content: @@ -217,22 +228,29 @@ paths: type: object title: Body responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /faces/train/{name}/classify: post: tags: - - Events - summary: Train Face + - classification + summary: Classify and save a face training image + description: |- + Adds a training image to a specific face name for face recognition. + Accepts either a training file from the train directory or an event_id to extract + the face from. The image is saved to the face's directory and the face classifier + is cleared to incorporate the new training data. Returns a success message with + the new filename or an error if face recognition is not enabled, the file/event + is invalid, or the face cannot be extracted. operationId: train_face_faces_train__name__classify_post parameters: - name: name @@ -248,22 +266,27 @@ paths: type: object title: Body responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /faces/{name}/create: post: tags: - - Events - summary: Create Face + - classification + summary: Create a new face name + description: |- + Creates a new folder for a face name in the faces directory. + This is used to organize face training images. The face name is sanitized and + spaces are replaced with underscores. Returns a success message or an error if + face recognition is not enabled. operationId: create_face_faces__name__create_post parameters: - name: name @@ -273,22 +296,28 @@ paths: type: string title: Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /faces/{name}/register: post: tags: - - Events - summary: Register Face + - classification + summary: Register a face image + description: >- + Registers a face image for a specific face name by uploading an image + file. + The uploaded image is processed and added to the face recognition system. Returns a + success response with details about the registration, or an error if face recognition + is not enabled or the image cannot be processed. operationId: register_face_faces__name__register_post parameters: - name: name @@ -305,47 +334,325 @@ paths: $ref: >- #/components/schemas/Body_register_face_faces__name__register_post responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /faces/recognize: post: tags: - - Events - summary: Recognize Face + - classification + summary: Recognize a face from an uploaded image + description: |- + Recognizes a face from an uploaded image file by comparing it against + registered faces in the system. Returns the recognized face name and confidence score, + or an error if face recognition is not enabled or the image cannot be processed. operationId: recognize_face_faces_recognize_post requestBody: required: true content: multipart/form-data: schema: - $ref: "#/components/schemas/Body_recognize_face_faces_recognize_post" + $ref: '#/components/schemas/Body_recognize_face_faces_recognize_post' responses: - "200": + '200': description: Successful Response content: application/json: - schema: {} - "422": + schema: + $ref: '#/components/schemas/FaceRecognitionResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /faces/{name}/delete: post: tags: - - Events - summary: Deregister Faces + - classification + summary: Delete face images + description: >- + Deletes specific face images for a given face name. The image IDs must + belong + to the specified face folder. To delete an entire face folder, all image IDs in that + folder must be sent. Returns a success message or an error if face recognition is not enabled. operationId: deregister_faces_faces__name__delete_post + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteFaceImagesBody' + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /faces/{old_name}/rename: + put: + tags: + - classification + summary: Rename a face name + description: |- + Renames a face name in the system. The old name must exist and the new + name must be valid. Returns a success message or an error if face recognition is not enabled. + operationId: rename_face_faces__old_name__rename_put + parameters: + - name: old_name + in: path + required: true + schema: + type: string + title: Old Name + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RenameFaceBody' + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /lpr/reprocess: + put: + tags: + - classification + summary: Reprocess a license plate + description: |- + Reprocesses a license plate image to update the plate. + Requires license plate recognition to be enabled in the configuration. The event_id + must exist in the database. Returns a success message or an error if license plate + recognition is not enabled or the event_id is invalid. + operationId: reprocess_license_plate_lpr_reprocess_put + parameters: + - name: event_id + in: query + required: true + schema: + type: string + title: Event Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /reindex: + put: + tags: + - classification + summary: Reindex embeddings + description: |- + Reindexes the embeddings for all tracked objects. + Requires semantic search to be enabled in the configuration. Returns a success message or an error if semantic search is not enabled. + operationId: reindex_embeddings_reindex_put + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + /audio/transcribe: + put: + tags: + - classification + summary: Transcribe audio + description: |- + Transcribes audio from a specific event. + Requires audio transcription to be enabled in the configuration. The event_id + must exist in the database. Returns a success message or an error if audio transcription is not enabled or the event_id is invalid. + operationId: transcribe_audio_audio_transcribe_put + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AudioTranscriptionBody' + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /classification/{name}/dataset: + get: + tags: + - classification + summary: Get classification dataset + description: |- + Gets the dataset for a specific classification model. + The name must exist in the classification models. Returns a success message or an error if the name is invalid. + operationId: get_classification_dataset_classification__name__dataset_get + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /classification/{name}/train: + get: + tags: + - classification + summary: Get classification train images + description: |- + Gets the train images for a specific classification model. + The name must exist in the classification models. Returns a success message or an error if the name is invalid. + operationId: get_classification_images_classification__name__train_get + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + post: + tags: + - classification + summary: Train a classification model + description: |- + Trains a specific classification model. + The name must exist in the classification models. Returns a success message or an error if the name is invalid. + operationId: train_configured_model_classification__name__train_post + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /classification/{name}/dataset/{category}/delete: + post: + tags: + - classification + summary: Delete classification dataset images + description: >- + Deletes specific dataset images for a given classification model and + category. + The image IDs must belong to the specified category. Returns a success message or an error if the name or category is invalid. + operationId: >- + delete_classification_dataset_images_classification__name__dataset__category__delete_post + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + - name: category + in: path + required: true + schema: + type: string + title: Category + requestBody: + content: + application/json: + schema: + type: object + title: Body + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /classification/{name}/dataset/categorize: + post: + tags: + - classification + summary: Categorize a classification image + description: >- + Categorizes a specific classification image for a given classification + model and category. + The image must exist in the specified category. Returns a success message or an error if the name or category is invalid. + operationId: >- + categorize_classification_image_classification__name__dataset_categorize_post parameters: - name: name in: path @@ -360,85 +667,52 @@ paths: type: object title: Body responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" - /faces/{old_name}/rename: - put: + $ref: '#/components/schemas/HTTPValidationError' + /classification/{name}/train/delete: + post: tags: - - Events - summary: Rename Face - operationId: rename_face_faces__old_name__rename_put + - classification + summary: Delete classification train images + description: |- + Deletes specific train images for a given classification model. + The image IDs must belong to the specified train folder. Returns a success message or an error if the name is invalid. + operationId: >- + delete_classification_train_images_classification__name__train_delete_post parameters: - - name: old_name + - name: name in: path required: true schema: type: string - title: Old Name + title: Name requestBody: - required: true content: application/json: schema: - $ref: "#/components/schemas/RenameFaceBody" + type: object + title: Body responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" - /lpr/reprocess: - put: - tags: - - Events - summary: Reprocess License Plate - operationId: reprocess_license_plate_lpr_reprocess_put - parameters: - - name: event_id - in: query - required: true - schema: - type: string - title: Event Id - responses: - "200": - description: Successful Response - content: - application/json: - schema: {} - "422": - description: Validation Error - content: - application/json: - schema: - $ref: "#/components/schemas/HTTPValidationError" - /reindex: - put: - tags: - - Events - summary: Reindex Embeddings - operationId: reindex_embeddings_reindex_put - responses: - "200": - description: Successful Response - content: - application/json: - schema: {} + $ref: '#/components/schemas/HTTPValidationError' /review: get: tags: @@ -484,7 +758,7 @@ paths: in: query required: false schema: - $ref: "#/components/schemas/SeverityEnum" + $ref: '#/components/schemas/SeverityEnum' - name: before in: query required: false @@ -498,21 +772,21 @@ paths: type: number title: After responses: - "200": + '200': description: Successful Response content: application/json: schema: type: array items: - $ref: "#/components/schemas/ReviewSegmentResponse" + $ref: '#/components/schemas/ReviewSegmentResponse' title: Response Review Review Get - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review_ids: get: tags: @@ -527,21 +801,21 @@ paths: type: string title: Ids responses: - "200": + '200': description: Successful Response content: application/json: schema: type: array items: - $ref: "#/components/schemas/ReviewSegmentResponse" + $ref: '#/components/schemas/ReviewSegmentResponse' title: Response Review Ids Review Ids Get - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review/summary: get: tags: @@ -578,18 +852,18 @@ paths: default: utc title: Timezone responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/ReviewSummaryResponse" - "422": + $ref: '#/components/schemas/ReviewSummaryResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /reviews/viewed: post: tags: @@ -601,20 +875,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ReviewModifyMultipleBody" + $ref: '#/components/schemas/ReviewModifyMultipleBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /reviews/delete: post: tags: @@ -626,20 +900,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ReviewModifyMultipleBody" + $ref: '#/components/schemas/ReviewModifyMultipleBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review/activity/motion: get: tags: @@ -675,21 +949,21 @@ paths: default: 30 title: Scale responses: - "200": + '200': description: Successful Response content: application/json: schema: type: array items: - $ref: "#/components/schemas/ReviewActivityMotionResponse" + $ref: '#/components/schemas/ReviewActivityMotionResponse' title: Response Motion Activity Review Activity Motion Get - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review/event/{event_id}: get: tags: @@ -704,18 +978,18 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/ReviewSegmentResponse" - "422": + $ref: '#/components/schemas/ReviewSegmentResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review/{review_id}: get: tags: @@ -730,18 +1004,18 @@ paths: type: string title: Review Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/ReviewSegmentResponse" - "422": + $ref: '#/components/schemas/ReviewSegmentResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review/{review_id}/viewed: delete: tags: @@ -756,18 +1030,51 @@ paths: type: string title: Review Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' + /review/summarize/start/{start_ts}/end/{end_ts}: + post: + tags: + - Review + summary: Generate Review Summary + description: Use GenAI to summarize review items over a period of time. + operationId: >- + generate_review_summary_review_summarize_start__start_ts__end__end_ts__post + parameters: + - name: start_ts + in: path + required: true + schema: + type: number + title: Start Ts + - name: end_ts + in: path + required: true + schema: + type: number + title: End Ts + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' /: get: tags: @@ -775,7 +1082,7 @@ paths: summary: Is Healthy operationId: is_healthy__get responses: - "200": + '200': description: Successful Response content: text/plain: @@ -788,7 +1095,7 @@ paths: summary: Config Schema operationId: config_schema_config_schema_json_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -800,7 +1107,7 @@ paths: summary: Go2Rtc Streams operationId: go2rtc_streams_go2rtc_streams_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -819,17 +1126,17 @@ paths: type: string title: Camera Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /version: get: tags: @@ -837,7 +1144,7 @@ paths: summary: Version operationId: version_version_get responses: - "200": + '200': description: Successful Response content: text/plain: @@ -850,7 +1157,7 @@ paths: summary: Stats operationId: stats_stats_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -869,17 +1176,17 @@ paths: type: string title: Keys responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /metrics: get: tags: @@ -888,7 +1195,7 @@ paths: description: Expose Prometheus metrics endpoint and update metrics with latest stats operationId: metrics_metrics_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -900,7 +1207,7 @@ paths: summary: Config operationId: config_config_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -912,7 +1219,7 @@ paths: summary: Config Raw operationId: config_raw_config_raw_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -937,17 +1244,17 @@ paths: schema: title: Body responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /config/set: put: tags: @@ -959,19 +1266,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AppConfigSetBody" + $ref: '#/components/schemas/AppConfigSetBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /ffprobe: get: tags: @@ -984,20 +1291,20 @@ paths: required: false schema: type: string - default: "" + default: '' title: Paths responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /vainfo: get: tags: @@ -1005,7 +1312,7 @@ paths: summary: Vainfo operationId: vainfo_vainfo_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -1017,7 +1324,7 @@ paths: summary: Nvinfo operationId: nvinfo_nvinfo_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -1047,7 +1354,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Download - name: stream in: query @@ -1055,7 +1362,7 @@ paths: schema: anyOf: - type: boolean - - type: "null" + - type: 'null' default: false title: Stream - name: start @@ -1064,7 +1371,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 0 title: Start - name: end @@ -1073,20 +1380,20 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: End responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /restart: post: tags: @@ -1094,7 +1401,7 @@ paths: summary: Restart operationId: restart_restart_post responses: - "200": + '200': description: Successful Response content: application/json: @@ -1111,20 +1418,20 @@ paths: required: false schema: type: string - default: "" + default: '' title: Camera responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /sub_labels: get: tags: @@ -1138,20 +1445,20 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Split Joined responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /plus/models: get: tags: @@ -1167,17 +1474,17 @@ paths: default: false title: Filterbycurrentmodeldetector responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /recognized_license_plates: get: tags: @@ -1191,20 +1498,20 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Split Joined responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /timeline: get: tags: @@ -1232,20 +1539,20 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Source Id responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /timeline/hourly: get: tags: @@ -1260,7 +1567,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Cameras - name: labels @@ -1269,7 +1576,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Labels - name: after @@ -1278,7 +1585,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: After - name: before in: query @@ -1286,7 +1593,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Before - name: limit in: query @@ -1294,7 +1601,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 200 title: Limit - name: timezone @@ -1303,21 +1610,21 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: utc title: Timezone responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /preview/{camera_name}/start/{start_ts}/end/{end_ts}: get: tags: @@ -1330,7 +1637,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_ts in: path @@ -1345,17 +1654,17 @@ paths: type: number title: End Ts responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /preview/{year_month}/{day}/{hour}/{camera_name}/{tz_name}: get: tags: @@ -1387,7 +1696,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: tz_name in: path @@ -1396,17 +1707,17 @@ paths: type: string title: Tz Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /preview/{camera_name}/start/{start_ts}/end/{end_ts}/frames: get: tags: @@ -1420,7 +1731,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_ts in: path @@ -1435,17 +1748,17 @@ paths: type: number title: End Ts responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /notifications/pubkey: get: tags: @@ -1453,7 +1766,7 @@ paths: summary: Get Vapid Pub Key operationId: get_vapid_pub_key_notifications_pubkey_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -1471,17 +1784,17 @@ paths: type: object title: Body responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /exports: get: tags: @@ -1489,7 +1802,7 @@ paths: summary: Get Exports operationId: get_exports_exports_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -1506,7 +1819,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_time in: path @@ -1525,19 +1840,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ExportRecordingsBody" + $ref: '#/components/schemas/ExportRecordingsBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /export/{event_id}/rename: patch: tags: @@ -1556,19 +1871,19 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ExportRenameBody" + $ref: '#/components/schemas/ExportRenameBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /export/{event_id}: delete: tags: @@ -1583,17 +1898,17 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /exports/{export_id}: get: tags: @@ -1608,17 +1923,17 @@ paths: type: string title: Export Id responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events: get: tags: @@ -1632,7 +1947,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Camera - name: cameras @@ -1641,7 +1956,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Cameras - name: label @@ -1650,7 +1965,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Label - name: labels @@ -1659,7 +1974,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Labels - name: sub_label @@ -1668,7 +1983,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Sub Label - name: sub_labels @@ -1677,7 +1992,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Sub Labels - name: zone @@ -1686,7 +2001,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Zone - name: zones @@ -1695,7 +2010,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Zones - name: limit @@ -1704,7 +2019,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 100 title: Limit - name: after @@ -1713,7 +2028,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: After - name: before in: query @@ -1721,7 +2036,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Before - name: time_range in: query @@ -1729,7 +2044,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: 00:00,24:00 title: Time Range - name: has_clip @@ -1738,7 +2053,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Has Clip - name: has_snapshot in: query @@ -1746,7 +2061,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Has Snapshot - name: in_progress in: query @@ -1754,19 +2069,15 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: In Progress - name: include_thumbnails in: query required: false - description: > - Deprecated. Thumbnail data is no longer included in the response. - Use the /api/events/:event_id/thumbnail.:extension endpoint instead. - deprecated: true schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 1 title: Include Thumbnails - name: favorites @@ -1775,7 +2086,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Favorites - name: min_score in: query @@ -1783,7 +2094,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Min Score - name: max_score in: query @@ -1791,7 +2102,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Max Score - name: min_speed in: query @@ -1799,7 +2110,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Min Speed - name: max_speed in: query @@ -1807,7 +2118,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Max Speed - name: recognized_license_plate in: query @@ -1815,7 +2126,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Recognized License Plate - name: is_submitted @@ -1824,7 +2135,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Is Submitted - name: min_length in: query @@ -1832,7 +2143,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Min Length - name: max_length in: query @@ -1840,7 +2151,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Max Length - name: event_id in: query @@ -1848,7 +2159,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Event Id - name: sort in: query @@ -1856,7 +2167,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Sort - name: timezone in: query @@ -1864,25 +2175,25 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: utc title: Timezone responses: - "200": + '200': description: Successful Response content: application/json: schema: type: array items: - $ref: "#/components/schemas/EventResponse" + $ref: '#/components/schemas/EventResponse' title: Response Events Events Get - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/explore: get: tags: @@ -1898,21 +2209,21 @@ paths: default: 10 title: Limit responses: - "200": + '200': description: Successful Response content: application/json: schema: type: array items: - $ref: "#/components/schemas/EventResponse" + $ref: '#/components/schemas/EventResponse' title: Response Events Explore Events Explore Get - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /event_ids: get: tags: @@ -1927,21 +2238,21 @@ paths: type: string title: Ids responses: - "200": + '200': description: Successful Response content: application/json: schema: type: array items: - $ref: "#/components/schemas/EventResponse" + $ref: '#/components/schemas/EventResponse' title: Response Event Ids Event Ids Get - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/search: get: tags: @@ -1955,7 +2266,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Query - name: event_id in: query @@ -1963,7 +2274,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Event Id - name: search_type in: query @@ -1971,20 +2282,16 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: thumbnail title: Search Type - name: include_thumbnails in: query required: false - description: > - Deprecated. Thumbnail data is no longer included in the response. - Use the /api/events/:event_id/thumbnail.:extension endpoint instead. - deprecated: true schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 1 title: Include Thumbnails - name: limit @@ -1993,7 +2300,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 50 title: Limit - name: cameras @@ -2002,7 +2309,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Cameras - name: labels @@ -2011,7 +2318,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Labels - name: zones @@ -2020,7 +2327,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Zones - name: after @@ -2029,7 +2336,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: After - name: before in: query @@ -2037,7 +2344,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Before - name: time_range in: query @@ -2045,7 +2352,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: 00:00,24:00 title: Time Range - name: has_clip @@ -2054,7 +2361,7 @@ paths: schema: anyOf: - type: boolean - - type: "null" + - type: 'null' title: Has Clip - name: has_snapshot in: query @@ -2062,7 +2369,7 @@ paths: schema: anyOf: - type: boolean - - type: "null" + - type: 'null' title: Has Snapshot - name: is_submitted in: query @@ -2070,7 +2377,7 @@ paths: schema: anyOf: - type: boolean - - type: "null" + - type: 'null' title: Is Submitted - name: timezone in: query @@ -2078,7 +2385,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: utc title: Timezone - name: min_score @@ -2087,7 +2394,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Min Score - name: max_score in: query @@ -2095,7 +2402,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Max Score - name: min_speed in: query @@ -2103,7 +2410,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Min Speed - name: max_speed in: query @@ -2111,7 +2418,7 @@ paths: schema: anyOf: - type: number - - type: "null" + - type: 'null' title: Max Speed - name: recognized_license_plate in: query @@ -2119,7 +2426,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Recognized License Plate - name: sort @@ -2128,20 +2435,20 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' title: Sort responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/summary: get: tags: @@ -2155,7 +2462,7 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: utc title: Timezone - name: has_clip @@ -2164,7 +2471,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Has Clip - name: has_snapshot in: query @@ -2172,20 +2479,20 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Has Snapshot responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}: get: tags: @@ -2200,18 +2507,18 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/EventResponse" - "422": + $ref: '#/components/schemas/EventResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' delete: tags: - Events @@ -2225,18 +2532,18 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/retain: post: tags: @@ -2251,18 +2558,18 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' delete: tags: - Events @@ -2276,18 +2583,18 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/plus: post: tags: @@ -2305,20 +2612,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/SubmitPlusBody" + $ref: '#/components/schemas/SubmitPlusBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/EventUploadPlusResponse" - "422": + $ref: '#/components/schemas/EventUploadPlusResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/false_positive: put: tags: @@ -2333,18 +2640,18 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/EventUploadPlusResponse" - "422": + $ref: '#/components/schemas/EventUploadPlusResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/sub_label: post: tags: @@ -2363,20 +2670,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EventsSubLabelBody" + $ref: '#/components/schemas/EventsSubLabelBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/recognized_license_plate: post: tags: @@ -2395,20 +2702,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EventsLPRBody" + $ref: '#/components/schemas/EventsLPRBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/description: post: tags: @@ -2427,20 +2734,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EventsDescriptionBody" + $ref: '#/components/schemas/EventsDescriptionBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/description/regenerate: put: tags: @@ -2459,23 +2766,57 @@ paths: required: false schema: anyOf: - - $ref: "#/components/schemas/RegenerateDescriptionEnum" - - type: "null" + - $ref: '#/components/schemas/RegenerateDescriptionEnum' + - type: 'null' default: thumbnails title: Source + - name: force + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Force responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' + /description/generate: + post: + tags: + - Events + summary: Generate Description Embedding + operationId: generate_description_embedding_description_generate_post + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EventsDescriptionBody' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResponse' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' /events/: delete: tags: @@ -2487,20 +2828,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EventsDeleteBody" + $ref: '#/components/schemas/EventsDeleteBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/EventMultiDeleteResponse" - "422": + $ref: '#/components/schemas/EventMultiDeleteResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{camera_name}/{label}/create: post: tags: @@ -2524,7 +2865,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EventsCreateBody" + $ref: '#/components/schemas/EventsCreateBody' default: source_type: api score: 0 @@ -2532,18 +2873,18 @@ paths: include_recording: true draw: {} responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/EventCreateResponse" - "422": + $ref: '#/components/schemas/EventCreateResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/end: put: tags: @@ -2562,20 +2903,161 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/EventsEndBody" + $ref: '#/components/schemas/EventsEndBody' responses: - "200": + '200': description: Successful Response content: application/json: schema: - $ref: "#/components/schemas/GenericResponse" - "422": + $ref: '#/components/schemas/GenericResponse' + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' + /trigger/embedding: + post: + tags: + - Events + summary: Create Trigger Embedding + operationId: create_trigger_embedding_trigger_embedding_post + parameters: + - name: camera_name + in: query + required: true + schema: + type: string + title: Camera Name + - name: name + in: query + required: true + schema: + type: string + title: Name + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TriggerEmbeddingBody' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: object + title: Response Create Trigger Embedding Trigger Embedding Post + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /trigger/embedding/{camera_name}/{name}: + put: + tags: + - Events + summary: Update Trigger Embedding + operationId: update_trigger_embedding_trigger_embedding__camera_name___name__put + parameters: + - name: camera_name + in: path + required: true + schema: + type: string + title: Camera Name + - name: name + in: path + required: true + schema: + type: string + title: Name + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TriggerEmbeddingBody' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: object + title: >- + Response Update Trigger Embedding Trigger Embedding Camera + Name Name Put + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + delete: + tags: + - Events + summary: Delete Trigger Embedding + operationId: delete_trigger_embedding_trigger_embedding__camera_name___name__delete + parameters: + - name: camera_name + in: path + required: true + schema: + type: string + title: Camera Name + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: object + title: >- + Response Delete Trigger Embedding Trigger Embedding Camera + Name Name Delete + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /triggers/status/{camera_name}: + get: + tags: + - Events + summary: Get Triggers Status + operationId: get_triggers_status_triggers_status__camera_name__get + parameters: + - name: camera_name + in: path + required: true + schema: + type: string + title: Camera Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: object + title: Response Get Triggers Status Triggers Status Camera Name Get + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}: get: tags: @@ -2587,7 +3069,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: fps in: query @@ -2609,7 +3093,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Bbox - name: timestamp in: query @@ -2617,7 +3101,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Timestamp - name: zones in: query @@ -2625,7 +3109,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Zones - name: mask in: query @@ -2633,7 +3117,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Mask - name: motion in: query @@ -2641,7 +3125,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Motion - name: regions in: query @@ -2649,20 +3133,20 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Regions responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/ptz/info: get: tags: @@ -2674,20 +3158,22 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/latest.{extension}: get: tags: @@ -2699,20 +3185,22 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: extension in: path required: true schema: - $ref: "#/components/schemas/Extension" + $ref: '#/components/schemas/Extension' - name: bbox in: query required: false schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Bbox - name: timestamp in: query @@ -2720,7 +3208,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Timestamp - name: zones in: query @@ -2728,7 +3216,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Zones - name: mask in: query @@ -2736,7 +3224,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Mask - name: motion in: query @@ -2744,15 +3232,23 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Motion + - name: paths + in: query + required: false + schema: + anyOf: + - type: integer + - type: 'null' + title: Paths - name: regions in: query required: false schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Regions - name: quality in: query @@ -2760,7 +3256,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 70 title: Quality - name: height @@ -2769,7 +3265,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Height - name: store in: query @@ -2777,20 +3273,20 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Store responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/recordings/{frame_time}/snapshot.{format}: get: tags: @@ -2803,7 +3299,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: frame_time in: path @@ -2827,17 +3325,17 @@ paths: type: integer title: Height responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/plus/{frame_time}: post: tags: @@ -2849,7 +3347,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: frame_time in: path @@ -2858,17 +3358,17 @@ paths: type: string title: Frame Time responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /recordings/storage: get: tags: @@ -2876,7 +3376,7 @@ paths: summary: Get Recordings Storage Usage operationId: get_recordings_storage_usage_recordings_storage_get responses: - "200": + '200': description: Successful Response content: application/json: @@ -2902,21 +3402,21 @@ paths: schema: anyOf: - type: string - - type: "null" + - type: 'null' default: all title: Cameras responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/recordings/summary: get: tags: @@ -2929,7 +3429,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: timezone in: query @@ -2939,24 +3441,24 @@ paths: default: utc title: Timezone responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/recordings: get: tags: - Media summary: Recordings description: >- - Return specific camera recordings between the given "after"/"end" times. + Return specific camera recordings between the given 'after'/'end' times. If not provided the last hour will be used operationId: recordings__camera_name__recordings_get parameters: @@ -2964,34 +3466,86 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: after in: query required: false schema: type: number - default: 1752611870.43948 + default: 1759925464.421221 title: After - name: before in: query required: false schema: type: number - default: 1752615470.43949 + default: 1759929064.421228 title: Before responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' + /recordings/unavailable: + get: + tags: + - Media + summary: No Recordings + description: Get time ranges with no recordings. + operationId: no_recordings_recordings_unavailable_get + parameters: + - name: cameras + in: query + required: false + schema: + type: string + default: all + title: Cameras + - name: before + in: query + required: false + schema: + type: number + title: Before + - name: after + in: query + required: false + schema: + type: number + title: After + - name: scale + in: query + required: false + schema: + type: integer + default: 30 + title: Scale + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: array + items: + type: object + title: Response No Recordings Recordings Unavailable Get + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/start/{start_ts}/end/{end_ts}/clip.mp4: get: tags: @@ -3006,7 +3560,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_ts in: path @@ -3021,17 +3577,17 @@ paths: type: number title: End Ts responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /vod/{camera_name}/start/{start_ts}/end/{end_ts}: get: tags: @@ -3046,7 +3602,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_ts in: path @@ -3061,17 +3619,17 @@ paths: type: number title: End Ts responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /vod/{year_month}/{day}/{hour}/{camera_name}: get: tags: @@ -3104,20 +3662,22 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /vod/{year_month}/{day}/{hour}/{camera_name}/{tz_name}: get: tags: @@ -3151,7 +3711,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: tz_name in: path @@ -3160,17 +3722,17 @@ paths: type: string title: Tz Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /vod/event/{event_id}: get: tags: @@ -3187,18 +3749,27 @@ paths: schema: type: string title: Event Id + - name: padding + in: query + required: false + schema: + type: integer + description: Padding to apply to the vod. + default: 0 + title: Padding + description: Padding to apply to the vod. responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/snapshot.jpg: get: tags: @@ -3222,7 +3793,7 @@ paths: schema: anyOf: - type: boolean - - type: "null" + - type: 'null' default: false title: Download - name: timestamp @@ -3231,7 +3802,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Timestamp - name: bbox in: query @@ -3239,7 +3810,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Bbox - name: crop in: query @@ -3247,7 +3818,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Crop - name: height in: query @@ -3255,7 +3826,7 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' title: Height - name: quality in: query @@ -3263,21 +3834,21 @@ paths: schema: anyOf: - type: integer - - type: "null" + - type: 'null' default: 70 title: Quality responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/thumbnail.{extension}: get: tags: @@ -3295,8 +3866,7 @@ paths: in: path required: true schema: - type: string - title: Extension + $ref: '#/components/schemas/Extension' - name: max_cache_age in: query required: false @@ -3317,17 +3887,17 @@ paths: default: ios title: Format responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/grid.jpg: get: tags: @@ -3339,7 +3909,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: color in: query @@ -3356,17 +3928,17 @@ paths: default: 0.5 title: Font Scale responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/snapshot-clean.png: get: tags: @@ -3388,17 +3960,17 @@ paths: default: false title: Download responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/clip.mp4: get: tags: @@ -3412,18 +3984,27 @@ paths: schema: type: string title: Event Id + - name: padding + in: query + required: false + schema: + type: integer + description: Padding to apply to clip. + default: 0 + title: Padding + description: Padding to apply to clip. responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /events/{event_id}/preview.gif: get: tags: @@ -3438,17 +4019,17 @@ paths: type: string title: Event Id responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/start/{start_ts}/end/{end_ts}/preview.gif: get: tags: @@ -3460,7 +4041,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_ts in: path @@ -3484,17 +4067,17 @@ paths: title: Max Cache Age description: Max cache age in seconds. Default 30 days in seconds. responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/start/{start_ts}/end/{end_ts}/preview.mp4: get: tags: @@ -3506,7 +4089,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: start_ts in: path @@ -3530,17 +4115,17 @@ paths: title: Max Cache Age description: Max cache age in seconds. Default 7 days in seconds. responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /review/{event_id}/preview: get: tags: @@ -3565,17 +4150,17 @@ paths: default: gif title: Format responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /preview/{file_name}/thumbnail.webp: get: tags: @@ -3591,17 +4176,17 @@ paths: type: string title: File Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /preview/{file_name}/thumbnail.jpg: get: tags: @@ -3617,17 +4202,17 @@ paths: type: string title: File Name responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/{label}/thumbnail.jpg: get: tags: @@ -3639,7 +4224,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: label in: path @@ -3648,17 +4235,17 @@ paths: type: string title: Label responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/{label}/best.jpg: get: tags: @@ -3670,7 +4257,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: label in: path @@ -3679,17 +4268,17 @@ paths: type: string title: Label responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/{label}/clip.mp4: get: tags: @@ -3701,7 +4290,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: label in: path @@ -3710,17 +4301,17 @@ paths: type: string title: Label responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' /{camera_name}/{label}/snapshot.jpg: get: tags: @@ -3735,7 +4326,9 @@ paths: in: path required: true schema: - type: string + anyOf: + - type: string + - type: 'null' title: Camera Name - name: label in: path @@ -3744,17 +4337,17 @@ paths: type: string title: Label responses: - "200": + '200': description: Successful Response content: application/json: schema: {} - "422": + '422': description: Validation Error content: application/json: schema: - $ref: "#/components/schemas/HTTPValidationError" + $ref: '#/components/schemas/HTTPValidationError' components: schemas: AppConfigSetBody: @@ -3763,6 +4356,16 @@ components: type: integer title: Requires Restart default: 1 + update_topic: + anyOf: + - type: string + - type: 'null' + title: Update Topic + config_data: + anyOf: + - type: object + - type: 'null' + title: Config Data type: object title: AppConfigSetBody AppPostLoginBody: @@ -3789,7 +4392,7 @@ components: role: anyOf: - type: string - - type: "null" + - type: 'null' title: Role default: viewer type: object @@ -3815,6 +4418,15 @@ components: required: - role title: AppPutRoleBody + AudioTranscriptionBody: + properties: + event_id: + type: string + title: Event Id + type: object + required: + - event_id + title: AudioTranscriptionBody Body_recognize_face_faces_recognize_post: properties: file: @@ -3861,6 +4473,18 @@ components: - total_alert - total_detection title: DayReview + DeleteFaceImagesBody: + properties: + ids: + items: + type: string + type: array + title: Ids + description: List of image filenames to delete from the face folder + type: object + required: + - ids + title: DeleteFaceImagesBody EventCreateResponse: properties: success: @@ -3910,7 +4534,7 @@ components: sub_label: anyOf: - type: string - - type: "null" + - type: 'null' title: Sub Label camera: type: string @@ -3921,12 +4545,12 @@ components: end_time: anyOf: - type: number - - type: "null" + - type: 'null' title: End Time false_positive: anyOf: - type: boolean - - type: "null" + - type: 'null' title: False Positive zones: items: @@ -3936,7 +4560,7 @@ components: thumbnail: anyOf: - type: string - - type: "null" + - type: 'null' title: Thumbnail has_clip: type: boolean @@ -3950,22 +4574,22 @@ components: plus_id: anyOf: - type: string - - type: "null" + - type: 'null' title: Plus Id model_hash: anyOf: - type: string - - type: "null" + - type: 'null' title: Model Hash detector_type: anyOf: - type: string - - type: "null" + - type: 'null' title: Detector Type model_type: anyOf: - type: string - - type: "null" + - type: 'null' title: Model Type data: type: object @@ -4008,36 +4632,36 @@ components: source_type: anyOf: - type: string - - type: "null" + - type: 'null' title: Source Type default: api sub_label: anyOf: - type: string - - type: "null" + - type: 'null' title: Sub Label score: anyOf: - type: number - - type: "null" + - type: 'null' title: Score default: 0 duration: anyOf: - type: integer - - type: "null" + - type: 'null' title: Duration default: 30 include_recording: anyOf: - type: boolean - - type: "null" + - type: 'null' title: Include Recording default: true draw: anyOf: - type: object - - type: "null" + - type: 'null' title: Draw default: {} type: object @@ -4058,7 +4682,7 @@ components: description: anyOf: - type: string - - type: "null" + - type: 'null' title: The description of the event type: object required: @@ -4069,7 +4693,7 @@ components: end_time: anyOf: - type: number - - type: "null" + - type: 'null' title: End Time type: object title: EventsEndBody @@ -4084,7 +4708,7 @@ components: - type: number maximum: 1 exclusiveMinimum: 0 - - type: "null" + - type: 'null' title: Score for recognized license plate type: object required: @@ -4101,12 +4725,12 @@ components: - type: number maximum: 1 exclusiveMinimum: 0 - - type: "null" + - type: 'null' title: Score for sub label camera: anyOf: - type: string - - type: "null" + - type: 'null' title: Camera this object is detected on. type: object required: @@ -4115,11 +4739,11 @@ components: ExportRecordingsBody: properties: playback: - $ref: "#/components/schemas/PlaybackFactorEnum" + $ref: '#/components/schemas/PlaybackFactorEnum' title: Playback factor default: realtime source: - $ref: "#/components/schemas/PlaybackSourceEnum" + $ref: '#/components/schemas/PlaybackSourceEnum' title: Playback source default: recordings name: @@ -4149,6 +4773,53 @@ components: - jpg - jpeg title: Extension + FaceRecognitionResponse: + properties: + success: + type: boolean + title: Success + description: Whether the face recognition was successful + score: + anyOf: + - type: number + - type: 'null' + title: Score + description: Confidence score of the recognition (0-1) + face_name: + anyOf: + - type: string + - type: 'null' + title: Face Name + description: The recognized face name if successful + type: object + required: + - success + title: FaceRecognitionResponse + description: >- + Response model for face recognition endpoint. + + + Returns the result of attempting to recognize a face from an uploaded + image. + FacesResponse: + additionalProperties: + items: + type: string + type: array + type: object + title: FacesResponse + description: |- + Response model for the get_faces endpoint. + + Returns a mapping of face names to lists of image filenames. + Each face name corresponds to a directory in the faces folder, + and the list contains the names of image files for that face. + + Example: + { + "john_doe": ["face1.webp", "face2.jpg"], + "jane_smith": ["face3.png"] + } GenericResponse: properties: success: @@ -4166,7 +4837,7 @@ components: properties: detail: items: - $ref: "#/components/schemas/ValidationError" + $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object @@ -4269,7 +4940,7 @@ components: type: boolean title: Has Been Reviewed severity: - $ref: "#/components/schemas/SeverityEnum" + $ref: '#/components/schemas/SeverityEnum' thumb_path: type: string title: Thumb Path @@ -4289,10 +4960,10 @@ components: ReviewSummaryResponse: properties: last24Hours: - $ref: "#/components/schemas/Last24HoursReview" + $ref: '#/components/schemas/Last24HoursReview' root: additionalProperties: - $ref: "#/components/schemas/DayReview" + $ref: '#/components/schemas/DayReview' type: object title: Root type: object @@ -4314,6 +4985,30 @@ components: default: 1 type: object title: SubmitPlusBody + TriggerEmbeddingBody: + properties: + type: + $ref: '#/components/schemas/TriggerType' + data: + type: string + title: Data + threshold: + type: number + maximum: 1 + minimum: 0 + title: Threshold + default: 0.5 + type: object + required: + - type + - data + title: TriggerEmbeddingBody + TriggerType: + type: string + enum: + - thumbnail + - description + title: TriggerType ValidationError: properties: loc: diff --git a/frigate/api/classification.py b/frigate/api/classification.py index 22e0a30f0..54af635eb 100644 --- a/frigate/api/classification.py +++ b/frigate/api/classification.py @@ -16,8 +16,13 @@ from playhouse.shortcuts import model_to_dict from frigate.api.auth import require_role from frigate.api.defs.request.classification_body import ( AudioTranscriptionBody, + DeleteFaceImagesBody, RenameFaceBody, ) +from frigate.api.defs.response.classification_response import ( + FaceRecognitionResponse, + FacesResponse, +) from frigate.api.defs.tags import Tags from frigate.config import FrigateConfig from frigate.config.camera import DetectConfig @@ -28,10 +33,18 @@ from frigate.util.path import get_event_snapshot logger = logging.getLogger(__name__) -router = APIRouter(tags=[Tags.events]) +router = APIRouter(tags=[Tags.classification]) -@router.get("/faces") +@router.get( + "/faces", + response_model=FacesResponse, + summary="Get all registered faces", + description="""Returns a dictionary mapping face names to lists of image filenames. + Each key represents a registered face name, and the value is a list of image + files associated with that face. Supported image formats include .webp, .png, + .jpg, and .jpeg.""", +) def get_faces(): face_dict: dict[str, list[str]] = {} @@ -55,7 +68,15 @@ def get_faces(): return JSONResponse(status_code=200, content=face_dict) -@router.post("/faces/reprocess", dependencies=[Depends(require_role(["admin"]))]) +@router.post( + "/faces/reprocess", + dependencies=[Depends(require_role(["admin"]))], + summary="Reprocess a face training image", + description="""Reprocesses a face training image to update the prediction. + Requires face recognition to be enabled in the configuration. The training file + must exist in the faces/train directory. Returns a success response or an error + message if face recognition is not enabled or the training file is invalid.""", +) def reclassify_face(request: Request, body: dict = None): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( @@ -88,7 +109,16 @@ def reclassify_face(request: Request, body: dict = None): ) -@router.post("/faces/train/{name}/classify") +@router.post( + "/faces/train/{name}/classify", + summary="Classify and save a face training image", + description="""Adds a training image to a specific face name for face recognition. + Accepts either a training file from the train directory or an event_id to extract + the face from. The image is saved to the face's directory and the face classifier + is cleared to incorporate the new training data. Returns a success message with + the new filename or an error if face recognition is not enabled, the file/event + is invalid, or the face cannot be extracted.""", +) def train_face(request: Request, name: str, body: dict = None): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( @@ -192,7 +222,15 @@ def train_face(request: Request, name: str, body: dict = None): ) -@router.post("/faces/{name}/create", dependencies=[Depends(require_role(["admin"]))]) +@router.post( + "/faces/{name}/create", + dependencies=[Depends(require_role(["admin"]))], + summary="Create a new face name", + description="""Creates a new folder for a face name in the faces directory. + This is used to organize face training images. The face name is sanitized and + spaces are replaced with underscores. Returns a success message or an error if + face recognition is not enabled.""", +) async def create_face(request: Request, name: str): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( @@ -209,7 +247,15 @@ async def create_face(request: Request, name: str): ) -@router.post("/faces/{name}/register", dependencies=[Depends(require_role(["admin"]))]) +@router.post( + "/faces/{name}/register", + dependencies=[Depends(require_role(["admin"]))], + summary="Register a face image", + description="""Registers a face image for a specific face name by uploading an image file. + The uploaded image is processed and added to the face recognition system. Returns a + success response with details about the registration, or an error if face recognition + is not enabled or the image cannot be processed.""", +) async def register_face(request: Request, name: str, file: UploadFile): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( @@ -235,7 +281,14 @@ async def register_face(request: Request, name: str, file: UploadFile): ) -@router.post("/faces/recognize") +@router.post( + "/faces/recognize", + response_model=FaceRecognitionResponse, + summary="Recognize a face from an uploaded image", + description="""Recognizes a face from an uploaded image file by comparing it against + registered faces in the system. Returns the recognized face name and confidence score, + or an error if face recognition is not enabled or the image cannot be processed.""", +) async def recognize_face(request: Request, file: UploadFile): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( @@ -261,28 +314,36 @@ async def recognize_face(request: Request, file: UploadFile): ) -@router.post("/faces/{name}/delete", dependencies=[Depends(require_role(["admin"]))]) -def deregister_faces(request: Request, name: str, body: dict = None): +@router.post( + "/faces/{name}/delete", + dependencies=[Depends(require_role(["admin"]))], + summary="Delete face images", + description="""Deletes specific face images for a given face name. The image IDs must belong + to the specified face folder. To delete an entire face folder, all image IDs in that + folder must be sent. Returns a success message or an error if face recognition is not enabled.""", +) +def deregister_faces(request: Request, name: str, body: DeleteFaceImagesBody): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( status_code=400, content={"message": "Face recognition is not enabled.", "success": False}, ) - json: dict[str, Any] = body or {} - list_of_ids = json.get("ids", "") - context: EmbeddingsContext = request.app.embeddings - context.delete_face_ids( - name, map(lambda file: sanitize_filename(file), list_of_ids) - ) + context.delete_face_ids(name, map(lambda file: sanitize_filename(file), body.ids)) return JSONResponse( content=({"success": True, "message": "Successfully deleted faces."}), status_code=200, ) -@router.put("/faces/{old_name}/rename", dependencies=[Depends(require_role(["admin"]))]) +@router.put( + "/faces/{old_name}/rename", + dependencies=[Depends(require_role(["admin"]))], + summary="Rename a face name", + description="""Renames a face name in the system. The old name must exist and the new + name must be valid. Returns a success message or an error if face recognition is not enabled.""", +) def rename_face(request: Request, old_name: str, body: RenameFaceBody): if not request.app.frigate_config.face_recognition.enabled: return JSONResponse( @@ -311,7 +372,14 @@ def rename_face(request: Request, old_name: str, body: RenameFaceBody): ) -@router.put("/lpr/reprocess") +@router.put( + "/lpr/reprocess", + summary="Reprocess a license plate", + description="""Reprocesses a license plate image to update the plate. + Requires license plate recognition to be enabled in the configuration. The event_id + must exist in the database. Returns a success message or an error if license plate + recognition is not enabled or the event_id is invalid.""", +) def reprocess_license_plate(request: Request, event_id: str): if not request.app.frigate_config.lpr.enabled: message = "License plate recognition is not enabled." @@ -344,7 +412,13 @@ def reprocess_license_plate(request: Request, event_id: str): ) -@router.put("/reindex", dependencies=[Depends(require_role(["admin"]))]) +@router.put( + "/reindex", + dependencies=[Depends(require_role(["admin"]))], + summary="Reindex embeddings", + description="""Reindexes the embeddings for all tracked objects. + Requires semantic search to be enabled in the configuration. Returns a success message or an error if semantic search is not enabled.""", +) def reindex_embeddings(request: Request): if not request.app.frigate_config.semantic_search.enabled: message = ( @@ -390,7 +464,13 @@ def reindex_embeddings(request: Request): ) -@router.put("/audio/transcribe") +@router.put( + "/audio/transcribe", + summary="Transcribe audio", + description="""Transcribes audio from a specific event. + Requires audio transcription to be enabled in the configuration. The event_id + must exist in the database. Returns a success message or an error if audio transcription is not enabled or the event_id is invalid.""", +) def transcribe_audio(request: Request, body: AudioTranscriptionBody): event_id = body.event_id @@ -448,7 +528,12 @@ def transcribe_audio(request: Request, body: AudioTranscriptionBody): # custom classification training -@router.get("/classification/{name}/dataset") +@router.get( + "/classification/{name}/dataset", + summary="Get classification dataset", + description="""Gets the dataset for a specific classification model. + The name must exist in the classification models. Returns a success message or an error if the name is invalid.""", +) def get_classification_dataset(name: str): dataset_dict: dict[str, list[str]] = {} @@ -474,7 +559,12 @@ def get_classification_dataset(name: str): return JSONResponse(status_code=200, content=dataset_dict) -@router.get("/classification/{name}/train") +@router.get( + "/classification/{name}/train", + summary="Get classification train images", + description="""Gets the train images for a specific classification model. + The name must exist in the classification models. Returns a success message or an error if the name is invalid.""", +) def get_classification_images(name: str): train_dir = os.path.join(CLIPS_DIR, sanitize_filename(name), "train") @@ -492,7 +582,12 @@ def get_classification_images(name: str): ) -@router.post("/classification/{name}/train") +@router.post( + "/classification/{name}/train", + summary="Train a classification model", + description="""Trains a specific classification model. + The name must exist in the classification models. Returns a success message or an error if the name is invalid.""", +) async def train_configured_model(request: Request, name: str): config: FrigateConfig = request.app.frigate_config @@ -518,6 +613,9 @@ async def train_configured_model(request: Request, name: str): @router.post( "/classification/{name}/dataset/{category}/delete", dependencies=[Depends(require_role(["admin"]))], + summary="Delete classification dataset images", + description="""Deletes specific dataset images for a given classification model and category. + The image IDs must belong to the specified category. Returns a success message or an error if the name or category is invalid.""", ) def delete_classification_dataset_images( request: Request, name: str, category: str, body: dict = None @@ -556,6 +654,9 @@ def delete_classification_dataset_images( @router.post( "/classification/{name}/dataset/categorize", dependencies=[Depends(require_role(["admin"]))], + summary="Categorize a classification image", + description="""Categorizes a specific classification image for a given classification model and category. + The image must exist in the specified category. Returns a success message or an error if the name or category is invalid.""", ) def categorize_classification_image(request: Request, name: str, body: dict = None): config: FrigateConfig = request.app.frigate_config @@ -611,6 +712,9 @@ def categorize_classification_image(request: Request, name: str, body: dict = No @router.post( "/classification/{name}/train/delete", dependencies=[Depends(require_role(["admin"]))], + summary="Delete classification train images", + description="""Deletes specific train images for a given classification model. + The image IDs must belong to the specified train folder. Returns a success message or an error if the name is invalid.""", ) def delete_classification_train_images(request: Request, name: str, body: dict = None): config: FrigateConfig = request.app.frigate_config diff --git a/frigate/api/defs/request/classification_body.py b/frigate/api/defs/request/classification_body.py index 31c5688bf..dabff0912 100644 --- a/frigate/api/defs/request/classification_body.py +++ b/frigate/api/defs/request/classification_body.py @@ -1,4 +1,6 @@ -from pydantic import BaseModel +from typing import List + +from pydantic import BaseModel, Field class RenameFaceBody(BaseModel): @@ -7,3 +9,9 @@ class RenameFaceBody(BaseModel): class AudioTranscriptionBody(BaseModel): event_id: str + + +class DeleteFaceImagesBody(BaseModel): + ids: List[str] = Field( + description="List of image filenames to delete from the face folder" + ) diff --git a/frigate/api/defs/response/classification_response.py b/frigate/api/defs/response/classification_response.py new file mode 100644 index 000000000..92d354f24 --- /dev/null +++ b/frigate/api/defs/response/classification_response.py @@ -0,0 +1,38 @@ +from typing import Dict, List, Optional + +from pydantic import BaseModel, Field, RootModel + + +class FacesResponse(RootModel[Dict[str, List[str]]]): + """Response model for the get_faces endpoint. + + Returns a mapping of face names to lists of image filenames. + Each face name corresponds to a directory in the faces folder, + and the list contains the names of image files for that face. + + Example: + { + "john_doe": ["face1.webp", "face2.jpg"], + "jane_smith": ["face3.png"] + } + """ + + root: Dict[str, List[str]] = Field( + default_factory=dict, + description="Dictionary mapping face names to lists of image filenames", + ) + + +class FaceRecognitionResponse(BaseModel): + """Response model for face recognition endpoint. + + Returns the result of attempting to recognize a face from an uploaded image. + """ + + success: bool = Field(description="Whether the face recognition was successful") + score: Optional[float] = Field( + default=None, description="Confidence score of the recognition (0-1)" + ) + face_name: Optional[str] = Field( + default=None, description="The recognized face name if successful" + )