{
  "openapi": "3.0.1",
  "info": {
    "title": "Transkribus API",
    "description": "The API accepts single images as base64-encoded string or by http(s) URLs in a `POST` request and turns them into structured text using Transkribus text recognition technology. Each job's response includes a `processId` that can be used to poll its status and retrieve the result.<br/><br/>You can apply any of your models trained in Transkribus as well as all public models by setting its `htrId` in the `JobConfig` section of the initial `POST` request. A list of public models including their ID can be found on the [Transkribus website](https://www.transkribus.org/models).<br/><br/>The API accepts the image MIME-types `image/jpeg`, `image/tiff` and `image/png` and file sizes up to 20 megabyte.",
    "termsOfService": "https://readcoop.eu/terms-and-conditions/",
    "contact": {
      "email": "help@transkribus.org"
    },
    "version": "2.0.0"
  },
  "servers": [
    {
      "url": "https://api-staging.transkribus.org",
      "description": "Current server"
    }
  ],
  "tags": [
    {
      "name": "Transkribus API",
      "x-displayName": "Recognise text",
      "description": "## How to process a document\n\n1. **Submit**: `POST /v2/processes` with your image and HTR model ID. The response contains a `processId` and HATEOAS links.\n2. **Check status**: Two options:\n   - `GET /v2/processes/{processId}` returns the current status immediately. Poll this on an interval until the status is `FINISHED`, `FAILED`, or `CANCELLED`.\n   - `GET /v2/processes/longpoll/{processId}` waits until the status changes, then returns. Repeat on 408 timeout. The `longpoll` link in the response disappears once the job is terminal; its absence is the signal to stop.\n3. **Download**: Once finished, retrieve results via:\n   - `GET /v2/processes/{processId}/result`: ZIP archive\n   - `GET /v2/processes/{processId}/page`: PAGE XML\n\n> **Tip:** Use the `rel` field of HATEOAS links as the stable identifier, not `title`. Link titles are display text and may change.\n\n```javascript\n// 1. Submit a job\nconst imageBase64 = '<base64-encoded-image>';\nconst createRes = await fetch('https://api-staging.transkribus.org/v2/processes', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer <token>', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ config: { textRecognition: { htrId: 38230 } }, image: { base64: imageBase64 } })\n});\nlet job = await createRes.json();\nconst { processId } = job;\n\n// 2a. Option A, plain polling: call the status endpoint on an interval\nconst POLL_INTERVAL_MS = 5000;\nconst TERMINAL = new Set(['FINISHED', 'FAILED', 'CANCELLED']);\nwhile (!TERMINAL.has(job.status)) {\n  await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS));\n  job = await fetch(`https://api-staging.transkribus.org/v2/processes/${processId}`, {\n    headers: { 'Authorization': 'Bearer <token>' }\n  }).then(r => r.json());\n}\n\n// 2b. Option B, longpoll: follow the longpoll link, which waits until the status changes.\n//     The link disappears once the job reaches a terminal state.\nlet longpollLink = job.links.find(l => l.rel === 'longpoll');\nwhile (longpollLink) {\n  job = await fetch(longpollLink.href, {\n    headers: { 'Authorization': 'Bearer <token>' }\n  }).then(r => r.json());\n  longpollLink = job.links.find(l => l.rel === 'longpoll');\n}\n\n// 3. Job is terminal. Follow the result link if present (only on FINISHED)\nconst resultLink = job.links.find(l => l.rel === 'result');\nif (resultLink) {\n  const result = await fetch(resultLink.href, { headers: { 'Authorization': 'Bearer <token>' } });\n  console.log(await result.json());\n}\n```"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v2/processes": {
      "post": {
        "tags": [
          "Transkribus API"
        ],
        "summary": "Submit a text recognition job for a single image (base64 or URL)",
        "operationId": "startProcessing",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "curl",
            "source": "curl -X POST https://api-staging.transkribus.org/v2/processes \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"config\": { \"type\": \"smartextract\", \"provider\": \"donut\", \"modelId\": 607929 },\n    \"image\": { \"imageUrl\": \"https://example.org/scan.jpg\" }\n  }'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nresp = requests.post(\n    \"https://api-staging.transkribus.org/v2/processes\",\n    headers={\"Authorization\": f\"Bearer {access_token}\"},\n    json={\n        \"config\": {\"type\": \"smartextract\", \"provider\": \"donut\", \"modelId\": 607929},\n        \"image\": {\"imageUrl\": \"https://example.org/scan.jpg\"},\n    },\n)\nresp.raise_for_status()\nprocess_id = resp.json()[\"processId\"]"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch('https://api-staging.transkribus.org/v2/processes', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer ' + accessToken,\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    config: { type: 'smartextract', provider: 'donut', modelId: 607929 },\n    image: { imageUrl: 'https://example.org/scan.jpg' }\n  })\n});\nconst { processId } = await res.json();"
          }
        ],
        "requestBody": {
          "description": "The image, the job configuration and optional layout information",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessingRequestRepresentation"
              },
              "examples": {
                "base64Image": {
                  "summary": "Image as base64",
                  "description": "Provide the image as a base64-encoded string.",
                  "value": {
                    "config": {
                      "type": "smartextract",
                      "provider": "donut",
                      "modelId": 607929
                    },
                    "image": {
                      "base64": "/9j/4AAQSkZJRgABAQEASABIAAD..."
                    }
                  }
                },
                "urlImage": {
                  "summary": "Image by URL",
                  "description": "Provide a URL to a publicly reachable image file instead of embedding the data.",
                  "value": {
                    "config": {
                      "type": "smartextract",
                      "provider": "donut",
                      "modelId": 607929
                    },
                    "image": {
                      "imageUrl": "https://example.org/scan.jpg"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The request was accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessingResponseRepresentation"
                },
                "example": {
                  "processId": 47725,
                  "status": "CREATED",
                  "links": [
                    {
                      "rel": "status",
                      "href": "https://api-staging.transkribus.org/v2/processes/01927669-f207-7550-ba9f-05a14a5cb899",
                      "title": "Status"
                    },
                    {
                      "rel": "longpoll",
                      "href": "https://api-staging.transkribus.org/v2/processes/longpoll/01927669-f207-7550-ba9f-05a14a5cb899",
                      "title": "Status Longpoll"
                    },
                    {
                      "rel": "create",
                      "href": "https://api-staging.transkribus.org/v2/processes",
                      "title": "Create Job",
                      "method": "POST"
                    }
                  ]
                }
              }
            },
            "links": {
              "PollStatus": {
                "operationId": "getProcessingStatus",
                "parameters": {
                  "processId": "$response.body#/processId"
                },
                "description": "Use the `processId` from the response to check job status."
              },
              "LongPollStatus": {
                "operationId": "longPollProcessingStatus",
                "parameters": {
                  "processId": "$response.body#/processId"
                },
                "description": "Long-poll for status waits until the job reaches a terminal state. Repeat on 408 timeout."
              },
              "DownloadResultArchive": {
                "operationId": "getProcessingResultArchive",
                "parameters": {
                  "processId": "$response.body#/processId"
                },
                "description": "Download the result ZIP once the job is FINISHED."
              },
              "DownloadPageXml": {
                "operationId": "getPageXmlProcessingResult",
                "parameters": {
                  "processId": "$response.body#/processId"
                },
                "description": "Retrieve the result as PAGE XML once the job is FINISHED."
              }
            }
          },
          "400": {
            "description": "The request body is malformed or misses information.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "statusCode": 400,
                  "reasonPhrase": "Bad Request",
                  "message": "The processing request's textRecognition config does not include a htrId"
                }
              }
            }
          },
          "401": {
            "description": "The request is not authorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "statusCode": 401,
                  "reasonPhrase": "Unauthorized",
                  "message": "The request is not authorized"
                }
              }
            }
          },
          "404": {
            "description": "A referenced entity in the request does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "statusCode": 404,
                  "reasonPhrase": "Not Found",
                  "message": "A HTR model with ID = x does not exist"
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeds a limit applying to the used account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "statusCode": 429,
                  "reasonPhrase": "Too Many Requests",
                  "message": "Your processing volume is depleted."
                }
              }
            }
          }
        }
      }
    },
    "/v2/processes/{processId}": {
      "get": {
        "tags": [
          "Transkribus API"
        ],
        "summary": "Get the status of a job, identified by its processId",
        "operationId": "getProcessingStatus",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "curl",
            "source": "curl https://api-staging.transkribus.org/v2/processes/$PROCESS_ID \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nresp = requests.get(\n    f\"https://api-staging.transkribus.org/v2/processes/{process_id}\",\n    headers={\"Authorization\": f\"Bearer {access_token}\"},\n)\njob = resp.json()\nprint(job[\"status\"])"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const job = await fetch('https://api-staging.transkribus.org/v2/processes/' + processId, {\n  headers: { 'Authorization': 'Bearer ' + accessToken }\n}).then(r => r.json());\nconsole.log(job.status);"
          }
        ],
        "parameters": [
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "The UUID (v7) or integer processId of the job",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request was accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessingResponseRepresentation"
                },
                "example": {
                  "processId": 3866314,
                  "status": "FINISHED",
                  "content": {
                    "text": "Eisenschrott",
                    "regions": [
                      {
                        "id": "region_1",
                        "coords": {
                          "points": "0,0 282,0 280,109 0,108"
                        },
                        "lines": [
                          {
                            "id": "line_1",
                            "coords": {
                              "points": "0,109 55,89 79,91 96,106 131,100 152,109 196,75 243,73 254,82 281,70 281,13 242,11 228,-1 173,15 146,3 98,13 65,-2 1,8"
                            },
                            "baseline": {
                              "points": "6,64 276,65"
                            },
                            "text": "Eisenschrott"
                          }
                        ]
                      }
                    ]
                  },
                  "links": [
                    {
                      "rel": "self",
                      "href": "https://api-staging.transkribus.org/v2/processes/01927669-f207-7550-ba9f-05a14a5cb899",
                      "title": "Status"
                    },
                    {
                      "rel": "result",
                      "href": "https://api-staging.transkribus.org/v2/processes/01927669-f207-7550-ba9f-05a14a5cb899/result",
                      "title": "Multiple Pages Result"
                    },
                    {
                      "rel": "cancel",
                      "href": "https://api-staging.transkribus.org/v2/processes/01927669-f207-7550-ba9f-05a14a5cb899/cancel",
                      "title": "Cancel",
                      "method": "POST"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request body is malformed or misses information.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The request is not authorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "A referenced entity in the request does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v2/processes/longpoll/{processId}": {
      "get": {
        "tags": [
          "Transkribus API"
        ],
        "summary": "Long-poll for job status",
        "description": "Waits until the job status changes to a terminal state (FINISHED, FAILED, CANCELLED) or until the polling timeout expires. Returns the same response shape as `GET /v2/processes/{processId}`. Prefer this over repeated polling for efficient status tracking.",
        "operationId": "longPollProcessingStatus",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "curl",
            "source": "curl https://api-staging.transkribus.org/v2/processes/longpoll/$PROCESS_ID \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nTERMINAL = {\"FINISHED\", \"FAILED\", \"CANCELLED\"}\nwhile True:\n    resp = requests.get(\n        f\"https://api-staging.transkribus.org/v2/processes/longpoll/{process_id}\",\n        headers={\"Authorization\": f\"Bearer {access_token}\"},\n        timeout=120,\n    )\n    if resp.status_code == 408:\n        continue  # no status change within the window; just repeat\n    job = resp.json()\n    if job[\"status\"] in TERMINAL:\n        break"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const TERMINAL = new Set(['FINISHED', 'FAILED', 'CANCELLED']);\nlet job;\ndo {\n  const res = await fetch('https://api-staging.transkribus.org/v2/processes/longpoll/' + processId, {\n    headers: { 'Authorization': 'Bearer ' + accessToken }\n  });\n  if (res.status === 408) continue; // timeout, repeat the request\n  job = await res.json();\n} while (!job || !TERMINAL.has(job.status));"
          }
        ],
        "parameters": [
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "The UUID (v7) or integer processId of the job",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Polling interval in milliseconds",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job reached a terminal status within the polling window",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessingResponseRepresentation"
                }
              }
            }
          },
          "401": {
            "description": "The request is not authorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No job found for the given processId.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Request timeout: no status change detected within the polling interval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v2/processes/{processId}/result": {
      "get": {
        "tags": [
          "Transkribus API"
        ],
        "summary": "Download result archive for a job",
        "description": "Downloads a ZIP archive containing the result files for a finished job.",
        "operationId": "getProcessingResultArchive",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "curl",
            "source": "curl -o result.zip https://api-staging.transkribus.org/v2/processes/$PROCESS_ID/result \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nresp = requests.get(\n    f\"https://api-staging.transkribus.org/v2/processes/{process_id}/result\",\n    headers={\"Authorization\": f\"Bearer {access_token}\"},\n)\nresp.raise_for_status()\nwith open(\"result.zip\", \"wb\") as f:\n    f.write(resp.content)"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const res = await fetch('https://api-staging.transkribus.org/v2/processes/' + processId + '/result', {\n  headers: { 'Authorization': 'Bearer ' + accessToken }\n});\nconst zip = await res.arrayBuffer();"
          }
        ],
        "parameters": [
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "The UUID (v7) or integer processId of the job",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result archive for the process",
            "content": {
              "application/zip": {}
            }
          },
          "401": {
            "description": "The request is not authorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No result found for the given processId.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v2/processes/{processId}/alto": {
      "get": {
        "tags": [
          "Transkribus API"
        ],
        "summary": "Get the job result as ALTO XML",
        "description": "Retrieves the result of a job, identified by its processId, as ALTO XML.",
        "operationId": "getAltoProcessingResult",
        "parameters": [
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "The UUID (v7) or integer processId of the job",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result as ALTO XML",
            "content": {
              "application/xml": {}
            }
          },
          "401": {
            "description": "The request is not authorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The processId does not exist or the result is not yet available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v2/processes/{processId}/page": {
      "get": {
        "tags": [
          "Transkribus API"
        ],
        "summary": "Get the job result as PAGE XML",
        "description": "Retrieves the result of a job, identified by its processId, as PAGE XML (PRImA 2013-07-15 schema).",
        "operationId": "getPageXmlProcessingResult",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "curl",
            "source": "curl https://api-staging.transkribus.org/v2/processes/$PROCESS_ID/page \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\" > page.xml"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nresp = requests.get(\n    f\"https://api-staging.transkribus.org/v2/processes/{process_id}/page\",\n    headers={\"Authorization\": f\"Bearer {access_token}\"},\n)\nresp.raise_for_status()\npage_xml = resp.text"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const pageXml = await fetch('https://api-staging.transkribus.org/v2/processes/' + processId + '/page', {\n  headers: { 'Authorization': 'Bearer ' + accessToken }\n}).then(r => r.text());"
          }
        ],
        "parameters": [
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "The UUID (v7) or integer processId of the job",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result as PAGE XML",
            "content": {
              "application/xml": {}
            }
          },
          "401": {
            "description": "The request is not authorized.",
            "content": {
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The processId does not exist or the result is not yet available.",
            "content": {
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer",
            "format": "int32"
          },
          "reasonPhrase": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Baseline": {
        "type": "object",
        "properties": {
          "points": {
            "pattern": "^(\\d,\\d \\d,\\d){1} (\\d,\\d)*$",
            "type": "string",
            "description": "The pixel coordinates of the baseline's vertices"
          }
        },
        "description": "A line's baseline, i.e. the line on which the letters sit"
      },
      "JobConfig": {
        "type": "object",
        "properties": {
          "lineDetection": {
            "$ref": "#/components/schemas/LineDetectionConfig"
          },
          "textRecognition": {
            "required": [
              "htrId"
            ],
            "type": "object",
            "properties": {
              "languageModel": {
                "type": "string",
                "description": "Enables a language model for generating the transcription",
                "enum": [
                  "built-in"
                ]
              },
              "htrId": {
                "type": "integer",
                "description": "ID of the Transkribus HTR model to apply",
                "format": "int32"
              }
            },
            "additionalProperties": {
              "type": "object"
            }
          }
        },
        "description": "Specifies how the submitted image shall be processed"
      },
      "Content": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "regions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Region"
            }
          }
        },
        "description": "Optional preliminary layout information"
      },
      "Coords": {
        "type": "object",
        "properties": {
          "points": {
            "pattern": "^(\\d,\\d \\d,\\d \\d,\\d){1} (\\d,\\d)*$",
            "type": "string",
            "description": "The pixel coordinates of the element's vertices"
          }
        },
        "description": "The bounding polygon of a layout element"
      },
      "TextRecognitionConfig": {
        "required": [
          "htrId"
        ],
        "type": "object",
        "properties": {
          "languageModel": {
            "type": "string",
            "description": "Enables a language model for generating the transcription",
            "enum": [
              "built-in"
            ]
          },
          "htrId": {
            "type": "integer",
            "description": "ID of the Transkribus HTR model to apply",
            "format": "int32"
          }
        },
        "additionalProperties": {
          "type": "object"
        }
      },
      "LineDetectionConfig": {
        "type": "object",
        "properties": {
          "modelId": {
            "type": "integer",
            "description": "ID of the Transkribus layout model to apply if no lines were passed in the content section. The field name lineDetection is historical; the models are layout models producing baselines, regions and reading order.",
            "format": "int32"
          },
          "minimalBaselineLength": {
            "type": "integer",
            "description": "Minimal baseline length for the layout analysis - detected baselines below this length are dropped",
            "format": "int32"
          },
          "baselineAccuracyThreshold": {
            "maximum": 255,
            "minimum": 0,
            "type": "integer",
            "description": "Baseline accuracy threshold. The threshold for binarization of the baseline mask images. Higher values enforce higher accuracy in the detected baselines. Ranges between 0 and 255.",
            "format": "int32"
          },
          "maxDistForMerging": {
            "type": "integer",
            "description": "Max-dist for merging. The maximal distance between two baselines to be merged.",
            "format": "int32"
          },
          "numTextRegions": {
            "type": "number",
            "description": "Number of text regions. One: -1, Few: 1.6, Medium: 1.0, Many: 0.4",
            "format": "float"
          }
        }
      },
      "Job": {
        "required": [
          "processId",
          "status"
        ],
        "type": "object",
        "properties": {
          "processId": {
            "type": "integer",
            "description": "The integer ID of the job, used to query its status and results",
            "format": "int32"
          },
          "uuid": {
            "type": "string",
            "description": "The UUID (v7) of the associated processing job"
          },
          "status": {
            "type": "string",
            "description": "The status of the associated processing job",
            "enum": [
              "CREATED",
              "WAITING",
              "RUNNING",
              "FINISHED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "config": {
            "$ref": "#/components/schemas/JobConfig"
          },
          "content": {
            "$ref": "#/components/schemas/Content"
          },
          "links": {
            "type": "array",
            "description": "HATEOAS navigation links. Use `rel`, not `title`, as the stable machine-readable identifier. `title` is display text only and may change. The `longpoll` link is present only while the job is non-terminal; its absence signals completion.",
            "items": {
              "$ref": "#/components/schemas/Link"
            }
          }
        },
        "description": "A job and its current status"
      },
      "Link": {
        "type": "object",
        "required": [
          "rel",
          "href",
          "title"
        ],
        "properties": {
          "rel": {
            "type": "string",
            "description": "Link relation type. `self` = canonical URL of this resource. `longpoll` = waits until status changes, present only while non-terminal. `result` / `page-result` = downloadable output. `status` = status URL as a related link. `collection` = the jobs list. `create` = submit a new job. `cancel` = cancel this job.",
            "enum": [
              "self",
              "collection",
              "status",
              "longpoll",
              "page-result",
              "result",
              "create",
              "cancel"
            ]
          },
          "href": {
            "type": "string",
            "description": "The absolute URL of the linked resource or operation."
          },
          "title": {
            "type": "string",
            "description": "Human-readable name identifying the link target (e.g. `Status`, `Status Longpoll`, `Multiple Pages Result`, `Cancel`)."
          },
          "method": {
            "type": "string",
            "description": "HTTP method to use when following this link. Omitted for GET links.",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "DELETE",
              "PATCH"
            ]
          }
        }
      },
      "TextLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identifier for this layout element. If set in a request it will be persisted for later reference in the response. If none is set, a value will be generated."
          },
          "coords": {
            "$ref": "#/components/schemas/Coords"
          },
          "baseline": {
            "$ref": "#/components/schemas/Baseline"
          },
          "text": {
            "type": "string"
          },
          "words": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Word"
            }
          }
        }
      },
      "Region": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identifier for this layout element. If set in a request it will be persisted for later reference in the response. If none is set, a value will be generated."
          },
          "coords": {
            "$ref": "#/components/schemas/Coords"
          },
          "orientation": {
            "maximum": 180,
            "minimum": -180,
            "exclusiveMinimum": true,
            "type": "number",
            "description": "The angle the rectangle encapsulating the page (or its Border) has to be rotated in clockwise direction in order to correct the present skew (negative values indicate anti-clockwise rotation).",
            "format": "float"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TextLine"
            }
          }
        }
      },
      "Word": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identifier for this layout element. If set in a request it will be persisted for later reference in the response. If none is set, a value will be generated."
          },
          "coords": {
            "$ref": "#/components/schemas/Coords"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "Image": {
        "maxProperties": 1,
        "type": "object",
        "properties": {
          "base64": {
            "type": "string",
            "description": "base64-encoded image data",
            "format": "base64"
          },
          "imageUrl": {
            "type": "string",
            "description": "URL to a hosted image file",
            "format": "url"
          }
        },
        "description": "The image to process: either the base64-encoded binary data or a reference to a publicly available image"
      },
      "JobRequest": {
        "required": [
          "config",
          "image"
        ],
        "type": "object",
        "properties": {
          "config": {
            "$ref": "#/components/schemas/JobConfig"
          },
          "content": {
            "$ref": "#/components/schemas/Content"
          },
          "image": {
            "$ref": "#/components/schemas/Image"
          }
        },
        "description": "Request data for a single-image job"
      },
      "ProcessingRequestRepresentation": {
        "required": [
          "config",
          "image"
        ],
        "type": "object",
        "properties": {
          "config": {
            "$ref": "#/components/schemas/ConfigRepresentation"
          },
          "content": {
            "$ref": "#/components/schemas/Content"
          },
          "image": {
            "$ref": "#/components/schemas/Image"
          }
        },
        "description": "Request data for a single-image processing job"
      },
      "ConfigRepresentation": {
        "type": "object",
        "properties": {
          "lineDetection": {
            "$ref": "#/components/schemas/LineDetectionConfig"
          },
          "textRecognition": {
            "$ref": "#/components/schemas/TextRecognitionConfig"
          }
        },
        "description": "Specifies how the submitted image shall be processed"
      },
      "ProcessingResponseRepresentation": {
        "required": [
          "processId",
          "status"
        ],
        "type": "object",
        "properties": {
          "processId": {
            "type": "integer",
            "description": "The integer ID of the job",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "description": "The status of the job",
            "enum": [
              "CREATED",
              "WAITING",
              "RUNNING",
              "FINISHED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "content": {
            "$ref": "#/components/schemas/Content"
          },
          "links": {
            "type": "array",
            "description": "HATEOAS navigation links. Use `rel`, not `title`, as the stable machine-readable identifier.",
            "items": {
              "$ref": "#/components/schemas/LinkRepresentation"
            }
          }
        },
        "description": "Response shape for a processing job"
      },
      "LinkRepresentation": {
        "type": "object",
        "required": [
          "rel",
          "href",
          "title"
        ],
        "properties": {
          "rel": {
            "type": "string",
            "description": "Link relation type."
          },
          "href": {
            "type": "string",
            "description": "The absolute URL of the linked resource."
          },
          "title": {
            "type": "string",
            "description": "Human-readable name for the link target."
          },
          "method": {
            "type": "string",
            "description": "HTTP method to use when following this link. Omitted for GET links.",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "DELETE",
              "PATCH"
            ]
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}
