{
    "openapi": "3.1.0",
    "info": {
        "title": "FlowAI API",
        "version": "v1",
        "description": "API do FlowAI para a assinatura FlowSuite Pro: catálogo de modelos e um endpoint de chat no seu próprio FlowAI, sempre com histórico de conversa. O produto de roteamento independente, o FlowModels, tem guia próprio, chaves próprias e cobrança em euros."
    },
    "servers": [
        {
            "url": "https://creativeskyline.de",
            "description": "FlowAI API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "models",
            "description": "Modelos"
        },
        {
            "name": "chat",
            "description": "Chat"
        },
        {
            "name": "files",
            "description": "Arquivos"
        },
        {
            "name": "webhooks",
            "description": "Webhooks"
        }
    ],
    "paths": {
        "/api/flowai/v1/models": {
            "get": {
                "operationId": "models-list",
                "summary": "Listar modelos",
                "description": "Lista os aliases de modelo disponíveis para a chave vinculada à assinatura. O cursor é sempre o alias público do modelo.",
                "tags": [
                    "models"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Número de registros de 1 a 100, padrão 100",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "required": false,
                        "description": "Alias de last_id da página anterior",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "flowai",
                                            "object": "model",
                                            "created": 1735000000,
                                            "owned_by": "creativeskyline",
                                            "pricing": {
                                                "prompt": "0.000001",
                                                "completion": "0.000002"
                                            }
                                        }
                                    ],
                                    "has_more": false,
                                    "first_id": "flowai",
                                    "last_id": "flowai",
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/models/{model_id}": {
            "get": {
                "operationId": "models-show",
                "summary": "Consultar um modelo",
                "description": "Retorna um único registro da lista de modelos com preços, recursos, os limites do FlowAI que realmente valem e a data de desativação. O ID é o alias do modelo; com uma chave de roteamento, é o ID completo do provedor, incluindo barras.",
                "tags": [
                    "models"
                ],
                "parameters": [
                    {
                        "name": "model_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "claude",
                                    "object": "model",
                                    "created": 1735000000,
                                    "owned_by": "creativeskyline",
                                    "pricing": {
                                        "prompt": "0.000003",
                                        "completion": "0.000015"
                                    },
                                    "context_length": 200000,
                                    "max_output_tokens": 64000,
                                    "capabilities": {
                                        "reasoning": true,
                                        "reasoning_levels": [
                                            "low",
                                            "medium",
                                            "high"
                                        ],
                                        "web_search": false,
                                        "web_search_forced": false,
                                        "tools": true,
                                        "tool_choice": true,
                                        "parallel_tool_calls": true,
                                        "vision": true,
                                        "json_object": false,
                                        "json_schema": false,
                                        "sampling": true,
                                        "streaming": true
                                    },
                                    "supported_parameters": [
                                        "temperature",
                                        "top_p",
                                        "max_tokens",
                                        "tools",
                                        "tool_choice",
                                        "stream"
                                    ],
                                    "flowai_limits": {
                                        "input_tokens": 200000,
                                        "max_output_tokens": 64000,
                                        "max_messages": 50,
                                        "max_payload_bytes": 131072,
                                        "max_chars_per_message": 32000
                                    },
                                    "deprecated_at": null,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/chat": {
            "post": {
                "operationId": "chat-send",
                "summary": "Enviar mensagem",
                "description": "Envia uma mensagem ao seu FlowAI e retorna a resposta junto com o ID da conversa.",
                "tags": [
                    "chat"
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "chat",
                                    "conversation": "018f1234-5678-7abc-9def-0123456789ab",
                                    "id": "018f9999-1111-7abc-9def-0123456789ab",
                                    "model": "claude",
                                    "status": "completed",
                                    "message": {
                                        "role": "assistant",
                                        "content": "Wir liefern innerhalb von zwei Werktagen."
                                    },
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "message": {
                                        "type": "string",
                                        "description": "A nova mensagem, de 1 a 32.000 caracteres"
                                    },
                                    "conversation": {
                                        "type": "string",
                                        "format": "uuid",
                                        "description": "ID de uma resposta anterior; sem ele, começa uma nova conversa"
                                    },
                                    "model": {
                                        "type": "string",
                                        "description": "Alias de modelo de GET /models; o padrão é flowai"
                                    },
                                    "stream": {
                                        "type": "boolean",
                                        "description": "true retorna a resposta como server-sent events; padrão false"
                                    }
                                },
                                "required": [
                                    "message"
                                ]
                            },
                            "example": {
                                "message": "Fasse unsere Lieferbedingungen zusammen.",
                                "model": "claude"
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/chat/{conversation_uuid}": {
            "get": {
                "operationId": "chat-show",
                "summary": "Consultar a última resposta de uma conversa",
                "description": "Retorna o turno mais recente de uma conversa sem iniciar um novo.",
                "tags": [
                    "chat"
                ],
                "parameters": [
                    {
                        "name": "conversation_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "chat",
                                    "conversation": "018f1234-5678-7abc-9def-0123456789ab",
                                    "id": "018f9999-1111-7abc-9def-0123456789ab",
                                    "model": "claude",
                                    "status": "completed",
                                    "message": {
                                        "role": "assistant",
                                        "content": "Wir liefern innerhalb von zwei Werktagen."
                                    },
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/files": {
            "post": {
                "operationId": "files-create",
                "summary": "Enviar arquivo",
                "description": "Armazena um arquivo para requisições futuras ao FlowAI. Use multipart/form-data.",
                "tags": [
                    "files"
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "file-018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "file",
                                    "bytes": 2048,
                                    "created_at": 1735000000,
                                    "expires_at": null,
                                    "filename": "analyse.pdf",
                                    "purpose": "user_data",
                                    "status": "processed",
                                    "status_details": null,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Arquivo a enviar"
                                    },
                                    "purpose": {
                                        "type": "string",
                                        "description": "user_data ou vision"
                                    }
                                },
                                "required": [
                                    "file",
                                    "purpose"
                                ]
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "files-list",
                "summary": "Listar arquivos",
                "description": "Lista os arquivos do workspace com cursor estável.",
                "tags": [
                    "files"
                ],
                "parameters": [
                    {
                        "name": "purpose",
                        "in": "query",
                        "required": false,
                        "description": "Filtro: user_data ou vision",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "order",
                        "in": "query",
                        "required": false,
                        "description": "Ordenação: asc ou desc",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Número de 1 a 100",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "required": false,
                        "description": "ID público do arquivo de last_id",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "file-018f1234-5678-7abc-9def-0123456789ab",
                                            "object": "file",
                                            "bytes": 2048,
                                            "filename": "analyse.pdf",
                                            "purpose": "user_data",
                                            "status": "processed"
                                        }
                                    ],
                                    "has_more": false,
                                    "first_id": "file-018f1234-5678-7abc-9def-0123456789ab",
                                    "last_id": "file-018f1234-5678-7abc-9def-0123456789ab",
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/files/{file_uuid}": {
            "get": {
                "operationId": "files-show",
                "summary": "Consultar metadados do arquivo",
                "description": "Retorna os metadados, mas não o conteúdo do arquivo.",
                "tags": [
                    "files"
                ],
                "parameters": [
                    {
                        "name": "file_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "file-018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "file",
                                    "bytes": 2048,
                                    "created_at": 1735000000,
                                    "expires_at": null,
                                    "filename": "analyse.pdf",
                                    "purpose": "user_data",
                                    "status": "processed",
                                    "status_details": null,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "files-delete",
                "summary": "Excluir arquivo",
                "description": "Exclui os bytes armazenados e os metadados.",
                "tags": [
                    "files"
                ],
                "parameters": [
                    {
                        "name": "file_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "file-018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "file",
                                    "deleted": true,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/files/{file_uuid}/content": {
            "get": {
                "operationId": "files-content",
                "summary": "Baixar conteúdo do arquivo",
                "description": "Retorna os bytes armazenados como download, com o tipo de mídia original.",
                "tags": [
                    "files"
                ],
                "parameters": [
                    {
                        "name": "file_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/webhook_endpoints": {
            "post": {
                "operationId": "webhooks-create",
                "summary": "Criar webhook",
                "description": "Registra um destino HTTPS e retorna o segredo de assinatura uma única vez.",
                "tags": [
                    "webhooks"
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "webhook_endpoint",
                                    "url": "https://example.com/flowai",
                                    "events": [
                                        "response.completed"
                                    ],
                                    "description": "Produktiv",
                                    "is_active": true,
                                    "deactivated_at": null,
                                    "deactivation_reason": null,
                                    "last_delivered_at": null,
                                    "created": 1735000000,
                                    "secret": "whsec_example",
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "description": "Endereço HTTPS acessível publicamente, no máximo 2.048 caracteres"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Pelo menos um tipo de evento suportado"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Descrição opcional, no máximo 255 caracteres"
                                    }
                                },
                                "required": [
                                    "url",
                                    "events"
                                ]
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "webhooks-list",
                "summary": "Listar webhooks",
                "description": "Lista os destinos de webhook do workspace, sem segredos.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Número de 1 a 100",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "required": false,
                        "description": "UUID de last_id",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "018f1234-5678-7abc-9def-0123456789ab",
                                            "object": "webhook_endpoint",
                                            "url": "https://example.com/flowai",
                                            "events": [
                                                "response.completed"
                                            ],
                                            "is_active": true
                                        }
                                    ],
                                    "has_more": false,
                                    "first_id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "last_id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/webhook_endpoints/{webhook_uuid}": {
            "get": {
                "operationId": "webhooks-show",
                "summary": "Consultar webhook",
                "description": "Retorna um destino de webhook sem o segredo de assinatura.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "webhook_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "webhook_endpoint",
                                    "url": "https://example.com/flowai",
                                    "events": [
                                        "response.completed"
                                    ],
                                    "description": "Produktiv",
                                    "is_active": true,
                                    "deactivated_at": null,
                                    "deactivation_reason": null,
                                    "last_delivered_at": null,
                                    "created": 1735000000,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "webhooks-update",
                "summary": "Alterar webhook",
                "description": "Altera destino, eventos, descrição ou status de ativação.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "webhook_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "webhook_endpoint",
                                    "url": "https://example.com/flowai",
                                    "events": [
                                        "response.completed"
                                    ],
                                    "description": "Aktualisiert",
                                    "is_active": true,
                                    "deactivated_at": null,
                                    "deactivation_reason": null,
                                    "last_delivered_at": null,
                                    "created": 1735000000,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "description": "Novo endereço HTTPS acessível publicamente"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Nova lista de tipos de evento suportados"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Nova descrição ou null"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Desativa ou reativa o destino"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "webhooks-delete",
                "summary": "Excluir webhook",
                "description": "Exclui o destino e o histórico de entregas.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "webhook_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "object": "webhook_endpoint",
                                    "deleted": true,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/webhook_endpoints/{webhook_uuid}/deliveries": {
            "get": {
                "operationId": "webhook-deliveries-list",
                "summary": "Listar entregas",
                "description": "Lista as tentativas de entrega com status e detalhes de erro.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "webhook_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "pending, delivered, failed ou exhausted",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Número de 1 a 100",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "required": false,
                        "description": "UUID de last_id",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "018f1234-5678-7abc-9def-0123456789ab",
                                            "object": "webhook_delivery",
                                            "event_type": "response.completed",
                                            "status": "delivered",
                                            "attempts": 1,
                                            "http_status": 200,
                                            "failure_kind": null,
                                            "created": 1735000000,
                                            "delivered_at": 1735000001,
                                            "failed_at": null,
                                            "next_attempt_at": null,
                                            "response_id": "resp_01HXYZ…"
                                        }
                                    ],
                                    "has_more": false,
                                    "first_id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "last_id": "018f1234-5678-7abc-9def-0123456789ab",
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/webhook_endpoints/{webhook_uuid}/test": {
            "post": {
                "operationId": "webhooks-test",
                "summary": "Enviar entrega de teste",
                "description": "Coloca na fila uma entrega sintética do tipo webhook.test. O resultado aparece no histórico de entregas como qualquer outra entrega.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "webhook_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "webhook_delivery",
                                    "uuid": "018f1234-5678-7abc-9def-0123456789ab",
                                    "status": "pending",
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/flowai/v1/webhook_endpoints/{webhook_uuid}/rotate_secret": {
            "post": {
                "operationId": "webhooks-rotate-secret",
                "summary": "Trocar o segredo",
                "description": "Gera um novo segredo de assinatura e o retorna uma única vez. O segredo anterior continua válido até o momento indicado. Exige uma chave de administração.",
                "tags": [
                    "webhooks"
                ],
                "parameters": [
                    {
                        "name": "webhook_uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Resposta bem-sucedida",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "object": "webhook_endpoint",
                                    "uuid": "018f1234-5678-7abc-9def-0123456789ab",
                                    "secret": "whsec_example",
                                    "secondary_secret_expires_at": 1735086400,
                                    "flowai_request_id": "01HXYZ…ULID"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Resposta de erro",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Chave de API (pk_… ou at_…) como Authorization: Bearer <chave>. Qualquer outra forma de envio é recusada com 401."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object"
                    }
                }
            }
        }
    }
}