{
  "openapi": "3.1.0",
  "info": {
    "title": "AIOG Intelligence Platform",
    "version": "1",
    "summary": "Bilingual Welsh/English intelligence as a neutral machine interface.",
    "description": "The public /v1 contract for the AIOG Intelligence Layer. A client asks for a capability at a quality profile and never learns which provider ran. Generated from the route manifest in @capsiynau/intelligence-contracts; do not edit by hand."
  },
  "servers": [
    {
      "url": "https://api.aiog.co.uk"
    }
  ],
  "tags": [
    {
      "name": "admin"
    },
    {
      "name": "analysis"
    },
    {
      "name": "captions"
    },
    {
      "name": "glossary"
    },
    {
      "name": "language"
    },
    {
      "name": "media"
    },
    {
      "name": "platform"
    },
    {
      "name": "review"
    },
    {
      "name": "search"
    },
    {
      "name": "transcription"
    },
    {
      "name": "translation"
    }
  ],
  "paths": {
    "/v1/health": {
      "get": {
        "operationId": "health.get",
        "summary": "Liveness, auth-configuration and validation-dictionary probe.",
        "tags": [
          "platform"
        ],
        "description": "Serves HEAD as well as GET (the wrapper allows both); a HEAD returns the same status with no body.",
        "security": [],
        "responses": {
          "200": {
            "description": "Live and authentication configured.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "status",
                    "authMode",
                    "validation"
                  ],
                  "properties": {
                    "status": {
                      "const": "ok"
                    },
                    "authMode": {
                      "type": "string",
                      "enum": [
                        "real",
                        "placeholder"
                      ]
                    },
                    "validation": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "dictionary"
                      ],
                      "description": "Whether the Welsh dictionary the validation capability uses loads in this runtime. Exactly loaded or unavailable; never a path, package, version or error.",
                      "properties": {
                        "dictionary": {
                          "type": "string",
                          "enum": [
                            "loaded",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Degraded: authentication is not configured.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "status",
                    "authMode",
                    "validation"
                  ],
                  "properties": {
                    "status": {
                      "const": "degraded"
                    },
                    "reason": {
                      "const": "authentication is not configured"
                    },
                    "authMode": {
                      "type": "string",
                      "enum": [
                        "real",
                        "placeholder"
                      ]
                    },
                    "validation": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "dictionary"
                      ],
                      "description": "Whether the Welsh dictionary the validation capability uses loads in this runtime. Exactly loaded or unavailable; never a path, package, version or error.",
                      "properties": {
                        "dictionary": {
                          "type": "string",
                          "enum": [
                            "loaded",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_INVALID, METHOD_NOT_ALLOWED, INTERNAL_ERROR.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/capabilities": {
      "get": {
        "operationId": "capabilities.get",
        "summary": "List the capabilities this credential may call.",
        "tags": [
          "platform"
        ],
        "security": [
          {
            "credential": []
          }
        ],
        "responses": {
          "200": {
            "description": "Capabilities, quality profiles, and the calling credential.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capabilities",
                    "quality_profiles",
                    "async_capabilities",
                    "credential"
                  ],
                  "properties": {
                    "capabilities": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "name",
                          "async",
                          "scopes",
                          "granted",
                          "status"
                        ],
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "async": {
                            "type": "boolean"
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "granted": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "serving",
                              "degraded",
                              "unavailable",
                              "unknown"
                            ]
                          },
                          "confirmed_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "specialisations": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "welsh": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "status"
                                ],
                                "properties": {
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "serving",
                                      "degraded",
                                      "unavailable",
                                      "unknown"
                                    ]
                                  },
                                  "confirmed_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              }
                            }
                          },
                          "contracts": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "excluded_subprocessors.v1": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "status"
                                ],
                                "properties": {
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "serving",
                                      "degraded",
                                      "unavailable",
                                      "unknown"
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "quality_profiles": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "fast",
                          "accurate",
                          "welsh-broadcast"
                        ]
                      }
                    },
                    "async_capabilities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "credential": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "environment",
                        "scopes",
                        "placeholder"
                      ],
                      "properties": {
                        "environment": {
                          "type": "string"
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "placeholder": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/language/detect": {
      "post": {
        "operationId": "language.detect",
        "summary": "Detect the language of text or per segment.",
        "tags": [
          "language"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Provide either text or segments. Unknown top-level fields are ignored (there is no request-schema validation).",
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 100000
                  },
                  "segments": {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "text"
                      ],
                      "properties": {
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "fallback": {
                    "type": "string",
                    "description": "Fallback language for the segments path. Defaults to cy-GB."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": []
          }
        ],
        "responses": {
          "200": {
            "description": "Detected language (text) or per-segment languages (segments).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "language"
                    },
                    "operation": {
                      "const": "detect"
                    },
                    "language": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "segments": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "usage": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "unit": {
                          "const": "characters"
                        },
                        "amount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/language/normalise": {
      "post": {
        "operationId": "language.normalise",
        "summary": "Normalise Welsh text or per segment.",
        "tags": [
          "language"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Provide either text or segments; other segment keys are preserved. Unknown top-level fields are ignored (there is no request-schema validation).",
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 100000
                  },
                  "segments": {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "text"
                      ],
                      "properties": {
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": []
          }
        ],
        "responses": {
          "200": {
            "description": "Normalised text or per-segment normalised text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "language"
                    },
                    "operation": {
                      "const": "normalise"
                    },
                    "text": {
                      "type": "string"
                    },
                    "segments": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "usage": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "unit": {
                          "const": "characters"
                        },
                        "amount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/index": {
      "post": {
        "operationId": "search.index",
        "summary": "Index documents into the tenant corpus.",
        "tags": [
          "search"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "documents"
                ],
                "properties": {
                  "documents": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "doc_id",
                        "content"
                      ],
                      "properties": {
                        "doc_id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "content": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        },
                        "source": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "metadata": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "search:index"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Documents embedded and stored.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "indexed",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "search"
                    },
                    "operation": {
                      "const": "index"
                    },
                    "indexed": {
                      "type": "integer"
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/query": {
      "post": {
        "operationId": "search.query",
        "summary": "Retrieve the nearest documents to a query.",
        "tags": [
          "search"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "top_k": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20,
                    "default": 5
                  },
                  "threshold": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "default": 0.5
                  },
                  "source": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "search:query"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Nearest documents by similarity.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "results",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "search"
                    },
                    "operation": {
                      "const": "query"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "docId": {
                            "type": "string"
                          },
                          "source": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "content": {
                            "type": "string"
                          },
                          "metadata": {
                            "type": "object"
                          },
                          "similarity": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/captions/validate": {
      "post": {
        "operationId": "captions.validate",
        "summary": "Suggest non-speech caption annotations.",
        "tags": [
          "captions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "segments"
                ],
                "properties": {
                  "segments": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "text"
                      ],
                      "properties": {
                        "text": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "enabled_annotations": {
                    "type": "object",
                    "additionalProperties": true,
                    "properties": {
                      "sound_effects": {
                        "type": "boolean"
                      },
                      "music_cues": {
                        "type": "boolean"
                      },
                      "background_audio": {
                        "type": "boolean"
                      },
                      "speaker_labels": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "captions:analyse"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Suggested annotations.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "suggestions",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "captions"
                    },
                    "operation": {
                      "const": "validate"
                    },
                    "suggestions": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/captions/compliance": {
      "post": {
        "operationId": "captions.compliance",
        "summary": "Pre-publish compliance check for a transcript.",
        "tags": [
          "captions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "transcript_text"
                ],
                "properties": {
                  "transcript_text": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Truncated to 6000 characters in the check, not rejected."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "captions:analyse"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Compliance verdict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "check",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "captions"
                    },
                    "operation": {
                      "const": "compliance"
                    },
                    "check": {
                      "type": "object"
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/captions/live_compliance": {
      "post": {
        "operationId": "captions.liveCompliance",
        "summary": "Live-window compliance check.",
        "tags": [
          "captions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "window_text"
                ],
                "properties": {
                  "window_text": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Truncated to 3000 characters in the check, not rejected."
                  },
                  "strictness": {
                    "type": "string",
                    "enum": [
                      "broadcast",
                      "news",
                      "sport",
                      "general"
                    ],
                    "default": "broadcast"
                  },
                  "window_seconds": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 3600,
                    "default": 30
                  },
                  "language_name": {
                    "type": "string",
                    "default": "English"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "captions:analyse"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Live compliance verdict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "check",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "captions"
                    },
                    "operation": {
                      "const": "live_compliance"
                    },
                    "check": {
                      "type": "object"
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/captions/polish": {
      "post": {
        "operationId": "captions.polish",
        "summary": "Lightly polish subtitle text, block count and ids preserved.",
        "tags": [
          "captions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "segments",
                  "language"
                ],
                "properties": {
                  "segments": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "description": "At most 8000 characters of text across all segments, and at most 9000 UTF-8 bytes once serialised with their ids as JSON (quotes, backslashes and control characters count escaped). Only id and text reach the model.",
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "id",
                        "text"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        }
                      }
                    }
                  },
                  "language": {
                    "type": "string",
                    "description": "en-GB (or en) or cy-*; a Welsh dialect suffix (cy-GB-north, cy-GB-south, ...) is honoured. English polish follows British spelling only."
                  },
                  "register": {
                    "type": "string",
                    "enum": [
                      "broadcast",
                      "standard",
                      "conversational"
                    ],
                    "default": "broadcast",
                    "description": "conversational cannot be combined with the cy-GB-formal dialect."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "captions:analyse"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Polished segments, same ids and order as the request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "segments",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "captions"
                    },
                    "operation": {
                      "const": "polish"
                    },
                    "segments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "text"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/glossaries": {
      "get": {
        "operationId": "glossaries.list",
        "summary": "List approved recogniser-bias terms.",
        "tags": [
          "glossary"
        ],
        "parameters": [
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "BCP-47-shaped language tag."
            }
          },
          {
            "name": "approval",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "auto",
                "admin"
              ],
              "default": "any"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 150
            }
          }
        ],
        "security": [
          {
            "credential": [
              "glossaries:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Approved bias terms, ranked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "terms",
                    "count",
                    "limit",
                    "requestId"
                  ],
                  "properties": {
                    "terms": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/glossaries/verify": {
      "post": {
        "operationId": "glossary.verify",
        "summary": "Advisory verification of a glossary term.",
        "tags": [
          "glossary"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "term"
                ],
                "properties": {
                  "term": {
                    "type": "object",
                    "additionalProperties": true,
                    "required": [
                      "source_term",
                      "preferred_term"
                    ],
                    "properties": {
                      "source_term": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "preferred_term": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    }
                  },
                  "existing_terms": {
                    "type": "array",
                    "maxItems": 200
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "glossaries:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Advisory flags.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "capability",
                    "operation",
                    "flags",
                    "usage"
                  ],
                  "properties": {
                    "capability": {
                      "const": "glossary"
                    },
                    "operation": {
                      "const": "verify"
                    },
                    "flags": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "usage": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, PROVIDER_UNAVAILABLE, POLICY_UNSATISFIABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/terms": {
      "get": {
        "operationId": "terms.list",
        "summary": "List curated source/preferred term pairs.",
        "tags": [
          "glossary"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 200
            }
          }
        ],
        "security": [
          {
            "credential": [
              "glossaries:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Curated term pairs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "terms",
                    "count",
                    "limit",
                    "requestId"
                  ],
                  "properties": {
                    "terms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "id": {},
                          "source_term": {
                            "type": "string"
                          },
                          "preferred_term": {
                            "type": "string"
                          },
                          "rule_strength": {},
                          "source_language": {},
                          "glossary_id": {}
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/terms/glossaries": {
      "get": {
        "operationId": "terms.listGlossaries",
        "summary": "List glossaries a person may choose.",
        "tags": [
          "glossary"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 200
            }
          }
        ],
        "security": [
          {
            "credential": [
              "glossaries:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Glossaries for a picker.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "glossaries",
                    "count",
                    "requestId"
                  ],
                  "properties": {
                    "glossaries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "id": {},
                          "name": {
                            "type": "string"
                          },
                          "description": {},
                          "language_pair": {},
                          "is_default": {
                            "type": "boolean"
                          },
                          "is_system": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/vocabulary": {
      "get": {
        "operationId": "vocabulary.list",
        "summary": "List managed vocabulary terms.",
        "tags": [
          "glossary"
        ],
        "parameters": [
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "cy-GB",
                "en-GB"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 200
            }
          }
        ],
        "security": [
          {
            "credential": [
              "glossaries:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Managed vocabulary rows, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "terms",
                    "count",
                    "limit",
                    "requestId"
                  ],
                  "properties": {
                    "terms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "id": {},
                          "term": {
                            "type": "string"
                          },
                          "language": {},
                          "cross_language": {
                            "type": "boolean"
                          },
                          "auto_approved": {
                            "type": "boolean"
                          },
                          "created_at": {}
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "vocabulary.create",
        "summary": "Add a managed vocabulary term.",
        "tags": [
          "glossary"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "term",
                  "language"
                ],
                "properties": {
                  "term": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "cy-GB",
                      "en-GB"
                    ]
                  },
                  "cross_language": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "glossaries:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The term already existed (idempotent add).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "term",
                    "created",
                    "requestId"
                  ],
                  "properties": {
                    "term": {
                      "type": "object"
                    },
                    "created": {
                      "const": false
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "term",
                    "created",
                    "requestId"
                  ],
                  "properties": {
                    "term": {
                      "type": "object"
                    },
                    "created": {
                      "const": true
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/vocabulary/{termId}": {
      "patch": {
        "operationId": "vocabulary.setCrossLanguage",
        "summary": "Update whether a term applies across languages.",
        "tags": [
          "glossary"
        ],
        "parameters": [
          {
            "name": "termId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "cross_language"
                ],
                "properties": {
                  "cross_language": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "glossaries:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Updated row.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "term",
                    "requestId"
                  ],
                  "properties": {
                    "term": {
                      "type": "object"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, NOT_FOUND_TERM.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "vocabulary.delete",
        "summary": "Delete a managed vocabulary term.",
        "tags": [
          "glossary"
        ],
        "parameters": [
          {
            "name": "termId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "glossaries:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted row, so a local mirror can be pruned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "deleted",
                    "requestId"
                  ],
                  "properties": {
                    "deleted": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {},
                        "term": {
                          "type": "string"
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, NOT_FOUND_TERM.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/transcription/jobs": {
      "post": {
        "operationId": "transcription.submit",
        "summary": "Submit a transcription job.",
        "tags": [
          "transcription"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Provide at least one of asset_id or audio_url; unknown top-level fields are ignored.",
                "anyOf": [
                  {
                    "required": [
                      "asset_id"
                    ]
                  },
                  {
                    "required": [
                      "audio_url"
                    ]
                  }
                ],
                "dependentRequired": {
                  "provider": [
                    "data_class"
                  ]
                },
                "properties": {
                  "asset_id": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                    "description": "The id /v1/assets returned, exactly: a lowercase uuid. Any other spelling is rejected."
                  },
                  "audio_url": {
                    "type": "string"
                  },
                  "diarisation": {
                    "type": "string",
                    "pattern": "^(off|auto|speakers:\\d*[1-9]\\d*)$"
                  },
                  "keyterms": {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "description": "Terms to bias recognition towards, most important first. Each provider uses as many as it accepts, from the front."
                  },
                  "quality_profile": {
                    "type": "string",
                    "enum": [
                      "fast",
                      "accurate",
                      "welsh-broadcast"
                    ]
                  },
                  "provider": {
                    "type": "string",
                    "description": "Operator credentials only (credentials:admin or transcription:provider_override); rejected otherwise. Requires data_class. Normally routing is chosen by quality_profile."
                  },
                  "client_reference": {
                    "type": "string"
                  },
                  "data_class": {
                    "type": "string",
                    "enum": [
                      "public",
                      "internal",
                      "confidential",
                      "restricted"
                    ]
                  },
                  "policy_reference": {
                    "type": "string"
                  },
                  "excluded_subprocessors": {
                    "type": "array",
                    "maxItems": 16,
                    "items": {
                      "type": "string"
                    },
                    "description": "Sub-processors this content must never be sent to, by their identifier in the platform sub-processor register. Enforced on every attempt of the job. If nothing permitted can serve it, the job fails POLICY_UNSATISFIABLE and is not sent anywhere else. An identifier outside the register is rejected. A new job is refused with SERVICE_UNAVAILABLE, and nothing queued, unless every serving process currently confirms the excluded_subprocessors.v1 contract feature (see contracts on /v1/capabilities); an exact replay under the same Idempotency-Key returns the job already accepted. Not echoed on the job. Any other caller-facing operation that takes content refuses it with VALIDATION_FAILED."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "transcription:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay of an existing job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Job accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, VALIDATION_IDEMPOTENCY_KEY_REQUIRED, CONFLICT_IDEMPOTENCY_KEY_REUSE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/transcription/jobs/{jobId}": {
      "get": {
        "operationId": "transcription.get",
        "summary": "Get the status of a transcription job.",
        "tags": [
          "transcription"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "transcription:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/transcription/jobs/{jobId}/result": {
      "get": {
        "operationId": "transcription.result",
        "summary": "Get the result of a finished transcription job.",
        "tags": [
          "transcription"
        ],
        "description": "Only a terminal, result-bearing job (completed or partially_completed) returns a result.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "transcription:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResult"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL, PROCESSING_FAILED, PROVIDER_UNAVAILABLE, PROVIDER_REJECTED, PROVIDER_FAILED, TIMEOUT_EXCEEDED, NOT_FOUND_ASSET, MEDIA_UNSUPPORTED_TYPE, MEDIA_UNSUPPORTED_DURATION, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/transcription/jobs/{jobId}/cancel": {
      "post": {
        "operationId": "transcription.cancel",
        "summary": "Request cancellation of a transcription job.",
        "tags": [
          "transcription"
        ],
        "description": "Cancellation is cooperative and best-effort; a job already inside a provider call may still complete. With only_if_queued, a job no runner has claimed is cancelled at once and any other live job is left unchanged to finish; the response says which, and repeating the call on a job it cancelled answers the same. Any other finished job, including one cancelled after a runner had claimed it, answers CONFLICT_JOB_TERMINAL.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Optional. Unknown top-level fields are ignored.",
                "properties": {
                  "only_if_queued": {
                    "type": "boolean",
                    "description": "Cancel only if no runner has claimed the job yet. Never falls back to a cooperative cancel."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "transcription:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "only_if_queued: the job as it now is, with cancelled true (it never started) or false (already started, left to finish).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Cancellation requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/translation/jobs": {
      "post": {
        "operationId": "translation.submit",
        "summary": "Submit a translation job.",
        "tags": [
          "translation"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "segments",
                  "target_language"
                ],
                "properties": {
                  "segments": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20000,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "segment_id",
                        "text"
                      ],
                      "properties": {
                        "segment_id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        }
                      }
                    }
                  },
                  "target_language": {
                    "type": "string"
                  },
                  "register": {
                    "type": "string",
                    "enum": [
                      "subtitles",
                      "slides",
                      "document",
                      "neutral"
                    ]
                  },
                  "quality_profile": {
                    "type": "string",
                    "enum": [
                      "fast",
                      "accurate",
                      "welsh-broadcast"
                    ]
                  },
                  "client_reference": {
                    "type": "string"
                  },
                  "data_class": {
                    "type": "string",
                    "enum": [
                      "public",
                      "internal",
                      "confidential",
                      "restricted"
                    ]
                  },
                  "policy_reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "translation:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay of an existing job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Job accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, VALIDATION_IDEMPOTENCY_KEY_REQUIRED, CONFLICT_IDEMPOTENCY_KEY_REUSE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/translation/jobs/{jobId}": {
      "get": {
        "operationId": "translation.get",
        "summary": "Get the status of a translation job.",
        "tags": [
          "translation"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "translation:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/translation/jobs/{jobId}/result": {
      "get": {
        "operationId": "translation.result",
        "summary": "Get the result of a finished translation job.",
        "tags": [
          "translation"
        ],
        "description": "Only a terminal, result-bearing job (completed or partially_completed) returns a result.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "translation:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResult"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL, PROCESSING_FAILED, PROVIDER_UNAVAILABLE, PROVIDER_REJECTED, PROVIDER_FAILED, TIMEOUT_EXCEEDED, NOT_FOUND_ASSET, MEDIA_UNSUPPORTED_TYPE, MEDIA_UNSUPPORTED_DURATION, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/translation/jobs/{jobId}/cancel": {
      "post": {
        "operationId": "translation.cancel",
        "summary": "Request cancellation of a translation job.",
        "tags": [
          "translation"
        ],
        "description": "Cancellation is cooperative and best-effort; a job already inside a provider call may still complete. With only_if_queued, a job no runner has claimed is cancelled at once and any other live job is left unchanged to finish; the response says which, and repeating the call on a job it cancelled answers the same. Any other finished job, including one cancelled after a runner had claimed it, answers CONFLICT_JOB_TERMINAL.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Optional. Unknown top-level fields are ignored.",
                "properties": {
                  "only_if_queued": {
                    "type": "boolean",
                    "description": "Cancel only if no runner has claimed the job yet. Never falls back to a cooperative cancel."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "translation:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "only_if_queued: the job as it now is, with cancelled true (it never started) or false (already started, left to finish).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Cancellation requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analysis/jobs": {
      "post": {
        "operationId": "analysis.submit",
        "summary": "Submit an analysis job.",
        "tags": [
          "analysis"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "features",
                  "language",
                  "segments"
                ],
                "properties": {
                  "features": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "enum": [
                        "summary",
                        "action_points",
                        "todos",
                        "moments",
                        "metadata",
                        "note_type",
                        "entities",
                        "title",
                        "polish_email",
                        "polish_message",
                        "polish_memo"
                      ]
                    }
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "cy-GB",
                      "en-GB"
                    ]
                  },
                  "session_type": {
                    "type": "string",
                    "enum": [
                      "meeting",
                      "interview",
                      "workshop",
                      "note",
                      "broadcast"
                    ]
                  },
                  "segments": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20000,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "text"
                      ],
                      "properties": {
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        }
                      }
                    }
                  },
                  "session_metadata": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "dialect": {
                    "type": "string",
                    "enum": [
                      "north",
                      "south",
                      "broadcast",
                      "formal"
                    ]
                  },
                  "glossary_directive": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "feature_context": {
                    "type": "object",
                    "propertyNames": {
                      "enum": [
                        "summary",
                        "action_points",
                        "todos",
                        "moments",
                        "metadata",
                        "note_type",
                        "entities",
                        "polish_email",
                        "polish_message",
                        "polish_memo"
                      ]
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 10000
                    }
                  },
                  "transcript_normalised": {
                    "type": "boolean"
                  },
                  "quality_profile": {
                    "type": "string",
                    "enum": [
                      "fast",
                      "accurate",
                      "welsh-broadcast"
                    ]
                  },
                  "provider": {
                    "type": "string",
                    "description": "Operator credentials only (credentials:admin or analysis:provider_override); rejected otherwise. analysis:provider_override also requires a data_class of public or internal. Normally routing is chosen by quality_profile."
                  },
                  "data_class": {
                    "type": "string",
                    "enum": [
                      "public",
                      "internal",
                      "confidential",
                      "restricted"
                    ]
                  },
                  "policy_reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "analysis:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay of an existing job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Job accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, VALIDATION_IDEMPOTENCY_KEY_REQUIRED, CONFLICT_IDEMPOTENCY_KEY_REUSE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analysis/jobs/{jobId}": {
      "get": {
        "operationId": "analysis.get",
        "summary": "Get the status of a analysis job.",
        "tags": [
          "analysis"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "analysis:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analysis/jobs/{jobId}/result": {
      "get": {
        "operationId": "analysis.result",
        "summary": "Get the result of a finished analysis job.",
        "tags": [
          "analysis"
        ],
        "description": "Only a terminal, result-bearing job (completed or partially_completed) returns a result.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "analysis:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResult"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL, PROCESSING_FAILED, PROVIDER_UNAVAILABLE, PROVIDER_REJECTED, PROVIDER_FAILED, TIMEOUT_EXCEEDED, NOT_FOUND_ASSET, MEDIA_UNSUPPORTED_TYPE, MEDIA_UNSUPPORTED_DURATION, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analysis/jobs/{jobId}/cancel": {
      "post": {
        "operationId": "analysis.cancel",
        "summary": "Request cancellation of a analysis job.",
        "tags": [
          "analysis"
        ],
        "description": "Cancellation is cooperative and best-effort; a job already inside a provider call may still complete. With only_if_queued, a job no runner has claimed is cancelled at once and any other live job is left unchanged to finish; the response says which, and repeating the call on a job it cancelled answers the same. Any other finished job, including one cancelled after a runner had claimed it, answers CONFLICT_JOB_TERMINAL.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Optional. Unknown top-level fields are ignored.",
                "properties": {
                  "only_if_queued": {
                    "type": "boolean",
                    "description": "Cancel only if no runner has claimed the job yet. Never falls back to a cooperative cancel."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "analysis:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "only_if_queued: the job as it now is, with cancelled true (it never started) or false (already started, left to finish).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Cancellation requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/jobs": {
      "post": {
        "operationId": "media.submit",
        "summary": "Submit a media job (visual analysis or vocal isolation).",
        "tags": [
          "media"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "operation"
                ],
                "oneOf": [
                  {
                    "required": [
                      "operation",
                      "frames"
                    ],
                    "properties": {
                      "operation": {
                        "const": "visual_analysis"
                      },
                      "frames": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 60,
                        "items": {
                          "type": "object",
                          "additionalProperties": true,
                          "required": [
                            "t_ms"
                          ],
                          "oneOf": [
                            {
                              "required": [
                                "url"
                              ]
                            },
                            {
                              "required": [
                                "base64"
                              ]
                            }
                          ],
                          "properties": {
                            "t_ms": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "url": {
                              "type": "string",
                              "pattern": "^https://"
                            },
                            "base64": {
                              "type": "string",
                              "maxLength": 1500000
                            },
                            "media_type": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "transcript": {
                        "type": "string",
                        "maxLength": 200000
                      }
                    }
                  },
                  {
                    "required": [
                      "operation",
                      "audio_url"
                    ],
                    "properties": {
                      "operation": {
                        "const": "vocal_isolation"
                      },
                      "audio_url": {
                        "type": "string",
                        "pattern": "^https://",
                        "maxLength": 4096
                      }
                    }
                  }
                ],
                "properties": {
                  "quality_profile": {
                    "description": "media does not validate quality_profile at all: any JSON value (including a non-string) is accepted, stored and echoed. The other three families constrain it to the quality-profile enum."
                  },
                  "data_class": {
                    "type": "string",
                    "enum": [
                      "public",
                      "internal",
                      "confidential",
                      "restricted"
                    ]
                  },
                  "policy_reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "media:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay of an existing job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Job accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, VALIDATION_IDEMPOTENCY_KEY_REQUIRED, CONFLICT_IDEMPOTENCY_KEY_REUSE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/jobs/{jobId}": {
      "get": {
        "operationId": "media.get",
        "summary": "Get the status of a media job.",
        "tags": [
          "media"
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "media:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/jobs/{jobId}/result": {
      "get": {
        "operationId": "media.result",
        "summary": "Get the result of a finished media job.",
        "tags": [
          "media"
        ],
        "description": "Only a terminal, result-bearing job (completed or partially_completed) returns a result.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "media:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Job result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResult"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL, PROCESSING_FAILED, PROVIDER_UNAVAILABLE, PROVIDER_REJECTED, PROVIDER_FAILED, TIMEOUT_EXCEEDED, NOT_FOUND_ASSET, MEDIA_UNSUPPORTED_TYPE, MEDIA_UNSUPPORTED_DURATION, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/jobs/{jobId}/cancel": {
      "post": {
        "operationId": "media.cancel",
        "summary": "Request cancellation of a media job.",
        "tags": [
          "media"
        ],
        "description": "Cancellation is cooperative and best-effort; a job already inside a provider call may still complete. With only_if_queued, a job no runner has claimed is cancelled at once and any other live job is left unchanged to finish; the response says which, and repeating the call on a job it cancelled answers the same. Any other finished job, including one cancelled after a runner had claimed it, answers CONFLICT_JOB_TERMINAL.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Optional. Unknown top-level fields are ignored.",
                "properties": {
                  "only_if_queued": {
                    "type": "boolean",
                    "description": "Cancel only if no runner has claimed the job yet. Never falls back to a cooperative cancel."
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "media:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "only_if_queued: the job as it now is, with cancelled true (it never started) or false (already started, left to finish).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "202": {
            "description": "Cancellation requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, NOT_FOUND_JOB, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, CONFLICT_JOB_TERMINAL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assets/uploads": {
      "post": {
        "operationId": "assets.createUpload",
        "summary": "Register an upload and get a signed URL for it.",
        "tags": [
          "platform"
        ],
        "description": "The platform never fetches a caller URL; the browser uploads to the signed URL, then calls complete (ADR 0025). The Idempotency-Key is honoured, scoped to the credential and tenant: repeating the request with the same key and body returns 200 with the same asset and X-Idempotent-Replay: true, with a fresh upload permission for the same object while the asset is pending and its upload window open, and with no upload permission once it is ready. If that asset can no longer be used (its upload window closed, or it was retired), the key moves to a newly registered asset, answered 201. The same key with a different content_type, bytes or client_reference is 409 CONFLICT_IDEMPOTENCY_KEY_REUSE. A repeat that arrives while the first registration is still being written waits up to about two seconds for it and is then answered as its replay; only if the first has still not finished (or the asset under the key keeps changing while it is read) is the answer 409 DUPLICATE_REQUEST, which is not retryable, so a client does not resend it by itself. The Idempotency-Key is at most 255 characters, and bytes is a whole number.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "content_type",
                  "bytes"
                ],
                "properties": {
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "audio/mpeg",
                      "audio/mp4",
                      "audio/aac",
                      "audio/ogg",
                      "audio/wav",
                      "audio/x-wav",
                      "audio/flac",
                      "audio/webm",
                      "video/mp4",
                      "video/quicktime",
                      "video/webm",
                      "video/x-matroska",
                      "video/mpeg"
                    ]
                  },
                  "bytes": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 8589934592
                  },
                  "client_reference": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "assets:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay of an existing registration; sets X-Idempotent-Replay: true. Carries a fresh upload permission for the same object while the asset is pending, and none once it is ready.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Asset"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "upload": {
                          "$ref": "#/components/schemas/UploadPermission"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Upload registered; signed permission returned.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Asset"
                    },
                    {
                      "type": "object",
                      "required": [
                        "upload"
                      ],
                      "properties": {
                        "upload": {
                          "$ref": "#/components/schemas/UploadPermission"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, VALIDATION_FAILED, VALIDATION_IDEMPOTENCY_KEY_REQUIRED, CONFLICT_IDEMPOTENCY_KEY_REUSE, DUPLICATE_REQUEST, MEDIA_UNSUPPORTED_TYPE, MEDIA_UNSUPPORTED_DURATION.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assets/{assetId}/complete": {
      "post": {
        "operationId": "assets.complete",
        "summary": "Mark an uploaded asset ready.",
        "tags": [
          "platform"
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "bytes": {
                    "type": "number"
                  },
                  "content_type": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "assets:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Asset marked ready (idempotent).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, FORBIDDEN_TENANT, NOT_FOUND_ASSET, CONFLICT_ASSET_STATE, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews": {
      "post": {
        "operationId": "reviews.create",
        "summary": "Create a review of a draft.",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-User-Reference",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "content_type",
                  "content"
                ],
                "properties": {
                  "content_type": {},
                  "content": {},
                  "source_application": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "created_by": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "reviews:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay; sets X-Idempotent-Replay: true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "review_id": {
                      "type": "string"
                    },
                    "head_version_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "review_id",
                    "head_version_id"
                  ],
                  "properties": {
                    "review_id": {
                      "type": "string"
                    },
                    "head_version_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, CONFLICT_IDEMPOTENCY_KEY_REUSE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/{reviewId}": {
      "get": {
        "operationId": "reviews.get",
        "summary": "Get a review (author's full view).",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "reviews:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The review, versions, participants, decisions, suggestions and comments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_REVIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/{reviewId}/share": {
      "post": {
        "operationId": "reviews.share",
        "summary": "Issue a reviewer share link.",
        "tags": [
          "review"
        ],
        "description": "The token is returned once, on first issue; an idempotent replay returns token null.",
        "parameters": [
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "ttl_days": {
                    "type": "number"
                  },
                  "reviewer": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "reviews:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay; token is null; sets X-Idempotent-Replay: true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "null"
                    },
                    "link_id": {},
                    "expires_at": {},
                    "participant_id": {}
                  }
                }
              }
            }
          },
          "201": {
            "description": "Link issued; token returned once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "link_id": {},
                    "expires_at": {},
                    "participant_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_REVIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/{reviewId}/links/{linkId}/revoke": {
      "post": {
        "operationId": "reviews.revokeLink",
        "summary": "Revoke a reviewer share link.",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "reviews:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Link revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "link_id",
                    "revoked_at"
                  ],
                  "properties": {
                    "link_id": {},
                    "revoked_at": {}
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_REVIEW.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/shared/{token}": {
      "get": {
        "operationId": "reviews.shared.get",
        "summary": "Open a shared draft as a reviewer.",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "The draft, reviewer-scoped.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_INVALID, NOT_FOUND_REVIEW, FORBIDDEN_REVIEW_LINK, RATE_LIMIT_EXCEEDED, SERVICE_UNAVAILABLE, METHOD_NOT_ALLOWED, INTERNAL_ERROR.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/shared/{token}/decide": {
      "post": {
        "operationId": "reviews.shared.decide",
        "summary": "Record a reviewer decision.",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "decision"
                ],
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "looks_good",
                      "changes_suggested"
                    ]
                  },
                  "comment": {
                    "type": "string"
                  },
                  "version_id": {
                    "type": "string"
                  },
                  "reviewer_name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [],
        "responses": {
          "201": {
            "description": "Decision recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decision_id": {},
                    "version_id": {},
                    "decision": {}
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_INVALID, NOT_FOUND_REVIEW, FORBIDDEN_REVIEW_LINK, RATE_LIMIT_EXCEEDED, CONFLICT_REVIEW_FINALISED, CONFLICT_REVIEW_VERSION, VALIDATION_FAILED, SERVICE_UNAVAILABLE, METHOD_NOT_ALLOWED, INTERNAL_ERROR.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/shared/{token}/comment": {
      "post": {
        "operationId": "reviews.shared.comment",
        "summary": "Add a reviewer comment.",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "version_id": {
                    "type": "string"
                  },
                  "reviewer_name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [],
        "responses": {
          "201": {
            "description": "Comment stored.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_INVALID, NOT_FOUND_REVIEW, FORBIDDEN_REVIEW_LINK, RATE_LIMIT_EXCEEDED, CONFLICT_REVIEW_FINALISED, CONFLICT_REVIEW_VERSION, VALIDATION_FAILED, SERVICE_UNAVAILABLE, METHOD_NOT_ALLOWED, INTERNAL_ERROR.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/shared/{token}/suggest": {
      "post": {
        "operationId": "reviews.shared.suggest",
        "summary": "Add a reviewer suggestion.",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "suggested_content"
                ],
                "properties": {
                  "suggested_content": {},
                  "version_id": {
                    "type": "string"
                  },
                  "reviewer_name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [],
        "responses": {
          "201": {
            "description": "Suggestion stored.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "suggestion_id": {},
                    "version_id": {}
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_INVALID, NOT_FOUND_REVIEW, FORBIDDEN_REVIEW_LINK, RATE_LIMIT_EXCEEDED, CONFLICT_REVIEW_FINALISED, CONFLICT_REVIEW_VERSION, VALIDATION_FAILED, SERVICE_UNAVAILABLE, METHOD_NOT_ALLOWED, INTERNAL_ERROR.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reviews/shared/{token}/tenant": {
      "get": {
        "operationId": "reviews.shared.tenant",
        "summary": "Which tenant a share link belongs to (product proxies only).",
        "tags": [
          "review"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "reviews:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The link's tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "tenant_ref"
                  ],
                  "properties": {
                    "tenant_ref": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, NOT_FOUND_REVIEW, FORBIDDEN_REVIEW_LINK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/credentials": {
      "get": {
        "operationId": "admin.credentials.list",
        "summary": "List client credentials (never secrets).",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Clients; only last_four per live secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "credentials"
                  ],
                  "properties": {
                    "credentials": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "admin.credentials.issue",
        "summary": "Issue a client credential.",
        "tags": [
          "admin"
        ],
        "description": "The token is returned once. credentials:admin cannot be granted here.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "tenant",
                  "scopes"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "tenant": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string"
                    }
                  },
                  "environment": {
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ],
                    "default": "live"
                  },
                  "tenant_mode": {
                    "type": "string",
                    "enum": [
                      "single",
                      "product"
                    ],
                    "default": "single"
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Issued; token returned once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "token",
                    "client"
                  ],
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "client": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/credentials/{clientId}/rotate": {
      "post": {
        "operationId": "admin.credentials.rotate",
        "summary": "Rotate a client secret.",
        "tags": [
          "admin"
        ],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Rotated; new token returned once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "token"
                  ],
                  "properties": {
                    "token": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, NOT_FOUND_CLIENT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/credentials/{clientId}/revoke": {
      "post": {
        "operationId": "admin.credentials.revoke",
        "summary": "Revoke a client credential.",
        "tags": [
          "admin"
        ],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "client_id",
                    "status"
                  ],
                  "properties": {
                    "client_id": {},
                    "status": {
                      "const": "revoked"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, NOT_FOUND_CLIENT.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/workspaces": {
      "get": {
        "operationId": "admin.workspaces.list",
        "summary": "List workspace links (never secrets).",
        "tags": [
          "admin"
        ],
        "parameters": [
          {
            "name": "tenant",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workspace",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Link or links, with consent history; client_id only, never a secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_WORKSPACE_LINK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "admin.workspaces.link",
        "summary": "Link a workspace to a tenant.",
        "tags": [
          "admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product",
                  "workspace_reference",
                  "tenant_reference"
                ],
                "properties": {
                  "product": {
                    "type": "string"
                  },
                  "workspace_reference": {
                    "type": "string"
                  },
                  "tenant_reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Link created or existing (pending).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "link": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, CONFLICT_WORKSPACE_LINKED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/workspaces/consent": {
      "post": {
        "operationId": "admin.workspaces.consent",
        "summary": "Record workspace consent.",
        "tags": [
          "admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product",
                  "workspace_reference",
                  "granted_by"
                ],
                "properties": {
                  "product": {
                    "type": "string"
                  },
                  "workspace_reference": {
                    "type": "string"
                  },
                  "granted_by": {
                    "type": "string"
                  },
                  "scope": {
                    "type": "object"
                  },
                  "evidence": {},
                  "reconsent": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Consent recorded, link activated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "link": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_WORKSPACE_LINK, CONFLICT_LINK_REVOKED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/workspaces/credential": {
      "post": {
        "operationId": "admin.workspaces.credential",
        "summary": "Provision a per-workspace credential.",
        "tags": [
          "admin"
        ],
        "description": "The token is returned once.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product",
                  "workspace_reference"
                ],
                "properties": {
                  "product": {
                    "type": "string"
                  },
                  "workspace_reference": {
                    "type": "string"
                  },
                  "environment": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Credential provisioned; token returned once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "token",
                    "client_id",
                    "tenant_reference",
                    "last_four"
                  ],
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "client_id": {},
                    "tenant_reference": {},
                    "last_four": {}
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_WORKSPACE_LINK, FORBIDDEN_CONSENT_MISSING, FORBIDDEN_CONSENT_REVOKED, CONFLICT_CREDENTIAL_EXISTS, CONFLICT_EXPIRY_NOT_PRESERVABLE, CONFLICT_CREDENTIAL_UNKNOWN, CONFLICT_LINK_NOT_UPDATED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/workspaces/withdraw": {
      "post": {
        "operationId": "admin.workspaces.withdraw",
        "summary": "Withdraw consent and revoke the workspace credential.",
        "tags": [
          "admin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product",
                  "workspace_reference"
                ],
                "properties": {
                  "product": {
                    "type": "string"
                  },
                  "workspace_reference": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Credential revoked, consent withdrawn.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "link": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED, NOT_FOUND_WORKSPACE_LINK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/executions": {
      "get": {
        "operationId": "admin.governance.executions",
        "summary": "List execution records (operator governance trail).",
        "tags": [
          "admin"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "tenant",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Recent execution records, newest first, including provider and timings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "executions"
                  ],
                  "properties": {
                    "executions": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/policies": {
      "get": {
        "operationId": "admin.governance.policies",
        "summary": "List policy lineage (metadata only).",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Policy lineage; never the policy document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "policies"
                  ],
                  "properties": {
                    "policies": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/seams": {
      "get": {
        "operationId": "admin.seams.get",
        "summary": "Per-capability provider configuration state.",
        "tags": [
          "admin"
        ],
        "description": "Reports which env names are configured, never their values; configured is not the same as reachable.",
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Seam state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "seams",
                    "meaning"
                  ],
                  "properties": {
                    "seams": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "declaration_problems": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "meaning": {
                      "type": "string"
                    },
                    "evaluated_in": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, FORBIDDEN_SCOPE, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/usage": {
      "get": {
        "operationId": "admin.usage.get",
        "summary": "Cross-client usage ledger.",
        "tags": [
          "admin"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "billable_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "security": [
          {
            "credential": [
              "credentials:admin"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Every client's usage over the window; quantities only.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "window",
                    "clients"
                  ],
                  "properties": {
                    "window": {
                      "type": "object"
                    },
                    "clients": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "4XX": {
            "description": "Error envelope. Possible codes: AUTH_MISSING, AUTH_INVALID, AUTH_REVOKED, METHOD_NOT_ALLOWED, INTERNAL_ERROR, SERVICE_UNAVAILABLE, RATE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, FORBIDDEN_SCOPE, VALIDATION_FAILED.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "credential": {
        "type": "http",
        "scheme": "bearer",
        "description": "An AIOG client credential of the form il_<env>_<id>_<secret>."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "retryable"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "AUTH_MISSING",
                  "AUTH_INVALID",
                  "AUTH_REVOKED",
                  "FORBIDDEN_SCOPE",
                  "FORBIDDEN_TENANT",
                  "VALIDATION_FAILED",
                  "VALIDATION_IDEMPOTENCY_KEY_REQUIRED",
                  "UPLOAD_URL_EXPIRED",
                  "UPLOAD_INCOMPLETE",
                  "MEDIA_UNSUPPORTED_TYPE",
                  "MEDIA_UNSUPPORTED_DURATION",
                  "QUOTA_EXCEEDED",
                  "RATE_LIMIT_EXCEEDED",
                  "PROVIDER_UNAVAILABLE",
                  "PROVIDER_REJECTED",
                  "PROVIDER_FAILED",
                  "PROCESSING_FAILED",
                  "TIMEOUT_EXCEEDED",
                  "CONFLICT_JOB_TERMINAL",
                  "CONFLICT_IDEMPOTENCY_KEY_REUSE",
                  "CONFLICT_ASSET_STATE",
                  "DUPLICATE_REQUEST",
                  "NOT_FOUND_JOB",
                  "NOT_FOUND_ASSET",
                  "NOT_FOUND_GLOSSARY",
                  "NOT_FOUND_TERM",
                  "NOT_FOUND_CLIENT",
                  "NOT_FOUND_REVIEW",
                  "CONFLICT_REVIEW_FINALISED",
                  "CONFLICT_REVIEW_VERSION",
                  "FORBIDDEN_REVIEW_AUTHOR",
                  "FORBIDDEN_REVIEW_LINK",
                  "NOT_FOUND_WORKSPACE_LINK",
                  "FORBIDDEN_TENANT_MISMATCH",
                  "FORBIDDEN_CONSENT_MISSING",
                  "FORBIDDEN_CONSENT_REVOKED",
                  "CONFLICT_WORKSPACE_LINKED",
                  "CONFLICT_LINK_REVOKED",
                  "CONFLICT_CREDENTIAL_EXISTS",
                  "CONFLICT_CREDENTIAL_ATTACHED",
                  "CONFLICT_CREDENTIAL_UNKNOWN",
                  "CONFLICT_EXPIRY_NOT_PRESERVABLE",
                  "CONFLICT_LINK_NOT_UPDATED",
                  "POLICY_UNSATISFIABLE",
                  "METHOD_NOT_ALLOWED",
                  "SERVICE_UNAVAILABLE",
                  "INTERNAL_ERROR"
                ]
              },
              "message": {
                "type": "string",
                "description": "A neutral English developer string. Never end-user copy, never Welsh."
              },
              "requestId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "retryable": {
                "type": "boolean"
              },
              "details": {
                "type": "object"
              }
            }
          }
        }
      },
      "Job": {
        "type": "object",
        "description": "The wire view of an asynchronous job. Never carries the provider, the model or the internal client id.",
        "required": [
          "job_id",
          "status",
          "capability",
          "result"
        ],
        "additionalProperties": false,
        "properties": {
          "job_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "validating",
              "processing",
              "completed",
              "partially_completed",
              "failed",
              "cancel_requested",
              "cancelled",
              "expired"
            ]
          },
          "capability": {
            "type": "string",
            "enum": [
              "transcription",
              "translation",
              "analysis",
              "media"
            ]
          },
          "quality_profile": {},
          "progress": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "properties": {
              "stage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "percent": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "error": {
            "type": [
              "object",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "client_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "data_class": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "public",
              "internal",
              "confidential",
              "restricted",
              null
            ]
          },
          "policy_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "type": "object",
            "required": [
              "available"
            ],
            "additionalProperties": false,
            "properties": {
              "available": {
                "type": "boolean"
              }
            }
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "attempts": {
            "type": "integer"
          },
          "note": {
            "type": "string",
            "description": "Present only on a cancel acknowledgement."
          },
          "cancelled": {
            "type": "boolean",
            "description": "Present only on an only_if_queued cancel: true when the job was cancelled before any runner claimed it, false when it had already started and was left to finish."
          }
        }
      },
      "JobResult": {
        "type": "object",
        "description": "Returned by GET .../result on a terminal, result-bearing job. The result payload is capability-specific.",
        "required": [
          "job_id",
          "status",
          "result"
        ],
        "additionalProperties": false,
        "properties": {
          "job_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "partially_completed"
            ]
          },
          "result": {}
        }
      },
      "Asset": {
        "type": "object",
        "description": "A registered upload. The signed upload permission is returned only by registration: when the asset is registered, and to an idempotent replay of that registration while the asset is still pending. Never by a read.",
        "required": [
          "asset_id",
          "status"
        ],
        "additionalProperties": false,
        "properties": {
          "asset_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ready",
              "expired"
            ]
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "bytes": {
            "type": [
              "number",
              "null"
            ]
          },
          "client_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ready_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "upload_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "UploadPermission": {
        "type": "object",
        "description": "Write-permission for one object, returned on asset registration and on an idempotent replay of a registration still pending.",
        "required": [
          "url",
          "method",
          "headers",
          "expires_at"
        ],
        "additionalProperties": false,
        "properties": {
          "url": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "headers": {
            "type": "object"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Finding": {
        "type": "object",
        "description": "One structured validation finding. Machine-readable first: branch on check, type, severity and rule_id; the explanation is English prose for convenience, and rule_id + params are what a client localises from.",
        "required": [
          "finding_id",
          "segment_id",
          "check",
          "type",
          "severity",
          "basis",
          "rule_id",
          "source_span",
          "target_span",
          "explanation",
          "suggestion",
          "params"
        ],
        "additionalProperties": false,
        "properties": {
          "finding_id": {
            "type": "string",
            "description": "Stable for the same content, rule and span, so a dismissal can be remembered until the content changes."
          },
          "segment_id": {
            "type": "string"
          },
          "check": {
            "type": "string",
            "enum": [
              "coverage",
              "language_quality",
              "equivalence"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "missing_translation",
              "spelling",
              "grammar",
              "mutation",
              "terminology",
              "dialect",
              "register",
              "style",
              "semantic_mismatch",
              "missing_information",
              "added_information",
              "numeric_mismatch",
              "date_mismatch",
              "time_mismatch",
              "url_mismatch",
              "contact_mismatch",
              "tone_mismatch"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning",
              "suggestion"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "deterministic",
              "model"
            ]
          },
          "rule_id": {
            "type": "string"
          },
          "source_span": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "start",
              "end",
              "text"
            ],
            "properties": {
              "start": {
                "type": "integer",
                "minimum": 0
              },
              "end": {
                "type": "integer",
                "minimum": 0
              },
              "text": {
                "type": "string"
              }
            }
          },
          "target_span": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "start",
              "end",
              "text"
            ],
            "properties": {
              "start": {
                "type": "integer",
                "minimum": 0
              },
              "end": {
                "type": "integer",
                "minimum": 0
              },
              "text": {
                "type": "string"
              }
            }
          },
          "explanation": {
            "type": "string"
          },
          "suggestion": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "text"
            ],
            "properties": {
              "text": {
                "type": "string"
              }
            }
          },
          "params": {
            "type": "object"
          }
        }
      }
    }
  }
}
