> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pingoai.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotas completas do backend

> Inventario completo de endpoints ativos do Backend-1 com auth e codigos de resposta esperados.

## Padrao de respostas e codigos

### Sucesso (padrao pratico)

* `200 OK`: leitura, atualizacao, acoes customizadas.
* `201 Created`: criacao (nem todos os controllers usam 201, alguns retornam 200).
* `204 No Content`: delete sem corpo (quando implementado assim no controller).

### Erro (padrao global da aplicacao)

Middleware global em `Backend-1/src/app.ts`:

* Erros de negocio (`AppError`): retorna `statusCode` e corpo:

```json theme={null}
{
  "error": "Mensagem do erro"
}
```

* Erros nao tratados: `500` com corpo:

```json theme={null}
{
  "error": "Internal server error"
}
```

### Codigos comuns por middleware

* `401`: token ausente/invalido (`isAuth`, `tokenAuth`, `isAuthCompany`)
* `403`: sem permissao de perfil/plano (quando controller valida autorizacao)
* `404`: recurso nao encontrado
* `422`: payload invalido/regra de validacao (dependendo do controller)

## Convencao de auth desta pagina

* `isAuth`: JWT da plataforma (usuario logado).
* `tokenAuth`: token da API oficial (`/api/messages/*`).
* `isAuthCompany`: token de integracao company API (`/api/*`).
* `nenhum`: rota publica/webhook.

## Endpoints ativos por modulo

### Auth

* `GET /auth/consulta-cnpj/:cnpj` — auth: `nenhum`
* `POST /auth/signup` — auth: `nenhum`
* `POST /auth/login` — auth: `nenhum`
* `POST /auth/refresh_token` — auth: `nenhum`
* `DELETE /auth/logout` — auth: `isAuth`
* `GET /auth/me` — auth: `isAuth`

### Usuarios

* `GET /users` — `isAuth`
* `GET /users/list` — `isAuth`
* `POST /users` — `isAuth`
* `PUT /users/:userId` — `isAuth`
* `GET /users/:userId` — `isAuth`
* `DELETE /users/:userId` — `isAuth`
* `POST /users/:userId/media-upload` — `isAuth`
* `PUT /users/toggleChangeWidht/:userId` — `isAuth`

### Empresas e planos

* `GET /companies/list` — `isAuth`
* `GET /companies` — `isAuth`
* `GET /companies/:id` — `isAuth`
* `POST /companies` — `isAuth`
* `PUT /companies/:id` — `isAuth`
* `PUT /companies/:id/schedules` — `isAuth`
* `DELETE /companies/:id` — `isAuth`
* `GET /companies/listPlan/:id` — `isAuth`
* `GET /companiesPlan` — `isAuth`
* `GET /companies/:id/disk-usage` — `isAuth`
* `GET /plans` — `isAuth`
* `GET /plans/list` — `nenhum`
* `GET /plans/all` — `isAuth`
* `GET /plans/:id` — `isAuth`
* `POST /plans` — `isAuth`
* `PUT /plans/:id` — `isAuth`
* `DELETE /plans/:id` — `isAuth`

### Configuracoes

* `GET /settings` — `isAuth`
* `GET /settings/:settingKey` — `isAuth`
* `PUT /settings/:settingKey` — `isAuth`
* `GET /setting/:settingKey` — `isAuth`
* `PUT /setting/:settingKey` — `isAuth`
* `GET /public-settings/:settingKey` — `nenhum`
* `POST /settings-whitelabel/logo` — `isAuth`
* `POST /settings-whitelabel/login` — `isAuth`
* `POST /settings/privateFile` — `isAuth`
* `GET /companySettings` — `isAuth`
* `GET /companySettings/:companyId` — `isAuth`
* `GET /companySettingOne/` — `isAuth`
* `PUT /companySettings/` — `isAuth`

### Contatos

