> For the complete documentation index, see [llms.txt](https://ajuda.zdg.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajuda.zdg.com.br/central-do-assinante/referencia-da-api/envio-por-ticket.md).

# 🎯 Envio Por Ticket

## SendMessageByTicket

> Endpoint com mais de um formato de payload na coleção oficial: \*\*SendMessageByTicketText\*\*, \*\*SendMessageByTicketFile\*\*, \*\*SendMessageByTicketMediaUrl\*\*, \*\*SendMessageByTicketBase64\*\*. Veja os exemplos do corpo para escolher a variante.

```json
{"openapi":"3.0.3","info":{"title":"Z-PRO — API Externa","version":"v4.x.x.x"},"tags":[{"name":"🎯 Envio por Ticket"}],"servers":[{"url":"https://{baseUrl}","description":"Instalação Z-PRO do cliente","variables":{"baseUrl":{"default":"api.seudominio.com.br","description":"Domínio do backend Z-PRO, sem protocolo e sem barra final."}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Token da API do tenant (na coleção Postman: `BearerToken`)."}},"parameters":{"ApiId":{"name":"apiId","in":"path","required":true,"description":"ID da API externa cadastrada no Z-PRO.","schema":{"type":"string"}}}},"paths":{"/v2/api/external/{apiId}/sendMessageByTicket":{"post":{"tags":["🎯 Envio por Ticket"],"summary":"SendMessageByTicket","operationId":"SendMessageByTicketText","parameters":[{"$ref":"#/components/parameters/ApiId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"integer","description":"ID do ticket (conversa) que recebera a mensagem"},"body":{"type":"string","description":"Texto da mensagem (obrigatorio quando nao ha midia)"},"externalKey":{"type":"string","description":"Chave unica p/ idempotencia (recomendado)"},"reopen":{"type":"boolean","description":"Reabrir ticket fechado antes de enviar (sem isto, ticket fechado retorna 409)"},"isClosed":{"type":"boolean","description":"Fechar o ticket apos o envio"}},"required":["body"]}},"multipart/form-data":{"schema":{"type":"object","properties":{"media":{"type":"string","format":"binary"},"ticketId":{"type":"string"},"body":{"type":"string"},"externalKey":{"type":"string"},"reopen":{"type":"string"},"isClosed":{"type":"string"}},"required":["media"]}}}},"responses":{"200":{"description":"Requisição processada com sucesso.","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Parâmetros inválidos ou faltando."},"401":{"description":"Token ausente, inválido ou sem permissão."}},"description":"Endpoint com mais de um formato de payload na coleção oficial: **SendMessageByTicketText**, **SendMessageByTicketFile**, **SendMessageByTicketMediaUrl**, **SendMessageByTicketBase64**. Veja os exemplos do corpo para escolher a variante."}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ajuda.zdg.com.br/central-do-assinante/referencia-da-api/envio-por-ticket.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
