> ## Documentation Index
> Fetch the complete documentation index at: https://developers.gyramais.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Criar Relatório (v2)

> Dispara uma nova análise de crédito para CPF ou CNPJ com o payload revisado da v2.

<Endpoint
  method="POST"
  path="/v2/report"
  headers={[
{
  name: "Authorization",
  type: "string",
  required: true,
  description: "Token JWT no formato Bearer. Exemplo: `Bearer abc123`"
}
]}
  requestBody={{
contentType: "application/json",
body: {
  document: "43591367000130",
  type: "cnpj",
  policyId: "69a1fbb06a44799c9c440d2d"
}
}}
  responses={{
200: {
  contentType: "application/json",
  body: {
    id: "69a207bcdd0197828df9155a",
    status: "PROCESSING",
    createdAt: "2026-02-27T21:08:11.938Z",
    updatedAt: "2026-02-27T21:08:11.938Z"
  }
},
401: {
  contentType: "application/json",
  body: {
    code: 401,
    message: "Token de acesso inválido."
  }
}
}}
/>

### Quando usar

Use este endpoint para iniciar uma nova análise de crédito para CPF ou CNPJ. A chamada é assíncrona: retorna imediatamente o `id` do relatório com status inicial `PROCESSING` e você recebe o resultado final via webhook ou consultando `GET /v2/report/{id}`.

### Autenticação

Bearer JWT no header `Authorization`.

### Parâmetros

| Nome       | Local  | Tipo     | Obrigatório | Descrição                                                                            |
| ---------- | ------ | -------- | ----------- | ------------------------------------------------------------------------------------ |
| `document` | `body` | `string` | `sim`       | CPF (11 dígitos) ou CNPJ (14 dígitos), somente números.                              |
| `type`     | `body` | `string` | `sim`       | Tipo do documento. Valores aceitos: `cpf` ou `cnpj`.                                 |
| `policyId` | `body` | `string` | `sim`       | ID da política de decisão que será aplicada. Obtenha em `GET /credit-policy/policy`. |

### Corpo da requisição

```json theme={null}
{
  "document": "43591367000130",
  "type": "cnpj",
  "policyId": "69a1fbb06a44799c9c440d2d"
}
```

<RequestExample>
  ```bash cURL theme={null}
  curl --location 'https://gyra-core.gyramais.com.br/v2/report' \
  --header 'Authorization: Bearer abc123' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "document": "43591367000130",
    "type": "cnpj",
    "policyId": "69a1fbb06a44799c9c440d2d"
  }'
  ```

  ```javascript JavaScript theme={null}
  fetch("https://gyra-core.gyramais.com.br/v2/report", {
    method: "POST",
    headers: {
      Authorization: "Bearer abc123",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      document: "43591367000130",
      type: "cnpj",
      policyId: "69a1fbb06a44799c9c440d2d"
    })
  })
    .then(res => res.json())
    .then(console.log)
  ```

  ```python Python theme={null}
  import requests

  url = "https://gyra-core.gyramais.com.br/v2/report"
  headers = {
    "Authorization": "Bearer abc123",
    "Content-Type": "application/json"
  }
  payload = {
    "document": "43591367000130",
    "type": "cnpj",
    "policyId": "69a1fbb06a44799c9c440d2d"
  }

  response = requests.post(url, headers=headers, json=payload)
  print(response.json())
  ```
</RequestExample>

<Tip>
  A requisição retorna o `id` e o status inicial do relatório. Você pode configurar um webhook para receber a conclusão em tempo real ou consultar `GET /v2/report/{id}` para obter o status atualizado.
</Tip>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id": "69a207bcdd0197828df9155a",
    "policyId": "69a1fbb06a44799c9c440d2d",
    "document": "43591367000130",
    "policyStatus": "PENDING",
    "status": {
      "id": "6614758260513064a5af1046",
      "value": "PENDING",
      "title": "Não iniciado"
    },
    "createdAt": "2026-02-27T21:08:11.938Z",
    "updatedAt": "2026-02-27T21:08:11.938Z"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "code": 400,
    "message": "document should not be empty,type must be one of the following values: cpf, cnpj"
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "code": 401,
    "message": "Token de acesso inválido."
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "code": 500,
    "message": "Cannot read properties of undefined (reading 'replace')"
  }
  ```
</ResponseExample>