* `POST /contacts/import` — `isAuth`
* `POST /contactsImport` — `isAuth`
* `GET /contacts` — `isAuth`
* `GET /contacts/list` — `isAuth`
* `GET /contacts/:contactId` — `isAuth`
* `POST /contacts` — `isAuth`
* `PUT /contacts/:contactId` — `isAuth`
* `DELETE /contacts/:contactId` — `isAuth`
* `PUT /contacts/toggleAcceptAudio/:contactId` — `isAuth`
* `GET /contacts/profile/:number` — `isAuth`
* `PUT /contacts/block/:contactId` — `isAuth`
* `POST /contacts/upload` — `isAuth`
* `GET /contactTags/:contactId` — `isAuth`
* `PUT /contacts/toggleDisableBot/:contactId` — `isAuth`
* `PUT /contact-wallet/:contactId` — `isAuth`
* `PUT /contacts/:contactId/link-user` — `isAuth`
* `PUT /contacts/:contactId/unlink-user` — `isAuth`

### Tickets e mensagens

* `PUT /tickets/:ticketId/ignore` — `isAuth`
* `GET /tickets` — `isAuth`
* `GET /tickets/count` — `isAuth`
* `GET /tickets/:ticketId` — `isAuth`
* `GET /tickets-log/:ticketId` — `isAuth`
* `GET /ticket/kanban` — `isAuth`
* `GET /ticketreport/reports` — `isAuth`
* `GET /tickets/u/:uuid` — `isAuth`
* `POST /tickets` — `isAuth`
* `PUT /tickets/:ticketId` — `isAuth`
* `DELETE /tickets/:ticketId` — `isAuth`
* `POST /tickets/closeAll` — `isAuth`
* `POST /lgpd-response` — `isAuth`
* `GET /messages/media` — `isAuth`
* `GET /messages/:ticketId` — `isAuth`
* `POST /messages/:ticketId` — `isAuth`
* `DELETE /messages/:messageId` — `isAuth`
* `POST /messages/edit/:messageId` — `isAuth`
* `GET /messages-allMe` — `isAuth`
* `POST /message/forward` — `isAuth`
* `POST /messages/:ticketId/catalog` — `isAuth`

### WhatsApp, Facebook e sessoes

* `GET /whatsapp/` — `isAuth`
* `GET /whatsapp/filter` — `isAuth`
* `GET /whatsapp/all` — `isAuth`
* `POST /whatsapp/` — `isAuth`
* `POST /facebook/` — `isAuth`
* `GET /whatsapp/:whatsappId` — `isAuth`
* `PUT /whatsapp/:whatsappId` — `isAuth`
* `DELETE /whatsapp/:whatsappId` — `isAuth`
* `POST /closedimported/:whatsappId` — `isAuth`
* `POST /whatsapp-restart/` — `isAuth`
* `POST /whatsapp/:whatsappId/media-upload` — `isAuth`
* `DELETE /whatsapp/:whatsappId/media-upload` — `isAuth`
* `DELETE /whatsapp-admin/:whatsappId` — `isAuth`
* `PUT /whatsapp-admin/:whatsappId` — `isAuth`
* `GET /whatsapp-admin/:whatsappId` — `isAuth`
* `POST /whatsappsession/:whatsappId` — `isAuth`
* `PUT /whatsappsession/:whatsappId` — `isAuth`
* `DELETE /whatsappsession/:whatsappId` — `isAuth`
* `POST /api/whatsapp-microservice/webhook` — `nenhum`

### Filas, tags, chatbot e campanhas

