{
  "openapi": "3.0.1",
  "info": {
    "title": "CopySeal API",
    "description": "Invisible watermark embedding and extraction for images AND PDFs. The watermark is written into the frequency domain (DWT-DCT-SVD), so it is invisible to the eye but survives JPEG compression, cropping, rotation, scaling and PDF re-encoding. The API is served under the site's /api path, which proxies to the backend; authenticate every request with an API key in the X-Api-Key header.",
    "version": "1.0.0",
    "contact": {
      "name": "CopySeal support",
      "email": "support@copyseal.online",
      "url": "https://www.copyseal.online/contact"
    }
  },
  "servers": [
    {
      "url": "https://www.copyseal.online/api",
      "description": "CopySeal API (same-origin proxy to the backend)"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "API key issued from the dashboard (Settings > API keys). The backend also accepts a session cookie for browser clients."
      }
    },
    "schemas": {
      "EmbedResult": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "description": "Identifier of the stored result" },
          "file_type": { "type": "string", "enum": ["image", "pdf"] },
          "wm_shape": {
            "type": "integer",
            "nullable": true,
            "description": "Key needed to extract the watermark from an image. Null for PDFs."
          },
          "key_id": {
            "type": "string",
            "nullable": true,
            "description": "PDF watermark key id. Null for images."
          },
          "pages_marked": { "type": "integer", "nullable": true },
          "page_count": { "type": "integer", "nullable": true },
          "frame": { "type": "string", "nullable": true },
          "watermark_content": { "type": "string" },
          "download_url": { "type": "string" },
          "expires_at": { "type": "string", "nullable": true }
        }
      },
      "BatchJob": {
        "type": "object",
        "properties": {
          "job_id": { "type": "string" },
          "batch_id": { "type": "string" },
          "total_files": { "type": "integer" },
          "status": { "type": "string", "enum": ["processing", "completed"] }
        }
      },
      "BatchStatus": {
        "type": "object",
        "properties": {
          "job_id": { "type": "string" },
          "status": { "type": "string" },
          "total": { "type": "integer" },
          "completed": { "type": "integer" },
          "failed": { "type": "integer" },
          "results": { "type": "array", "items": { "type": "object" } },
          "errors": { "type": "array", "items": { "type": "object" } }
        }
      },
      "EmbedJob": {
        "type": "object",
        "properties": {
          "job_id": { "type": "string" },
          "poll_url": { "type": "string" }
        }
      },
      "EmbedJobStatus": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["processing", "completed", "failed"] },
          "result": {
            "allOf": [{ "$ref": "#/components/schemas/EmbedResult" }],
            "nullable": true
          },
          "error": { "type": "string", "nullable": true }
        }
      },
      "UploadTicket": {
        "type": "object",
        "properties": {
          "upload_path": { "type": "string", "description": "Path the bytes are PUT to, relative to the backend: /upload." },
          "upload_ticket": { "type": "string", "description": "Upload ticket, valid for five minutes. Send it in the X-Upload-Ticket header of the PUT." },
          "blob_key": { "type": "string", "description": "Storage key the ticket authorizes. Send it back as file_key." },
          "backend_upload_url": { "type": "string", "description": "Absolute URL to PUT the bytes to. Added by the site's proxy, because the upload endpoint is served by the backend and not by the proxy." }
        }
      },
      "UploadResult": {
        "type": "object",
        "properties": {
          "url": { "type": "string", "description": "Canonical URL of the stored blob." },
          "blob_key": { "type": "string", "description": "Storage key the bytes were stored under. Either this or the url can be sent back as file_key." }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "detail": { "type": "string" }
        }
      }
    }
  },
  "paths": {
    "/embed": {
      "post": {
        "summary": "Embed an invisible watermark",
        "description": "Embeds an invisible watermark into an image or a PDF. The Content-Type decides the carrier: image/* for images, application/pdf for PDFs. For a PDF the watermark text is optional (a tracer-only payload is accepted). Embedding a PDF can take more than five minutes, past the request timeout of the site's proxy — use /embed/async for PDFs. The watermark passwords are generated by the server per request and resolved again from the account on extraction, so there is nothing to send and nothing to keep.",
        "operationId": "embedWatermark",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Image (PNG, JPG, JPEG, WEBP) or PDF to watermark. Mutually exclusive with file_key; one of the two is required."
                  },
                  "watermarkText": {
                    "type": "string",
                    "description": "Text to hide in the file (max 400 bytes)"
                  },
                  "file_key": {
                    "type": "string",
                    "description": "Storage key of a file uploaded through /embed/upload-url. Used instead of the file field."
                  },
                  "content_type": {
                    "type": "string",
                    "description": "Content type of the uploaded file, required when file_key is used."
                  },
                  "original_filename": {
                    "type": "string",
                    "description": "Original filename, used to name the download."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Watermark embedded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EmbedResult" }
              }
            }
          },
          "400": {
            "description": "Neither file nor file_key was sent, both were sent, or the upload exceeds the size or page-size cap for the plan",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "The document is too large to watermark. Split it into smaller files and try again.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "415": {
            "description": "Unsupported Content-Type. Use image/* or application/pdf.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Monthly file limit or daily API-call allowance exhausted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/embed/async": {
      "post": {
        "summary": "Embed an invisible watermark into a PDF as a background job",
        "description": "The PDF branch of /embed can take more than five minutes, past the request timeout of the site's proxy, so a PDF embed is kicked off here instead. The file must already be in storage: upload it with /embed/upload-url and send the returned key as file_key. Returns 202 with a job id; poll the returned poll_url until status is \"completed\" (read result) or \"failed\" (read error).",
        "operationId": "embedWatermarkAsync",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file_key", "content_type"],
                "properties": {
                  "file_key": {
                    "type": "string",
                    "description": "blob_key returned by /embed/upload-url"
                  },
                  "content_type": {
                    "type": "string",
                    "enum": ["application/pdf"],
                    "description": "Must be application/pdf. Image embeds belong on the sync /embed route."
                  },
                  "watermarkText": {
                    "type": "string",
                    "description": "Text to hide in the file (max 400 bytes)"
                  },
                  "original_filename": {
                    "type": "string",
                    "description": "Original filename, used to name the download."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Job accepted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EmbedJob" }
              }
            }
          },
          "400": {
            "description": "file_key is missing, or the upload exceeds the size or page-size cap for the plan",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "415": {
            "description": "content_type is missing or is not application/pdf",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Monthly file limit or daily API-call allowance exhausted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/embed/jobs/{jobId}": {
      "get": {
        "summary": "Poll an async PDF embed job",
        "description": "Returns the state of a job started by /embed/async. Poll until status is \"completed\" (then read result) or \"failed\" (then read error). An unknown job id is a 404.",
        "operationId": "getEmbedJob",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Job status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EmbedJobStatus" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Unknown job",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/embed/upload-url": {
      "get": {
        "summary": "Mint an upload ticket for a file",
        "description": "Returns a ticket that authorizes the upload of exactly one storage key, for five minutes. PUT the file bytes to the returned upload URL with the ticket in the X-Upload-Ticket header, then send the url the PUT answered with back as the file_key field of /embed (or /embed/async). The storage credential never leaves the server: the ticket, not a store token, is what the caller holds.",
        "operationId": "getEmbedUploadUrl",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "content_type",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Content type of the file that will be uploaded. A PDF is capped at the plan's PDF size limit, everything else at the image limit."
          }
        ],
        "responses": {
          "200": {
            "description": "Upload ticket issued",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/UploadTicket" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Storage is not configured",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/extract/upload-url": {
      "get": {
        "summary": "Mint an upload ticket for a file to read",
        "description": "The same ticket flow as /embed/upload-url, for the file whose watermark is to be read. PUT the bytes to the returned upload URL with the ticket in the X-Upload-Ticket header, then send the url the PUT answered with back as the file_key field of /extract or /extract/pdf.",
        "operationId": "getExtractUploadUrl",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "content_type",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Content type of the file that will be uploaded."
          }
        ],
        "responses": {
          "200": {
            "description": "Upload ticket issued",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/UploadTicket" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Storage is not configured",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/upload": {
      "put": {
        "summary": "Upload a file with an upload ticket",
        "description": "Stores the request body under the storage key the ticket names. The ticket travels in the X-Upload-Ticket header; it is signed, expires in minutes and authorizes exactly one key. Answers with the canonical URL and the blob key; either one can be sent as the file_key to /embed, /extract, /embed/async or /extract/pdf.",
        "operationId": "uploadFile",
        "security": [],
        "servers": [
          {
            "url": "https://api.copyseal.online",
            "description": "The backend serves this endpoint directly. The site's /api proxy only issues the ticket; the bytes themselves never travel through the proxy, so a large file is not cut off by the proxy's request-size limit. The absolute URL is also returned as backend_upload_url by the upload-url endpoints."
          }
        ],
        "parameters": [
          {
            "name": "X-Upload-Ticket",
            "in": "header",
            "required": true,
            "schema": { "type": "string" },
            "description": "The ticket from /embed/upload-url or /extract/upload-url."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": { "type": "string", "format": "binary" }
            },
            "multipart/form-data": {
              "schema": { "type": "string", "format": "binary" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File stored",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/UploadResult" }
              }
            }
          },
          "400": {
            "description": "Empty upload body",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Invalid or expired upload ticket",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "The file exceeds the size cap for the plan",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "502": {
            "description": "Storage rejected the upload",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a staged upload",
        "description": "Removes a blob the caller staged with an upload ticket. Use it to roll back a file that was uploaded but never used — a request that failed, or was abandoned. The ticket is the credential: it names exactly one key, expires in minutes, and is only ever minted for an input/ key, so the caller can only delete a staging blob it was already authorized to upload to. Deleting an already-deleted blob is not an error.",
        "operationId": "deleteUploadedFile",
        "security": [],
        "servers": [
          {
            "url": "https://api.copyseal.online",
            "description": "The backend serves this endpoint directly, like PUT /upload."
          }
        ],
        "parameters": [
          {
            "name": "X-Upload-Ticket",
            "in": "header",
            "required": true,
            "schema": { "type": "string" },
            "description": "The ticket the file was uploaded with."
          },
          {
            "name": "X-Blob-Key",
            "in": "header",
            "required": false,
            "schema": { "type": "string" },
            "description": "The key the upload answered with, if it differs from the ticket's key (the storage backend may append a suffix)."
          }
        ],
        "responses": {
          "204": {
            "description": "Blob deleted (or was already gone)"
          },
          "401": {
            "description": "Invalid or expired upload ticket",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "502": {
            "description": "The storage backend refused the delete",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/extract": {
      "post": {
        "summary": "Extract an invisible watermark from an image",
        "description": "Reads the watermark back out of a watermarked image. The wmShape returned by /embed is required — it is the key the watermark was written under. The image itself travels either as a multipart file field or as the file_key of a blob uploaded through /extract/upload-url; the two are mutually exclusive, and one of them is required.",
        "operationId": "extractWatermark",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["wmShape"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Watermarked image. Mutually exclusive with file_key; one of the two is required."
                  },
                  "file_key": {
                    "type": "string",
                    "description": "The url (or blob_key) returned by the upload PUT. Used instead of the file field."
                  },
                  "original_filename": {
                    "type": "string",
                    "description": "Original filename, used to name the download. Only meaningful with file_key."
                  },
                  "wmShape": {
                    "type": "integer",
                    "description": "The wm_shape returned by /embed"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Watermark extracted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "watermark_content": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Neither file nor file_key was sent, both were sent, or the file_key does not belong to this account",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "No watermark found for that key, or it belongs to another account",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Monthly file limit or daily API-call allowance exhausted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "502": {
            "description": "The uploaded file could not be fetched from storage. Try uploading again.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/extract/pdf": {
      "post": {
        "summary": "Extract an invisible watermark from a PDF",
        "description": "Reads the watermark back out of a watermarked PDF. The PDF travels either as a multipart file field named \"file\" or as the file_key of a blob uploaded through /extract/upload-url; the two are mutually exclusive, and one of them is required. The Content-Type must be application/pdf — with file_key there is no part to carry it, so send it as the content_type field.",
        "operationId": "extractPdfWatermark",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Watermarked PDF. Mutually exclusive with file_key; one of the two is required."
                  },
                  "file_key": {
                    "type": "string",
                    "description": "The url (or blob_key) returned by the upload PUT. Used instead of the file field."
                  },
                  "content_type": {
                    "type": "string",
                    "description": "Must be application/pdf. Required with file_key, where the multipart part cannot carry the type."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Watermark extracted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_id": { "type": "string" },
                    "frame": { "type": "string", "description": "The carrier frame the payload was written into, F0 to F3." },
                    "page_index": { "type": "integer", "description": "Zero-based index of the page the watermark was found on: the first page of the document is 0, the second is 1." },
                    "plaintext": { "type": "string", "nullable": true }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Neither file nor file_key was sent, both were sent, or the file_key does not belong to this account",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "No watermark found, or no matching key for this account",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "415": {
            "description": "The uploaded file is not application/pdf",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "502": {
            "description": "The uploaded file could not be fetched from storage. Try uploading again.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "The PDF watermark channel is not configured",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/batch/embed": {
      "post": {
        "summary": "Embed invisible watermarks into many files",
        "description": "Starts a background job that watermarks every file with the same watermark text. Images and PDFs may be mixed. Either post the files as multipart parts (files) or name files that are already uploaded with an upload ticket (file_refs) — the second form is what a batch larger than a proxy's request-size limit needs.",
        "operationId": "batchEmbed",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["watermarkText"],
                "properties": {
                  "files": {
                    "type": "array",
                    "items": { "type": "string", "format": "binary" },
                    "description": "Files to watermark. Mutually exclusive with file_refs; send exactly one of the two."
                  },
                  "file_refs": {
                    "type": "string",
                    "description": "A JSON array of references to files that are already uploaded with an upload ticket: [{\"key\": \"<storage key>\", \"filename\": \"sunset.jpg\", \"content_type\": \"image/jpeg\"}, ...]. Use this form when the total size of the files exceeds the request-size limit of an intermediary proxy — the bytes then travel straight to the storage endpoint instead of through the API."
                  },
                  "watermarkText": {
                    "type": "string",
                    "description": "Text to hide in every file (max 400 bytes)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch job accepted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/BatchJob" }
              }
            }
          },
          "400": {
            "description": "No files provided, or the batch is larger than the plan allows",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Batch processing is not available on this plan",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "The batch would exceed the monthly file limit",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/batch/extract": {
      "post": {
        "summary": "Extract invisible watermarks from many files",
        "description": "Starts a background job that reads the watermark back out of every file. The wmShape the files were watermarked with is required. Either post the files as multipart parts (files) or name files that are already uploaded with an upload ticket (file_refs) — the second form is what a batch larger than a proxy's request-size limit needs.",
        "operationId": "batchExtract",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["wmShape"],
                "properties": {
                  "files": {
                    "type": "array",
                    "items": { "type": "string", "format": "binary" },
                    "description": "Watermarked files to read. Mutually exclusive with file_refs; send exactly one of the two."
                  },
                  "file_refs": {
                    "type": "string",
                    "description": "A JSON array of references to files that are already uploaded with an upload ticket: [{\"key\": \"<storage key>\", \"filename\": \"sunset.jpg\", \"content_type\": \"image/jpeg\"}, ...]. Use this form when the total size of the files exceeds the request-size limit of an intermediary proxy — the bytes then travel straight to the storage endpoint instead of through the API."
                  },
                  "wmShape": {
                    "type": "integer",
                    "description": "The wm_shape the files were watermarked with"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch job accepted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/BatchJob" }
              }
            }
          },
          "400": {
            "description": "No files provided, or the batch is larger than the plan allows",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Batch processing is not available on this plan",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "The batch would exceed the monthly file limit",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/batch/embed/upload-url": {
      "get": {
        "summary": "Mint an upload ticket for a file in a batch",
        "description": "Returns a ticket that authorizes the upload of exactly one storage key, for five minutes. PUT the file bytes to the returned upload URL with the ticket in the X-Upload-Ticket header, then collect the url each PUT answered with and send them back as the file_refs field of the batch request. The storage credential never leaves the server: the ticket, not a store token, is what the caller holds.",
        "operationId": "getBatchEmbedUploadUrl",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "content_type",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Content type of the file that will be uploaded. A PDF is capped at the plan's PDF size limit, everything else at the image limit."
          }
        ],
        "responses": {
          "200": {
            "description": "Upload ticket issued",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/UploadTicket" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Storage is not configured",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/batch/extract/upload-url": {
      "get": {
        "summary": "Mint an upload ticket for a file in a batch",
        "description": "Returns a ticket that authorizes the upload of exactly one storage key, for five minutes. PUT the file bytes to the returned upload URL with the ticket in the X-Upload-Ticket header, then collect the url each PUT answered with and send them back as the file_refs field of the batch request. The storage credential never leaves the server: the ticket, not a store token, is what the caller holds.",
        "operationId": "getBatchExtractUploadUrl",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "content_type",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Content type of the file that will be uploaded. A PDF is capped at the plan's PDF size limit, everything else at the image limit."
          }
        ],
        "responses": {
          "200": {
            "description": "Upload ticket issued",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/UploadTicket" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Storage is not configured",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/batch/{jobId}": {
      "get": {
        "summary": "Poll a batch job",
        "operationId": "getBatchJob",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch job status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/BatchStatus" }
              }
            }
          },
          "404": {
            "description": "Unknown job",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    }
  }
}
