# Clientes

## Cadastrar Cliente

## Cadastrar Cliente

<mark style="color:green;">`POST`</mark> `clientes/cadastrar`

Função responsável pelo cadastro de clientes na plataforma.

Atenção. Campos personalizáveis não disponíveis nessa versão.

#### Request Body

| Name                                      | Type   | Description                                                                                                                               |
| ----------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| nome<mark style="color:red;">\*</mark>    | String | nome do cliente                                                                                                                           |
| email<mark style="color:red;">\*</mark>   | Email  | email do cliente                                                                                                                          |
| senha<mark style="color:red;">\*</mark>   | String | senha do cliente                                                                                                                          |
| cpfCnpj<mark style="color:red;">\*</mark> | String | cpf ou CNPJ do cliente com mascara                                                                                                        |
| cidade                                    | String |                                                                                                                                           |
| bairro                                    | String |                                                                                                                                           |
| numero                                    | String |                                                                                                                                           |
| endereco                                  | String |                                                                                                                                           |
| estado                                    | String | UF do Estado                                                                                                                              |
| cep                                       | String | CEP com mascara                                                                                                                           |
| status                                    | String | <p>Status do cliente.</p><p>S -> ativo,</p><p>I -> Inativo,</p><p>N -> Bloqueado.</p><p></p><p>Se não informado adotará S como padrão</p> |

{% tabs %}
{% tab title="200: OK Retorna objeto com status e dados do cliente cadastrado" %}

```json
{
    "status": "sucesso",
    "dados": {
        "id_cliente": 100147,
        "nome": "Lorena silva Sauro",
        "cpf_cnpj": "733.757.510-60",
        "empresa": null,
        "email": "sdfsdf@hotmail.com",
        "telefone": null,
        "celular": null,
        "endereco": null,
        "numero": null,
        "bairro": null,
        "cidade": null,
        "estado": null,
        "cep": null,
        "status": "S",
        "observacoes": null,
        "email_alternativo": null,
        "frase_seguranca": null,
        "notafiscal": "0",
        "senha": "89794b621a313bb59eed0d9f0f4e8205",
        "data_cadastro": "2023-07-28 13:33:53",
        "token": "292d9d4220e37ab0a8fc5bddeae0ac61",
        "token_faturas": "e491261808e99152909718d28250370b"
    }
}
```

{% endtab %}

{% tab title="404: Not Found Objeto com informações sobre o erro" %}

```json
{
    "status": "erro",
    "dados": "Campo cpfCnpj é de preenchimento obrigatório"
}
```

{% endtab %}
{% endtabs %}

### Listar todos os clientes

## Listar Clientes

<mark style="color:blue;">`GET`</mark> `/clientes/listar`

Lista todos os clientes vinculados na base de consulta.&#x20;

Filtros estão disponíveis

#### Query Parameters

| Name      | Type   | Description                                                                                                        |
| --------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| registros | Number | <p>Quantidade de registros a serem listados por consulta (pagina)<br><br>Se não informado, adota 20 por padrão</p> |
| pagina    | Number | <p>Página atual da consulta (registros listados em paginação)<br>padrão: 1</p>                                     |
| nome      | String | Filtra busca pelo nome                                                                                             |
| cpfCnpj   | Number | Filtra pelo CPF ou CNPJ do cliente. (apenas números)                                                               |
| empresa   | String | Filtra pelo campo empresa (razão social)                                                                           |
| telefone  | Number | filtra pelo campo telefone (apenas números)                                                                        |
| email     | Email  | Filtra pelo email do cliente                                                                                       |
| status    | Status | <p>Filtra pelo status do cliente</p><p><br>S -> Ativo<br>I -> Inativo</p><p>N -> Bloqueado</p>                     |

{% tabs %}
{% tab title="200: OK Retora " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

### Busca um cliente determinado

## Busca dados de um cliente determinado

<mark style="color:blue;">`GET`</mark> `/clientes/listar/{ID}`

responsável por listar dados de um cliente.

#### Path Parameters

| Name | Type   | Description                                                                                          |
| ---- | ------ | ---------------------------------------------------------------------------------------------------- |
| ID   | Number | ID do cliente. Esse id pode ser obtido na lista de clientes ou ao buscar faturas, domínios e contas. |

{% tabs %}
{% tab title="200: OK retorna um Objeto com os dados do cliente" %}

```json
{
    "status": "sucesso",
    "dados": [
        {
            "id_cliente": "1",
            "nome": "Fernando Ramos",
            "empresa": "HOSTMGR",
            "cpf_cnpj": "999.999.999-99",
            "email": "xxxxxxxxxxx@hotmail.com",
            "telefone": "2733333333",
            "celular": "27999999999",
            "endereco": "Nome da Rua",
            "numero": "224",
            "bairro": "bairro",
            "cidade": "São Mateus",
            "estado": "ES",
            "cep": "99999999",
            "status": "S",
            "observacoes": "",
            "data_cadastro": "0000-00-00 00:00:00",
            "data_login": "2023-06-21 17:10:07",
            "afiliado": "0",
            "email_alternativo": "",
            "token": "5e6b9699ge5d1e1ffb963833ccd4d2c8",
            "token_faturas": "5s6332f58750f3bc154f714622caa8e6",
            "frase_seguranca": "frase de segurança do cliente",
            "idioma": null,
            "notafiscal": "0"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Erro na consulta" %}

```json
{
    "status": "erro",
    "dados": "não há clientes cadastrados"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://hostmgr.gitbook.io/desenvolvedores/api-reference/clientes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
