# Create

## Gerar Relatório

## Gera um relatório com os parâmetros indicados.

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

#### Request Body

| Name                                            | Type    | Description                                                                                                                                   |
| ----------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| report\_id<mark style="color:red;">\*</mark>    | integer | <p>ID do Relatório</p><p><br>Consulte a tabela <a href="../../apendice#lista-de-relatorios-campo-report_id">Apêndice</a> para saber mais.</p> |
| initial\_date<mark style="color:red;">\*</mark> | string  | <p>Data de Início.<br>Formato: YYYY-MM-DD</p>                                                                                                 |
| end\_date<mark style="color:red;">\*</mark>     | string  | <p>Data de Fim.<br>Formato: YYYY-MM-DD</p>                                                                                                    |
| format                                          | string  | <p>Formato do Relatório. Por omissão, usa formato json.<br><br>Formatos disponíveis:<br>- ticket<br>- json<br>- csv</p>                       |
| use\_work\_schedule                             | boolean | Usar Horário de Fecho de Caixa. Por omissão, usa falso                                                                                        |
| salesman\_id                                    | integer | <p>ID do Vendedor.</p><p><br>Consulte a tabela Vendedores para saber mais.</p>                                                                |
| customer\_id                                    | integer | <p>ID do Cliente.</p><p><br>Consulte a tabela Clientes para saber mais.</p>                                                                   |
| product\_id                                     | integer | <p>ID do Produto.</p><p><br>Consulte a tabela Produtos para saber mais.</p>                                                                   |

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

```shell
curl -X POST https://api.cloudinvoice.net/reports/new/
    -d '{
        "report_id": "1001",
        "initial_date": "2024-01-01",
        "end_date": "2024-12-31",
        "format": "json",
        "use_work_schedule": false,
        "salesman_id": 1,
        "customer_id": 1,
        "product_id": 1
    }'
```

{% endtab %}

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

<pre class="language-json"><code class="lang-json">[
    {
<strong>        "title": "Total por Empregado",
</strong>        "header":[
            "Empregado",
            "Comissao",
            "Valor"
        ],
        "data":[
            ["Empregado 1", "0.00", "20761.91"],
            ["Empregado 2_", "0.00", "3035.22"],
            ["Gerente", "0.00", "1249.75"],
            ["Balcao", "0.00", "201.80"]
        ],
        "footer":[
            "Total",
            "0.00",
            "25248.68"
        ]
    },
    {
        "title": "Total por Empregado/Data",
        "header":[
            "Empregado",
            "Data",
            "Valor"
        ],
        "data":[
            ["Empregado 1", "2024-03-29", "37.25" ], 
            ["Empregado 1", "2024-01-03", "2.90"],
        ]
        "footer":[
            "Total",
            "",
            "25248.68"
        ]
    }
]
</code></pre>

{% endtab %}
{% endtabs %}

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