> For the complete documentation index, see [llms.txt](https://docs.barte.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.barte.com/api-reference/comprovantes/carta-de-cancelamento-de-transacao.md).

# Carta de Cancelamento de Transação

## Gerar carta de cancelamento

> Gera a carta de cancelamento de uma cobrança específica.\
> \
> O parâmetro \`download\` controla o comportamento do PDF:\
> \- Se \`download=true\`: ao clicar na URL, o PDF é baixado automaticamente\
> \- Se \`download=false\`: ao clicar na URL, o PDF abre no navegador (sem download automático)<br>

```json
{"openapi":"3.0.0","info":{"title":"API de Cancellation Letter - Charges","version":"1.0.0"},"servers":[{"url":"https://api.barte.com","description":"Servidor de produção"},{"url":"https://sandbox-api.barte.com","description":"Servidor de sandbox"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Token-Api"}},"schemas":{"CancellationLetterResponse":{"type":"object","properties":{"message":{"type":"string","description":"Mensagem de sucesso da geração do comprovante"},"url":{"type":"string","format":"uri","description":"URL temporária para acesso ao PDF da carta de cancelamento"},"expiresInSeconds":{"type":"integer","description":"Tempo de expiração da URL em segundos"}}},"ValidationError":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}}}},"AuthenticationError":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}}}},"NotFoundError":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}}}},"UnprocessableEntityError":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}}}},"InternalError":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}}}}}},"paths":{"/v2/charges/{chargeUuid}/cancellation-letter":{"get":{"summary":"Gerar carta de cancelamento","description":"Gera a carta de cancelamento de uma cobrança específica.\n\nO parâmetro `download` controla o comportamento do PDF:\n- Se `download=true`: ao clicar na URL, o PDF é baixado automaticamente\n- Se `download=false`: ao clicar na URL, o PDF abre no navegador (sem download automático)\n","tags":["Charges"],"parameters":[{"name":"X-Token-Api","in":"header","required":true,"schema":{"type":"string","format":"uuid"},"description":"Token de autenticação do vendedor"},{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"Tipo de conteúdo da requisição"},{"name":"chargeUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Identificador único da cobrança"},{"name":"download","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Define se o PDF deve ser baixado automaticamente ou apenas visualizado no navegador.\n- `true`: baixar automaticamente\n- `false`: abrir no navegador (padrão)\n"}],"responses":{"200":{"description":"Carta de cancelamento gerada com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationLetterResponse"}}}},"400":{"description":"Erro na requisição","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"401":{"description":"Não autorizado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticationError"}}}},"403":{"description":"Acesso negado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"404":{"description":"Cobrança não encontrada","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}}},"422":{"description":"Status inválido da cobrança","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableEntityError"}}}},"500":{"description":"Erro interno do servidor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalError"}}}}}}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.barte.com/api-reference/comprovantes/carta-de-cancelamento-de-transacao.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
