{"openapi":"3.1.0","info":{"title":"LivePin Hooks","description":"**Main API docs:** [Swagger](/docs/swagger-ui) · [RapiDoc](/docs/rapidoc-ui) · [Scalar](/docs/scalar-ui)\n\n**SFTPGo docs:** [Swagger](/docs/sftpgo/swagger-ui) · [RapiDoc](/docs/sftpgo/rapidoc-ui) · [Scalar](/docs/sftpgo/scalar-ui)","version":"v1"},"servers":[{"url":"/hooks"}],"paths":{"/sftpgo/post-upload":{"post":{"tags":["Hooks"],"summary":"Record a finished upload","description":"`SFTPGo` calls this after a file is written; the upload is marked completed, or failed if the transfer failed.","operationId":"web_server.routes.hooks.sftpgo_post_upload","requestBody":{"description":"Extract json format data from request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.routes.hooks.SftpgoUploadEvent"}}}},"responses":{"200":{"description":"Upload recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.routes.hooks.HookAck"}}}},"400":{"description":"Not an upload event, or the path does not match `/uploads/<imei>/CH_<channel>/<video_id>/<file>`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"404":{"description":"No upload at this path is waiting to finish","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"413":{"description":"The request body is larger than 16 KiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}}}}},"/sftpgo/pre-upload":{"post":{"tags":["Hooks"],"summary":"Authorise an upload","description":"`SFTPGo` calls this before a file is written; any answer but 200 makes it refuse the write.","operationId":"web_server.routes.hooks.sftpgo_pre_upload","requestBody":{"description":"Extract json format data from request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.routes.hooks.SftpgoPreUploadEvent"}}}},"responses":{"200":{"description":"Write allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.routes.hooks.HookAck"}}}},"400":{"description":"Not a pre-upload event, or the path does not match `/uploads/<imei>/CH_<channel>/<video_id>/<file>`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"404":{"description":"No upload is waiting at this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"413":{"description":"The request body is larger than 16 KiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}}}}},"/sftpgo/rename":{"post":{"tags":["Hooks"],"summary":"Record a renamed upload","description":"`SFTPGo` calls this after a file is renamed; the upload keeps the file's new name.","operationId":"web_server.routes.hooks.sftpgo_rename","requestBody":{"description":"Extract json format data from request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.routes.hooks.SftpgoRenameEvent"}}}},"responses":{"200":{"description":"New name recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.routes.hooks.HookAck"}}}},"400":{"description":"Not a rename event, or the new path does not match `/uploads/<imei>/CH_<channel>/<video_id>/<file>`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"404":{"description":"No upload at this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"413":{"description":"The request body is larger than 16 KiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/web_server.middlewares.ApiError"}}}}}}}},"components":{"schemas":{"web_server.middlewares.ApiError":{"type":"object","description":"Error response body\n\nEvery `4xx`/`5xx` from the API carries this body.","required":["status","error"],"properties":{"error":{"type":"string","description":"What went wrong, in a sentence"},"status":{"type":"integer","format":"uint16","description":"HTTP status code, repeated from the response","minimum":0}}},"web_server.routes.hooks.HookAck":{"type":"object","description":"Hook accepted","required":["status"],"properties":{"status":{"type":"string","description":"Always `\"ok\"`","examples":["ok"]}}},"web_server.routes.hooks.SftpgoPreUploadEvent":{"type":"object","description":"An `SFTPGo` pre-upload event","required":["action","virtual_path"],"properties":{"action":{"type":"string","description":"Must be `\"pre-upload\"`","examples":["pre-upload"]},"virtual_path":{"type":"string","description":"Where the file is going: `/uploads/<imei>/CH_<channel>/<video_id>/<file>`","examples":["/uploads/018200000001/CH_1/66fe5c2a9b1e8a3f4c2d1e0b/clip.mp4.temp"]}}},"web_server.routes.hooks.SftpgoRenameEvent":{"type":"object","description":"An `SFTPGo` rename event","required":["action","virtual_path","virtual_target_path"],"properties":{"action":{"type":"string","description":"Must be `\"rename\"`","examples":["rename"]},"virtual_path":{"type":"string","description":"The file's old path; only logged","examples":["/uploads/018200000001/CH_1/66fe5c2a9b1e8a3f4c2d1e0b/clip.mp4.temp"]},"virtual_target_path":{"type":"string","description":"The file's new path: `/uploads/<imei>/CH_<channel>/<video_id>/<file>`","examples":["/uploads/018200000001/CH_1/66fe5c2a9b1e8a3f4c2d1e0b/clip.mp4"]}}},"web_server.routes.hooks.SftpgoUploadEvent":{"type":"object","description":"An `SFTPGo` upload (write finished) event","required":["action","virtual_path","file_size","status"],"properties":{"action":{"type":"string","description":"Must be `\"upload\"`","examples":["upload"]},"file_size":{"type":"integer","format":"int64","description":"Size of the written file, in bytes"},"status":{"type":"integer","format":"int32","description":"`SFTPGo`'s transfer status: `1` succeeded, anything else failed","examples":[1]},"virtual_path":{"type":"string","description":"Where the file was written: `/uploads/<imei>/CH_<channel>/<video_id>/<file>`","examples":["/uploads/018200000001/CH_1/66fe5c2a9b1e8a3f4c2d1e0b/clip.mp4.temp"]}}}}}}