# Relatório de alunos inativos (BETA)

### Endpoint

<mark style="color:red;">`GET`</mark>` ``URL_BASE/partners/reports/inactive-students/{developer_token}/{platform_token}`

### Parâmetros de query

| Nome        | Tipo      | Obrigatório | Descrição                                                                        |
| ----------- | --------- | ----------- | -------------------------------------------------------------------------------- |
| `date_from` | `string`  | Sim         | Data inicial do período, formato `Y-m-d` (início do dia no servidor).            |
| `date_to`   | `string`  | Sim         | Data final do período, formato `Y-m-d` (fim do dia). Deve ser **≥** `date_from`. |
| `limit`     | `integer` | Não         | Tamanho da página. Entre **2** e **500**. Padrão **500**.                        |
| `cursor`    | `string`  | Não         | Cursor devolvido em `next_cursor` para a página seguinte.                        |

### Cabeçalhos HTTP

| Cabeçalho | Obrigatório | Observação          |
| --------- | ----------- | ------------------- |
| `Accept`  | Recomendado | `application/json`. |

### Exemplo de requisição

```http
GET /api/partners/reports/inactive-students/{developer_token}/{platform_token}?date_from=2025-01-01&date_to=2025-12-31&limit=50 HTTP/1.1
Accept: application/json
```

Substitua `{developer_token}` e `{platform_token}` pelos valores reais (sem chaves na URL final).

### Resposta (`200 OK`)

Paginação por **cursor**: `data`, `path`, `per_page`, `next_cursor`, `next_page_url`, `prev_cursor`, `prev_page_url`.&#x20;

#### Campos de cada item em `data`

| Campo                                                   | Descrição                                           |
| ------------------------------------------------------- | --------------------------------------------------- |
| `id`                                                    | ID da assinatura (`user_subscription.id`).          |
| `user_id`                                               | UUID do **aluno**.                                  |
| `first_name`, `last_name`, `phone`, `document`, `email` | Dados cadastrais do aluno.                          |
| `registration_date`                                     | `accession_date` da assinatura.                     |
| `last_access_at`                                        | Último login do aluno.                              |
| `subscription_expiration_date`                          | Data de expiração da assinatura.                    |
| `subscription_cancel_date`                              | Data de cancelamento (critério do relatório).       |
| `product_name`                                          | Título do pacote.                                   |
| `trail_completion_percent`                              | Percentual de aulas concluídas na trilha do pacote. |

### Exemplo de resposta (trecho)

```json
{
  "data": [
    {
      "id": 4810806,
      "user_id": "uuid-do-aluno",
      "first_name": "Maria",
      "last_name": "Silva",
      "phone": null,
      "document": "12345678900",
      "email": "maria@exemplo.com",
      "registration_date": "2024-06-01 10:00:00",
      "last_access_at": "2024-11-15 08:30:00",
      "subscription_expiration_date": "2025-06-01 00:00:00",
      "subscription_cancel_date": "2025-02-19 14:22:00",
      "product_name": "Produto Exemplo",
      "trail_completion_percent": "45.00"
    }
  ],
  "path": "/api/partners/reports/inactive-students/…",
  "per_page": 50,
  "next_cursor": "eyJ1c3UuaWQiOi4uLn0",
  "next_page_url": "/api/partners/reports/inactive-students/…?cursor=…",
  "prev_cursor": null,
  "prev_page_url": null
}
```

Os valores de `path` e `next_page_url` no ambiente real incluem host e query string completos.

### Paginação

1. Na **primeira** chamada, envie `date_from`, `date_to` e, se quiser, `limit`.
2. Nas **próximas** páginas, repita **os mesmos** `date_from`, `date_to` e `limit` e acrescente `cursor` com o valor de `next_cursor` (ou use `next_page_url`, conferindo se todos os query params necessários estão presentes).

Se a segunda página retornar **422** ou lista vazia indevida, verifique se `date_from`, `date_to` e `limit` foram reenviados junto com `cursor`.

### Erros

**Exemplo de corpo em validação (`422`):**

```json
{
  "message": "The given data was invalid.",
  "errors": {
    "date_from": ["The date from field is required."]
  }
}
```

| HTTP    | Situação                                                                 |
| ------- | ------------------------------------------------------------------------ |
| **401** | `developer_token` ou `platform_token` inválido ou ausente.               |
| **422** | Datas ausentes, formato inválido ou `limit` fora do intervalo permitido. |
| **403** | Possível bloqueio por WAF quando `User-Agent` não é enviado.             |


---

# 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://documentation.themembers.dev.br/relatorios/relatorio-de-alunos-inativos-beta.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.
