{
  "info": {
    "description": "API endpoints for content_provenance module in EnactServices",
    "title": "Content Provenance API",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://api.synthesia.io"
    }
  ],
  "paths": {
    "/watermarking/videos": {
      "post": {
        "tags": [
          "Video verification"
        ],
        "summary": "Create a verification request and upload form",
        "operationId": "createWatermarkVerification",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload request created; keep accessToken private",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedVerificationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or CAPTCHA",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "404": {
            "description": "Verification API disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "413": {
            "description": "File too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "429": {
            "description": "IP rate limit exceeded; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable or global limit exceeded; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          }
        }
      }
    },
    "/watermarking/videos/{request_id}/submit": {
      "post": {
        "tags": [
          "Video verification"
        ],
        "summary": "Submit an uploaded video for verification",
        "operationId": "submitWatermarkVerification",
        "security": [
          {
            "jobToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Verification accepted; safe to retry the same submission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationResponse"
                }
              }
            }
          },
          "200": {
            "description": "Existing terminal result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing job token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired request, or verification API disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "409": {
            "description": "Upload not ready; complete the upload before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "413": {
            "description": "Uploaded file too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "429": {
            "description": "IP rate limit exceeded; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable or global limit exceeded; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          }
        }
      }
    },
    "/watermarking/videos/{request_id}": {
      "get": {
        "tags": [
          "Video verification"
        ],
        "summary": "Read verification progress or result",
        "operationId": "getWatermarkVerification",
        "security": [
          {
            "jobToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current state, completed result or processing error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing job token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired request, or verification API disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "429": {
            "description": "IP rate limit exceeded; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; honor Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAPIError"
                }
              }
            }
          }
        }
      }
    },
    "/watermarking/openapi.json": {
      "get": {
        "tags": [
          "Video verification"
        ],
        "summary": "Download the generated verification API contract",
        "operationId": "getWatermarkVerificationOpenAPI",
        "security": [],
        "responses": {
          "200": {
            "description": "Generated OpenAPI contract",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Verification API disabled"
          },
          "429": {
            "description": "IP rate limit exceeded; honor Retry-After"
          },
          "503": {
            "description": "Temporarily unavailable; honor Retry-After"
          }
        }
      }
    }
  },
  "openapi": "3.0.2",
  "components": {
    "schemas": {
      "CreateVerificationRequest": {
        "additionalProperties": false,
        "properties": {
          "contentType": {
            "enum": [
              "video/mp4",
              "video/quicktime",
              "video/webm"
            ],
            "title": "Contenttype",
            "type": "string"
          },
          "contentLength": {
            "maximum": 5368709120,
            "minimum": 1,
            "title": "Contentlength",
            "type": "integer"
          },
          "captchaToken": {
            "default": null,
            "title": "Captchatoken",
            "maxLength": 2048,
            "minLength": 1,
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "contentType",
          "contentLength"
        ],
        "title": "CreateVerificationRequest",
        "type": "object"
      },
      "VerificationUploadForm": {
        "additionalProperties": false,
        "properties": {
          "method": {
            "title": "Method",
            "type": "string",
            "enum": [
              "POST"
            ],
            "default": "POST"
          },
          "url": {
            "title": "Url",
            "type": "string"
          },
          "expiresAt": {
            "format": "date-time",
            "title": "Expiresat",
            "type": "string"
          },
          "fields": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Fields",
            "type": "object"
          }
        },
        "required": [
          "method",
          "url",
          "expiresAt",
          "fields"
        ],
        "title": "VerificationUploadForm",
        "type": "object"
      },
      "CreatedVerificationResponse": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "state": {
            "title": "State",
            "type": "string",
            "enum": [
              "awaiting_upload"
            ],
            "default": "awaiting_upload"
          },
          "accessToken": {
            "title": "Accesstoken",
            "type": "string"
          },
          "expiresAt": {
            "format": "date-time",
            "title": "Expiresat",
            "type": "string"
          },
          "upload": {
            "$ref": "#/components/schemas/VerificationUploadForm"
          }
        },
        "required": [
          "id",
          "state",
          "accessToken",
          "expiresAt",
          "upload"
        ],
        "title": "CreatedVerificationResponse",
        "type": "object"
      },
      "VerificationAPIError": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "title": "Code",
            "type": "string"
          },
          "context": {
            "title": "Context",
            "type": "string"
          },
          "error": {
            "title": "Error",
            "type": "string"
          }
        },
        "required": [
          "code",
          "context",
          "error"
        ],
        "title": "VerificationAPIError",
        "type": "object"
      },
      "VerificationFailure": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "title": "Code",
            "type": "string"
          },
          "context": {
            "title": "Context",
            "type": "string"
          }
        },
        "required": [
          "code",
          "context"
        ],
        "title": "VerificationFailure",
        "type": "object"
      },
      "VerificationResult": {
        "additionalProperties": false,
        "properties": {
          "verdict": {
            "enum": [
              "verified_synthesia",
              "watermark_detected",
              "invalid_credentials",
              "inconclusive"
            ],
            "title": "Verdict",
            "type": "string"
          },
          "method": {
            "default": null,
            "title": "Method",
            "enum": [
              "c2pa",
              "watermark"
            ],
            "type": "string",
            "nullable": true
          },
          "confidence": {
            "default": null,
            "title": "Confidence",
            "maximum": 1,
            "minimum": 0,
            "type": "number",
            "nullable": true
          },
          "c2paStatus": {
            "enum": [
              "verified",
              "invalid",
              "not_found"
            ],
            "title": "C2Pastatus",
            "type": "string"
          },
          "c2paFailureReason": {
            "default": null,
            "title": "C2Pafailurereason",
            "enum": [
              "content_mismatch",
              "untrusted_signer",
              "invalid_signature",
              "invalid_credential",
              "invalid_manifest"
            ],
            "type": "string",
            "nullable": true
          },
          "watermarkDetection": {
            "default": "not_performed",
            "enum": [
              "matched",
              "not_found",
              "not_performed"
            ],
            "title": "Watermarkdetection",
            "type": "string"
          },
          "generatedAt": {
            "default": null,
            "title": "Generatedat",
            "format": "date-time",
            "type": "string",
            "nullable": true
          },
          "reference": {
            "default": null,
            "title": "Reference",
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "verdict",
          "c2paStatus"
        ],
        "title": "VerificationResult",
        "type": "object"
      },
      "VerificationState": {
        "enum": [
          "awaiting_upload",
          "queued",
          "processing",
          "complete",
          "failed"
        ],
        "title": "VerificationState",
        "type": "string"
      },
      "VerificationResponse": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/VerificationState"
          },
          "expiresAt": {
            "format": "date-time",
            "title": "Expiresat",
            "type": "string"
          },
          "result": {
            "default": null,
            "allOf": [
              {
                "$ref": "#/components/schemas/VerificationResult"
              }
            ],
            "nullable": true
          },
          "error": {
            "default": null,
            "allOf": [
              {
                "$ref": "#/components/schemas/VerificationFailure"
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "id",
          "state",
          "expiresAt"
        ],
        "title": "VerificationResponse",
        "type": "object"
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization"
      },
      "jobToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Per-request accessToken returned when creating a verification request."
      }
    }
  }
}