# Create

## Criar Distrito

## Cria um novo distrito.

<mark style="color:green;">`POST`</mark> `https://api.cloudinvoice.net/districts/new/`

#### Request Body

| Name                                          | Type                                                                      | Description                                                                                                                                                                                                                                                                    |
| --------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| code<mark style="color:red;">\*</mark>        | <p>string<br><sub><mark style="color:$info;">Valor Único</mark></sub></p> | Código                                                                                                                                                                                                                                                                         |
| description<mark style="color:red;">\*</mark> | string                                                                    | Descrição                                                                                                                                                                                                                                                                      |
| country\_id                                   | integer                                                                   | <p>País</p><p><br>Consulte a tabela <a href="/pages/zDxRAoofNg5nAbyoGGBy">Países</a> para saber mais.</p>                                                                                                                                                                      |
| territory\_id                                 | integer                                                                   | <p>Território</p><p></p><p>Consulte a tabela <a href="/pages/Le16rQ3NG33zktn1PTI4#territorios-campo-territory">Apêndice</a> para saber mais.</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> Aplicável apenas se o País for Portugal.</p> |

{% tabs %}
{% tab title="Exemplo de Pedido" %}

```shell
curl -X POST https://api.cloudinvoice.net/districts/new/
    -d '{
        "code": "D1",
        "description": "Distrito #1"
    }'
```

{% endtab %}

{% tab title="Exemplo de Resposta" %}

```json
{
    "id": 30,
    "code": "D1",
    "description": "Distrito #1",
    "country_id": 1,
    "country": {
        "code": "PT",
        "country_name": "Portugal"
    },
    "territory_id": 101,
    "territory": {
        "code": "CO",
        "description": "Continente"
    }
}
```

{% endtab %}
{% endtabs %}

Para ver exemplos de pedidos nas várias linguagens, consulte a página[ Exemplos de Pedidos.](/introducao/exemplos-de-pedidos.md)


---

# 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://apidocs.cloudinvoice.net/documentacao-api/distritos/create.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.
