> For the complete documentation index, see [llms.txt](https://docs.floui.io/guia/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.floui.io/guia/conectores/categorias/servicos-externos/viacep/consulta-cep-com-viacep.md). Agents can also search and read this documentation through its [MCP server](https://docs.floui.io/guia/~gitbook/mcp).

# Consulta CEP com ViaCEP

Utilize a biblioteca do ViaCEP para validar campos de CEP em território brasileiro.

{% hint style="warning" %}
O Floui não assume qualquer responsabilidade ou controle sobre a administração dos dados referenciados pela API fornecida pela ViaCEP, tampouco oferece garantias quanto à estabilidade das requisições. Sugerimos que você se familiarize com os campos e padrões de retorno consultando informações adicionais em <https://viacep.com.br/>.
{% endhint %}

{% tabs %}
{% tab title="Parâmetros" %}

<figure><img src="https://215079342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F226k0cnPTn1PWu9xHcK8%2Fuploads%2Ff5bZxSSvfsaTpm4pVtX8%2Fimage.png?alt=media&amp;token=5a7ac26f-dbcc-49bc-9b12-9b1b0c253f52" alt=""><figcaption><p>Parâmetros de configuração.</p></figcaption></figure>

| Campo             | Tipo           | Descrição                                                                                              |
| ----------------- | -------------- | ------------------------------------------------------------------------------------------------------ |
| Descrição         | Campo de texto | Descrição visual do conector no editor de fluxos                                                       |
| CEP para pesquisa | Campo de texto | Define o CEP de busca válido no território nacional com 8 dígitos (com ou sem pontuação).              |
| Output Path       | Campo de texto | Refere-se ao caminho do resultado da requisição na saída do conector no contexto de execução do fluxo. |
| {% endtab %}      |                |                                                                                                        |

{% tab title="Payload" %}

## Sucesso

Por padrão, o conector retornará a seguinte estrutura JSON em caso de sucesso, incluindo não apenas os dados do CEP consultado, mas também informações detalhadas da requisição ao ViaCEP, como `request`, `response` e `headers`.

<figure><img src="https://215079342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F226k0cnPTn1PWu9xHcK8%2Fuploads%2FrmwkBS8UyeMFGntzTq6v%2Fimage.png?alt=media&amp;token=712d0d38-f7e1-4e6a-98bc-2948c8c81cb7" alt=""><figcaption><p>Sucesso na consulta de CEP</p></figcaption></figure>

## Erro

Se o CEP informado não for encontrado, a API retornará uma mensagem de erro indicando a falha na consulta.

<figure><img src="https://215079342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F226k0cnPTn1PWu9xHcK8%2Fuploads%2FGp1NviVgwNsif1VAOh6g%2Fimage.png?alt=media&amp;token=703a006e-843d-491f-8095-13a6d59c988c" alt=""><figcaption><p>Erro na consulta de CEP</p></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# 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://docs.floui.io/guia/conectores/categorias/servicos-externos/viacep/consulta-cep-com-viacep.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.