* `GET /queue` — `isAuth`
* `GET /queue/user` — `isAuth`
* `POST /queue` — `isAuth`
* `GET /queue/:queueId` — `isAuth`
* `PUT /queue/:queueId` — `isAuth`
* `DELETE /queue/:queueId` — `isAuth`
* `GET /debug-queues` — `nenhum`
* `GET /queue-options` — `isAuth`
* `POST /queue-options` — `isAuth`
* `GET /queue-options/:queueOptionId` — `isAuth`
* `PUT /queue-options/:queueOptionId` — `isAuth`
* `DELETE /queue-options/:queueOptionId` — `isAuth`
* `GET /queueIntegration` — `isAuth`
* `POST /queueIntegration` — `isAuth`
* `GET /queueIntegration/:integrationId` — `isAuth`
* `PUT /queueIntegration/:integrationId` — `isAuth`
* `DELETE /queueIntegration/:integrationId` — `isAuth`
* `POST /queueIntegration/testsession` — `isAuth`
* `GET /tags/list` — `isAuth`
* `GET /tags` — `isAuth`
* `GET /tags/:tagId` — `isAuth`
* `GET /tag/kanban` — `isAuth`
* `POST /tags` — `isAuth`
* `POST /tags/sync` — `isAuth`
* `PUT /tags/:tagId` — `isAuth`
* `DELETE /tags/:tagId` — `isAuth`
* `DELETE /tags-contacts/:tagId/:contactId` — `isAuth`
* `PUT /ticket-tags/:ticketId/:tagId` — `isAuth`
* `DELETE /ticket-tags/:ticketId` — `isAuth`
* `GET /chatbot` — `isAuth`
* `POST /chatbot` — `isAuth`
* `GET /chatbot/:chatbotId` — `isAuth`
* `PUT /chatbot/:chatbotId` — `isAuth`
* `DELETE /chatbot/:chatbotId` — `isAuth`
* `GET /campaigns/list` — `isAuth`
* `GET /campaigns` — `isAuth`
* `GET /campaigns/:id` — `isAuth`
* `POST /campaigns` — `isAuth`
* `PUT /campaigns/:id` — `isAuth`
* `DELETE /campaigns/:id` — `isAuth`
* `POST /campaigns/:id/cancel` — `isAuth`
* `POST /campaigns/:id/restart` — `isAuth`
* `POST /campaigns/:id/media-upload` — `isAuth`
* `DELETE /campaigns/:id/media-upload` — `isAuth`
* `GET /campaign-settings` — `isAuth`
* `POST /campaign-settings` — `isAuth`

### Contact lists, anuncios e chats internos

* `GET /contact-lists/list` — `isAuth`
* `GET /contact-lists` — `isAuth`
* `GET /contact-lists/:id` — `isAuth`
* `POST /contact-lists` — `isAuth`
* `POST /contact-lists/:id/upload` — `isAuth`
* `PUT /contact-lists/:id` — `isAuth`
* `DELETE /contact-lists/:id` — `isAuth`
* `GET /contact-list-items/list` — `isAuth`
* `GET /contact-list-items` — `isAuth`
* `GET /contact-list-items/:id` — `isAuth`
* `POST /contact-list-items` — `isAuth`
* `PUT /contact-list-items/:id` — `isAuth`
* `DELETE /contact-list-items/:id` — `isAuth`
* `GET /announcements/list` — `isAuth`
* `GET /announcements` — `isAuth`
* `GET /announcements/:id` — `isAuth`
* `POST /announcements` — `isAuth`
* `PUT /announcements/:id` — `isAuth`
* `DELETE /announcements/:id` — `isAuth`
* `POST /announcements/:id/media-upload` — `isAuth`
* `DELETE /announcements/:id/media-upload` — `isAuth`
* `GET /chats` — `isAuth`
* `GET /chats/:id` — `isAuth`
* `GET /chats/:id/messages` — `isAuth`
* `POST /chats/:id/messages` — `isAuth`
* `POST /chats/:id/read` — `isAuth`
* `POST /chats` — `isAuth`
* `PUT /chats/:id` — `isAuth`
* `DELETE /chats/:id` — `isAuth`

### Dashboard, estatisticas, agendas e transcricao

* `GET /dashboard` — `isAuth`
* `GET /dashboard/ticketsUsers` — `isAuth`
* `GET /dashboard/ticketsDay` — `isAuth`
* `GET /dashboard/moments` — `isAuth`
* `GET /dashboard/extended-metrics` — `isAuth`
* `GET /dashboard/top-contacts` — `isAuth`
* `POST /dashboard/clear-cache` — `isAuth`
* `POST /dashboard/refresh-views` — `isAuth`
* `GET /usersMoments` — `isAuth`
* `GET /contacts-report` — `isAuth`
* `GET /schedules` — `isAuth`
* `POST /schedules` — `isAuth`
* `PUT /schedules/:scheduleId` — `isAuth`
* `GET /schedules/:scheduleId` — `isAuth`
* `DELETE /schedules/:scheduleId` — `isAuth`
* `POST /schedules/:id/media-upload` — `isAuth`
* `DELETE /schedules/:id/media-upload` — `isAuth`
* `GET /schedules-message` — `isAuth`
* `POST /schedules-message` — `isAuth`
* `PUT /schedules-message/:scheduleId` — `isAuth`
* `GET /schedules-message/:scheduleId` — `isAuth`
* `DELETE /schedules-message/:scheduleId` — `isAuth`
* `POST /transcription/:ticketId` — `isAuth`
* `GET /transcription-credentials` — `isAuth`
* `GET /transcription-credentials/default` — `isAuth`
* `PUT /transcription-credentials/default` — `isAuth`
* `POST /transcription-credentials` — `isAuth`
* `PUT /transcription-credentials/:id` — `isAuth`
* `DELETE /transcription-credentials/:id` — `isAuth`

