{
  "openapi": "3.1.0",
  "info": {
    "title": "AtomicPlayer API",
    "version": "1.0.0",
    "description": "Hospedagem de vídeo, configuração do player, análises e webhooks da AtomicPlayer. Cada resposta usa success, data e error."
  },
  "servers": [
    {
      "url": "https://api.atomicplayer.ai"
    }
  ],
  "tags": [
    {
      "name": "Videos",
      "description": "Cria vídeos, pede uma URL de envio e consulta o estado do processamento."
    },
    {
      "name": "Folders",
      "description": "Organiza os vídeos em pastas."
    },
    {
      "name": "Tags",
      "description": "Marca vídeos e substitui as tags de um vídeo."
    },
    {
      "name": "Player",
      "description": "Lê, salva rascunhos e publica a configuração do player."
    },
    {
      "name": "Analytics",
      "description": "Relatórios de reprodução, retenção, audiência e receita do workspace."
    },
    {
      "name": "Webhooks",
      "description": "Inscreve uma URL HTTPS pública em eventos assinados da conta."
    },
    {
      "name": "API keys",
      "description": "Cria e revoga chaves. Estas rotas usam uma sessão do painel, não uma chave de API."
    }
  ],
  "paths": {
    "/v1/videos": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "Listar vídeos",
        "description": "Devolve os vídeos de um workspace. Passe tagId para ficar com uma tag. Escopo exigido: `read`.",
        "operationId": "get_v1_videos",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tagId",
            "in": "query",
            "required": false,
            "description": "Apenas vídeos com esta tag.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Listar vídeos",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "videos": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "folderId": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "durationSec": {
                                "type": "number"
                              },
                              "width": {
                                "type": "number"
                              },
                              "height": {
                                "type": "number"
                              },
                              "tagIds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "posterUrl": {
                                "type": "string"
                              },
                              "hlsUrl": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "string"
                              },
                              "updatedAt": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "videos": [
                      {
                        "id": "00000000-0000-4000-8000-000000000001",
                        "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                        "folderId": "00000000-0000-4000-8000-000000000010",
                        "title": "Product launch VSL",
                        "status": "ready",
                        "durationSec": 186,
                        "width": 1920,
                        "height": 1080,
                        "tagIds": [
                          "00000000-0000-4000-8000-000000000020"
                        ],
                        "posterUrl": "https://cdn.example.com/abc/thumbnail.jpg",
                        "hlsUrl": "https://cdn.example.com/abc/playlist.m3u8",
                        "createdAt": "2026-07-15T10:22:00.000Z",
                        "updatedAt": "2026-07-15T10:28:00.000Z"
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "post": {
        "tags": [
          "Videos"
        ],
        "summary": "Criar um vídeo",
        "description": "Cria o registro do vídeo. O arquivo é enviado à parte com a URL de envio. Escopo exigido: `write`.",
        "operationId": "post_v1_videos",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Criar um vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "folderId": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "durationSec": {
                          "type": "number"
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        },
                        "tagIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "posterUrl": {
                          "type": "string"
                        },
                        "hlsUrl": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "folderId": "00000000-0000-4000-8000-000000000010",
                    "title": "Product launch VSL",
                    "status": "created",
                    "durationSec": 186,
                    "width": 1920,
                    "height": 1080,
                    "tagIds": [
                      "00000000-0000-4000-8000-000000000020"
                    ],
                    "posterUrl": "https://cdn.example.com/abc/thumbnail.jpg",
                    "hlsUrl": "https://cdn.example.com/abc/playlist.m3u8",
                    "createdAt": "2026-07-15T10:22:00.000Z",
                    "updatedAt": "2026-07-15T10:28:00.000Z"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                "title": "Product launch VSL"
              }
            }
          }
        }
      }
    },
    "/v1/videos/{videoId}": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "Obter um vídeo",
        "description": "Devolve um vídeo, com as URLs de reprodução quando ele está pronto. Escopo exigido: `read`.",
        "operationId": "get_v1_videos__videoId_",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "videoId"
          }
        ],
        "responses": {
          "200": {
            "description": "Obter um vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "folderId": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "durationSec": {
                          "type": "number"
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        },
                        "tagIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "posterUrl": {
                          "type": "string"
                        },
                        "hlsUrl": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "folderId": "00000000-0000-4000-8000-000000000010",
                    "title": "Product launch VSL",
                    "status": "ready",
                    "durationSec": 186,
                    "width": 1920,
                    "height": 1080,
                    "tagIds": [
                      "00000000-0000-4000-8000-000000000020"
                    ],
                    "posterUrl": "https://cdn.example.com/abc/thumbnail.jpg",
                    "hlsUrl": "https://cdn.example.com/abc/playlist.m3u8",
                    "createdAt": "2026-07-15T10:22:00.000Z",
                    "updatedAt": "2026-07-15T10:28:00.000Z"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Videos"
        ],
        "summary": "Atualizar um vídeo",
        "description": "Altera campos como o título ou a pasta. Escopo exigido: `write`.",
        "operationId": "patch_v1_videos__videoId_",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "videoId"
          }
        ],
        "responses": {
          "200": {
            "description": "Atualizar um vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "folderId": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "durationSec": {
                          "type": "number"
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        },
                        "tagIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "posterUrl": {
                          "type": "string"
                        },
                        "hlsUrl": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "folderId": "00000000-0000-4000-8000-000000000010",
                    "title": "Product launch VSL",
                    "status": "ready",
                    "durationSec": 186,
                    "width": 1920,
                    "height": 1080,
                    "tagIds": [
                      "00000000-0000-4000-8000-000000000020"
                    ],
                    "posterUrl": "https://cdn.example.com/abc/thumbnail.jpg",
                    "hlsUrl": "https://cdn.example.com/abc/playlist.m3u8",
                    "createdAt": "2026-07-15T10:22:00.000Z",
                    "updatedAt": "2026-07-15T10:28:00.000Z"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "folderId": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "title": "Product launch VSL",
                "folderId": "00000000-0000-4000-8000-000000000010"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Videos"
        ],
        "summary": "Excluir um vídeo",
        "description": "Exclui o vídeo do workspace. Escopo exigido: `write`.",
        "operationId": "delete_v1_videos__videoId_",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "videoId"
          }
        ],
        "responses": {
          "200": {
            "description": "Excluir um vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "deleted": {
                          "type": "boolean"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "deleted": true
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/videos/{videoId}/upload-url": {
      "post": {
        "tags": [
          "Videos"
        ],
        "summary": "Criar uma URL de envio",
        "description": "Devolve um destino de envio de uso único. Envie o arquivo para lá e depois consulte o estado. Escopo exigido: `write`.",
        "operationId": "post_v1_videos__videoId__upload-url",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "videoId"
          }
        ],
        "responses": {
          "200": {
            "description": "Criar uma URL de envio",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "headers": {
                          "type": "object",
                          "properties": {
                            "AuthorizationSignature": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "url": "https://video.bunnycdn.com/tusupload",
                    "headers": {
                      "AuthorizationSignature": "…"
                    }
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/videos/{videoId}/status": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "Obter o estado do envio",
        "description": "status passa de uploading para processing e depois para ready. Escopo exigido: `read`.",
        "operationId": "get_v1_videos__videoId__status",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "videoId"
          }
        ],
        "responses": {
          "200": {
            "description": "Obter o estado do envio",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "status": "processing"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/video-folders": {
      "get": {
        "tags": [
          "Folders"
        ],
        "summary": "Listar pastas",
        "description": "Devolve as pastas de um workspace. Escopo exigido: `read`.",
        "operationId": "get_v1_video-folders",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Listar pastas",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "folders": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "parentId": {
                                "nullable": true
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "folders": [
                      {
                        "id": "00000000-0000-4000-8000-000000000010",
                        "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                        "name": "Campaigns",
                        "parentId": null
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "post": {
        "tags": [
          "Folders"
        ],
        "summary": "Criar uma pasta",
        "description": "parentId aninha a pasta. Omita para uma pasta raiz. Escopo exigido: `write`.",
        "operationId": "post_v1_video-folders",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Criar uma pasta",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "parentId": {
                          "nullable": true
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000010",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "name": "Campaigns",
                    "parentId": null
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "parentId": {
                    "nullable": true
                  }
                }
              },
              "example": {
                "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                "name": "Campaigns",
                "parentId": null
              }
            }
          }
        }
      }
    },
    "/v1/video-tags": {
      "get": {
        "tags": [
          "Tags"
        ],
        "summary": "Listar tags",
        "description": "Devolve as tags de um workspace. Escopo exigido: `read`.",
        "operationId": "get_v1_video-tags",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Listar tags",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "tags": [
                      {
                        "id": "00000000-0000-4000-8000-000000000020",
                        "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                        "name": "Launch"
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "post": {
        "tags": [
          "Tags"
        ],
        "summary": "Criar uma tag",
        "description": "Cria uma tag que pode ser ligada a vídeos. Escopo exigido: `write`.",
        "operationId": "post_v1_video-tags",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Criar uma tag",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000020",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "name": "Launch"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                "name": "Launch"
              }
            }
          }
        }
      }
    },
    "/v1/videos/{videoId}/tags": {
      "put": {
        "tags": [
          "Tags"
        ],
        "summary": "Substituir tags do vídeo",
        "description": "Substitui a lista completa. Envie um array vazio para limpar as tags. Escopo exigido: `write`.",
        "operationId": "put_v1_videos__videoId__tags",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "videoId"
          }
        ],
        "responses": {
          "200": {
            "description": "Substituir tags do vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "tagIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "tagIds": [
                      "00000000-0000-4000-8000-000000000020"
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tagIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "tagIds": [
                  "00000000-0000-4000-8000-000000000020"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/player-config/manage/workspace/{workspaceId}": {
      "get": {
        "tags": [
          "Player"
        ],
        "summary": "Listar players",
        "description": "Devolve as configurações de player de um workspace. Escopo exigido: `read`.",
        "operationId": "get_v1_player-config_manage_workspace__workspaceId_",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "workspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Listar players",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "players": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "videoId": {
                                "type": "string"
                              },
                              "publishedVersion": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "players": [
                      {
                        "id": "00000000-0000-4000-8000-000000000030",
                        "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                        "videoId": "00000000-0000-4000-8000-000000000001",
                        "publishedVersion": 3
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/player-config/manage/{playerId}": {
      "get": {
        "tags": [
          "Player"
        ],
        "summary": "Obter um player",
        "description": "Devolve o rascunho e a configuração publicada. Escopo exigido: `read`.",
        "operationId": "get_v1_player-config_manage__playerId_",
        "parameters": [
          {
            "name": "playerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "playerId"
          }
        ],
        "responses": {
          "200": {
            "description": "Obter um player",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "videoId": {
                          "type": "string"
                        },
                        "publishedVersion": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000030",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "videoId": "00000000-0000-4000-8000-000000000001",
                    "publishedVersion": 3
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/player-config": {
      "post": {
        "tags": [
          "Player"
        ],
        "summary": "Criar um player",
        "description": "Cria um rascunho para um vídeo. Publique antes de o embed usá-lo. Escopo exigido: `write`.",
        "operationId": "post_v1_player-config",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Criar um player",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "videoId": {
                          "type": "string"
                        },
                        "publishedVersion": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000030",
                    "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                    "videoId": "00000000-0000-4000-8000-000000000001",
                    "publishedVersion": 0
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": "string"
                  },
                  "videoId": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                "videoId": "00000000-0000-4000-8000-000000000001"
              }
            }
          }
        }
      }
    },
    "/v1/player-config/{playerId}/draft": {
      "patch": {
        "tags": [
          "Player"
        ],
        "summary": "Atualizar o rascunho",
        "description": "Salva mudanças no rascunho. O embed ao vivo continua na versão publicada. Escopo exigido: `write`.",
        "operationId": "patch_v1_player-config__playerId__draft",
        "parameters": [
          {
            "name": "playerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "playerId"
          }
        ],
        "responses": {
          "200": {
            "description": "Atualizar o rascunho",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "publishedVersion": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000030",
                    "publishedVersion": 3
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "appearance": {
                    "type": "object",
                    "properties": {
                      "primaryColor": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "example": {
                "appearance": {
                  "primaryColor": "#ff7a1a"
                }
              }
            }
          }
        }
      }
    },
    "/v1/player-config/{playerId}/publish": {
      "post": {
        "tags": [
          "Player"
        ],
        "summary": "Publicar um player",
        "description": "Copia o rascunho para o embed ao vivo e incrementa publishedVersion. Escopo exigido: `write`.",
        "operationId": "post_v1_player-config__playerId__publish",
        "parameters": [
          {
            "name": "playerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "playerId"
          }
        ],
        "responses": {
          "200": {
            "description": "Publicar um player",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "publishedVersion": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000030",
                    "publishedVersion": 4
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/overview": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Visão geral das análises",
        "description": "Totais de visualizações, reproduções, retenção, cliques e receita. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_overview",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Visão geral das análises",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "views": {
                          "type": "number"
                        },
                        "plays": {
                          "type": "number"
                        },
                        "playRate": {
                          "type": "number"
                        },
                        "conversions": {
                          "type": "number"
                        },
                        "revenue": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "views": 8420,
                    "plays": 5200,
                    "playRate": 0.617,
                    "conversions": 210,
                    "revenue": 3150
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/video-detail": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Análises de um vídeo",
        "description": "Os mesmos totais para um vídeo. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_video-detail",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          },
          {
            "name": "videoId",
            "in": "query",
            "required": true,
            "description": "Id do vídeo.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Análises de um vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "videoId": {
                          "type": "string"
                        },
                        "views": {
                          "type": "number"
                        },
                        "plays": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "videoId": "00000000-0000-4000-8000-000000000001",
                    "views": 8420,
                    "plays": 5200
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/retention": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Curva de retenção",
        "description": "Parcela de espectadores que ainda assistem em cada ponto do vídeo. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_retention",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          },
          {
            "name": "videoId",
            "in": "query",
            "required": true,
            "description": "Id do vídeo.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Curva de retenção",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "points": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "second": {
                                "type": "number"
                              },
                              "retention": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "points": [
                      {
                        "second": 0,
                        "retention": 1
                      },
                      {
                        "second": 30,
                        "retention": 0.72
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/funnel": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Funil de reprodução",
        "description": "Impressões, reproduções, pitch e conversões. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_funnel",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Funil de reprodução",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "impressions": {
                          "type": "number"
                        },
                        "plays": {
                          "type": "number"
                        },
                        "conversions": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "impressions": 9000,
                    "plays": 5200,
                    "conversions": 210
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/revenue": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Receita",
        "description": "Receita atribuída a conversões do player na janela. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_revenue",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receita",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "revenue": {
                          "type": "number"
                        },
                        "conversions": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "revenue": 3150,
                    "conversions": 210
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/cohorts": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Coortes",
        "description": "Espectadores que voltam, agrupados pela semana da primeira visualização. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_cohorts",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coortes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "cohorts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "week": {
                                "type": "string"
                              },
                              "viewers": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "cohorts": [
                      {
                        "week": "2026-07-06",
                        "viewers": 1200
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/audience": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Audiência",
        "description": "Visualizações por dispositivo, país e referenciador. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_audience",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Audiência",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "devices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "views": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "devices": [
                      {
                        "label": "mobile",
                        "views": 5100
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/live": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Espectadores ao vivo",
        "description": "Espectadores assistindo agora. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_live",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Espectadores ao vivo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "viewers": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "viewers": 18
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/replays": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Sessões de replay",
        "description": "Sessões de reprodução recentes que podem ser repetidas. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_replays",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sessões de replay",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "sessions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "videoId": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "sessions": [
                      {
                        "id": "sess_123",
                        "videoId": "00000000-0000-4000-8000-000000000001"
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/analytics/video-summaries": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Resumos por vídeo",
        "description": "Uma linha de resumo por vídeo na janela. Escopo exigido: `analytics`.",
        "operationId": "get_v1_analytics_video-summaries",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "Janela do relatório. Use 7d, 30d, 90d ou today.",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "today"
              ],
              "default": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resumos por vídeo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "videos": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "videoId": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "views": {
                                "type": "number"
                              },
                              "plays": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "videos": [
                      {
                        "videoId": "00000000-0000-4000-8000-000000000001",
                        "title": "Product launch VSL",
                        "views": 8420,
                        "plays": 5200
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/webhooks/events": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Listar eventos de webhook",
        "description": "Os nomes de evento que uma inscrição pode incluir. Escopo exigido: `webhooks`.",
        "operationId": "get_v1_webhooks_events",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Listar eventos de webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "events": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "events": [
                      "video.viewed",
                      "video.completed",
                      "video.uploaded"
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Listar webhooks",
        "description": "Devolve os endpoints de um workspace. Os segredos não são incluídos. Escopo exigido: `webhooks`.",
        "operationId": "get_v1_webhooks",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Listar webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "webhooks": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "events": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "status": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "webhooks": [
                      {
                        "id": "00000000-0000-4000-8000-000000000040",
                        "name": "CRM",
                        "url": "https://example.com/atomicplayer",
                        "events": [
                          "video.viewed"
                        ],
                        "status": "active"
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Criar um webhook",
        "description": "events é uma lista de nomes do catálogo, ou [\"*\"] para todos. O segredo de assinatura é devolvido uma vez. Escopo exigido: `webhooks`.",
        "operationId": "post_v1_webhooks",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Criar um webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "secret": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000040",
                    "secret": "whsec_…",
                    "status": "active"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "workspaceId": "ddaf7e61-1a65-4d59-9f94-d706fc53131a",
                "name": "CRM",
                "url": "https://example.com/atomicplayer",
                "events": [
                  "video.viewed",
                  "video.completed"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Obter um webhook",
        "description": "Devolve um endpoint sem o segredo. Escopo exigido: `webhooks`.",
        "operationId": "get_v1_webhooks__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Obter um webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "events": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000040",
                    "name": "CRM",
                    "status": "active",
                    "events": [
                      "video.viewed"
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Atualizar um webhook",
        "description": "Altera o nome, a URL, os eventos ou o estado. status é active ou paused. Escopo exigido: `webhooks`.",
        "operationId": "patch_v1_webhooks__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Atualizar um webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000040",
                    "status": "paused"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "status": "paused"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Excluir um webhook",
        "description": "Interrompe as entregas para este endpoint. Escopo exigido: `webhooks`.",
        "operationId": "delete_v1_webhooks__id_",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Excluir um webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "deleted": {
                          "type": "boolean"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "deleted": true
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Listar entregas",
        "description": "Tentativas de entrega recentes de um endpoint. Escopo exigido: `webhooks`.",
        "operationId": "get_v1_webhooks__id__deliveries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Listar entregas",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "deliveries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "eventType": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "deliveries": [
                      {
                        "id": "del_123",
                        "eventType": "video.viewed",
                        "status": "succeeded"
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Enviar um evento de teste",
        "description": "Entrega um evento de exemplo ao endpoint. Escopo exigido: `webhooks`.",
        "operationId": "post_v1_webhooks__id__test",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Enviar um evento de teste",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "delivered": {
                          "type": "boolean"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "delivered": true
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/webhooks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotacionar o segredo de assinatura",
        "description": "Devolve um segredo novo uma vez. O segredo anterior deixa de verificar. Escopo exigido: `webhooks`.",
        "operationId": "post_v1_webhooks__id__rotate-secret",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "id"
          }
        ],
        "responses": {
          "200": {
            "description": "Rotacionar o segredo de assinatura",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "secret": {
                          "type": "string"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "secret": "whsec_…"
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/webhooks/stats": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Estatísticas de webhooks",
        "description": "Saúde das entregas do workspace. Escopo exigido: `webhooks`.",
        "operationId": "get_v1_webhooks_stats",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "description": "Id do workspace.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Estatísticas de webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "active": {
                          "type": "number"
                        },
                        "failing": {
                          "type": "number"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "active": 2,
                    "failing": 0
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/v1/workspaces/{workspaceId}/api-keys": {
      "get": {
        "tags": [
          "API keys"
        ],
        "summary": "Listar chaves de API",
        "description": "Usa uma sessão do painel. As chaves em texto puro não são devolvidas de novo.",
        "operationId": "get_v1_workspaces__workspaceId__api-keys",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "workspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Listar chaves de API",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "keys": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "prefix": {
                                "type": "string"
                              },
                              "scopes": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "last4": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "keys": [
                      {
                        "id": "00000000-0000-4000-8000-000000000060",
                        "name": "Production",
                        "prefix": "apk_a1b2",
                        "scopes": [
                          "read",
                          "write"
                        ],
                        "last4": "9f3c"
                      }
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "session": []
          }
        ]
      },
      "post": {
        "tags": [
          "API keys"
        ],
        "summary": "Criar uma chave de API",
        "description": "Devolve a chave em texto puro uma vez. Começa com apk_.",
        "operationId": "post_v1_workspaces__workspaceId__api-keys",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "workspaceId"
          }
        ],
        "responses": {
          "201": {
            "description": "Criar uma chave de API",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "key": {
                          "type": "string"
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000060",
                    "key": "apk_…",
                    "scopes": [
                      "read",
                      "write"
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "name": "Production",
                "scopes": [
                  "read",
                  "write"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/workspaces/{workspaceId}/api-keys/{keyId}": {
      "patch": {
        "tags": [
          "API keys"
        ],
        "summary": "Atualizar uma chave de API",
        "description": "Altera o nome ou os escopos. O segredo continua o mesmo.",
        "operationId": "patch_v1_workspaces__workspaceId__api-keys__keyId_",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "workspaceId"
          },
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "keyId"
          }
        ],
        "responses": {
          "200": {
            "description": "Atualizar uma chave de API",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "00000000-0000-4000-8000-000000000060",
                    "name": "Production",
                    "scopes": [
                      "read"
                    ]
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "name": "Production",
                "scopes": [
                  "read"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "API keys"
        ],
        "summary": "Revogar uma chave de API",
        "description": "A chave para de funcionar na hora.",
        "operationId": "delete_v1_workspaces__workspaceId__api-keys__keyId_",
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "workspaceId"
          },
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "keyId"
          }
        ],
        "responses": {
          "200": {
            "description": "Revogar uma chave de API",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "error"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "deleted": {
                          "type": "boolean"
                        }
                      }
                    },
                    "error": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "deleted": true
                  },
                  "error": null
                }
              }
            }
          },
          "400": {
            "description": "Falta um campo obrigatório ou há um valor inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "O token Bearer está ausente, é inválido ou foi revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "O token é válido, mas não inclui o escopo exigido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "O registro não existe neste workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "O workspace esgotou a cota mensal da API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "security": [
          {
            "session": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Chave de API criada no painel. Envie Authorization: Bearer apk_…"
      },
      "session": {
        "type": "http",
        "scheme": "bearer",
        "description": "Sessão do painel. Usada apenas para criar e administrar chaves de API."
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "success",
          "data",
          "error"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "data": {
            "nullable": true
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}