### Files, prompts, proxy e utilitarios

* `GET /files/list` — `isAuth`
* `GET /files` — `isAuth`
* `POST /files` — `isAuth`
* `PUT /files/:fileId` — `isAuth`
* `GET /files/:fileId` — `isAuth`
* `DELETE /files/:fileId` — `isAuth`
* `DELETE /files` — `isAuth`
* `POST /files/uploadList/:fileListId` — `isAuth`
* `GET /prompt` — `isAuth`
* `POST /prompt` — `isAuth`
* `GET /prompt/:promptId` — `isAuth`
* `PUT /prompt/:promptId` — `isAuth`
* `DELETE /prompt/:promptId` — `isAuth`
* `GET /proxy` — `isAuth`
* `POST /proxy` — `isAuth`
* `PUT /proxy/:id` — `isAuth`
* `DELETE /proxy/:id` — `isAuth`
* `GET /proxy/stats` — `isAuth`
* `POST /proxy/auto-balance` — `isAuth`
* `POST /proxy/force-reassign` — `isAuth`
* `POST /proxy/force-rebalance-all` — `isAuth`
* `POST /proxy/disable-problematic/:proxyId` — `isAuth`
* `POST /proxy/assign/:whatsappId` — `isAuth`
* `DELETE /proxy/remove/:whatsappId` — `isAuth`
* `GET /version` — `nenhum`
* `POST /version` — `nenhum`

### Catalogo, produtos e pedidos

* `GET /products` — `isAuth`
* `GET /products/:productId` — `isAuth`
* `POST /products` — `isAuth`
* `PUT /products/:productId` — `isAuth`
* `DELETE /products` — `isAuth`
* `POST /products/:productId/images` — `isAuth`
* `DELETE /products/:productId/images/:imageId` — `isAuth`
* `POST /products/import` — `isAuth`
* `GET /products/import/status` — `isAuth`
* `GET /products/import/:id` — `isAuth`
* `GET /categories` — `isAuth`
* `GET /categories/all` — `isAuth`
* `POST /categories` — `isAuth`
* `PUT /categories/:id` — `isAuth`
* `DELETE /categories` — `isAuth`
* `GET /orders` — `isAuth`
* `GET /orders/contact/:contactId` — `isAuth`
* `GET /orders/:orderId` — `isAuth`
* `POST /orders` — `isAuth`
* `PUT /orders/:orderId` — `isAuth`
* `DELETE /orders` — `isAuth`
* `GET /orders/:orderId/logs` — `isAuth`
* `GET /order-settings` — `isAuth`
* `GET /order-settings/:id` — `isAuth`
* `POST /order-settings` — `isAuth`
* `PUT /order-settings/:id` — `isAuth`
* `DELETE /order-settings/:id` — `isAuth`
* `GET /minio-configs` — `isAuth`
* `GET /minio-configs/:id` — `isAuth`
* `POST /minio-configs` — `isAuth`
* `PUT /minio-configs/:id` — `isAuth`
* `DELETE /minio-configs/:id` — `isAuth`
* `POST /minio-configs/test-connection` — `isAuth`

### Fluxos (Flow Builder)

* `GET /flows` — `isAuth`
* `POST /flows` — `isAuth`
* `GET /flows/:flowId` — `isAuth`
* `PUT /flows/:flowId` — `isAuth`
* `DELETE /flows/:flowId` — `isAuth`
* `PUT /flows/:flowId/graph` — `isAuth`
* `POST /flows/:flowId/publish` — `isAuth`
* `POST /flows/:flowId/simulate` — `isAuth`
* `POST /flows/:flowId/nodes` — `isAuth`
* `PUT /flows/:flowId/nodes/:nodeId` — `isAuth`
* `DELETE /flows/:flowId/nodes/:nodeId` — `isAuth`
* `POST /flows/:flowId/edges` — `isAuth`
* `DELETE /flows/:flowId/edges/:edgeId` — `isAuth`
* `POST /flows/:flowId/execute` — `isAuth`
* `POST /ai-agent/optimize-prompt` — `isAuth`
* `GET /flowBuilder/ai-agent/options` — `isAuth`
* `POST /flowBuilder/ai-agent/config-chat` — `isAuth`

### Templates e sellers

* `GET /company-templates` — `isAuth`
* `GET /company-templates/:id` — `isAuth`
* `POST /company-templates` — `isAuth`
* `PUT /company-templates/:id` — `isAuth`
* `DELETE /company-templates/:id` — `isAuth`
* `GET /waba-templates` — `isAuth`
* `POST /send-waba-template` — `isAuth`
* `GET /contact-sellers/sellers` — `isAuth`
* `GET /contact-sellers/responsible/:contactId` — `isAuth`
* `PUT /contact-sellers/assign/:contactId` — `isAuth`

### Assinaturas, invoices e webhooks

* `POST /subscription` — `isAuth`
* `POST /subscription/create/webhook` — `nenhum`
* `DELETE /subscription/create/webhook` — `isAuth`
* `POST /subscription/return/c5c0f5a4-efe2-447f-8c73-55f8c0f07284/pix` — `nenhum`
* `GET /invoices` — `isAuth`
* `GET /invoices/:Invoiceid` — `isAuth`
* `PUT /invoices/:id` — `isAuth`
* `GET /` — `nenhum`
* `POST /` — `nenhum`
* `GET /webhook/` — `nenhum`
* `POST /webhook/` — `nenhum`

### API company (`/api/*`)

* `GET /api/plans` — `isAuthCompany`
* `GET /api/plans/:id` — `isAuthCompany`
* `POST /api/plans` — `isAuthCompany`
* `PUT /api/plans/:id` — `isAuthCompany`
* `DELETE /api/plans/:id` — `isAuthCompany`
* `GET /api/companies` — `isAuthCompany`
* `GET /api/companies/:id` — `isAuthCompany`
* `GET /api/companiesEmail/:email` — `isAuthCompany`
* `POST /api/companies` — `isAuthCompany`
* `PUT /api/companies/:id` — `isAuthCompany`
* `PUT /api/companies/:id/schedules` — `isAuthCompany`
* `DELETE /api/companies/:id` — `isAuthCompany`
* `GET /api/helps` — `isAuthCompany`
* `GET /api/helps/:id` — `isAuthCompany`
* `POST /api/helps` — `isAuthCompany`
* `PUT /api/helps/:id` — `isAuthCompany`
* `DELETE /api/helps/:id` — `isAuthCompany`
* `GET /api/partners` — `isAuthCompany`
* `GET /api/partners/:id` — `isAuthCompany`
* `POST /api/partners` — `isAuthCompany`
* `PUT /api/partners/:id` — `isAuthCompany`
* `DELETE /api/partners/:id` — `isAuthCompany`
* `GET /api/invoices` — `isAuthCompany`
* `GET /api/invoices/:id` — `isAuthCompany`
* `GET /api/invoicesCompany/:companyId` — `isAuthCompany`
* `POST /api/invoices` — `isAuthCompany`
* `PUT /api/invoices/:id` — `isAuthCompany`
* `DELETE /api/invoices/:id` — `isAuthCompany`
* `GET /api/users/:email` — `isAuthCompany`
* `GET /api/contacts` — `isAuthCompany`
* `GET /api/contacts-count` — `isAuthCompany`
* `GET /api/messagesRange` — `isAuthCompany`

## Observacao sobre rotas nao montadas

`signedUrlRoutes.ts` define endpoints, mas nao esta registrado em `routes/index.ts`; portanto nao esta ativo globalmente no backend atual.
