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

# 4.2 Start report generation

> Request fields, sample payload, response, and security limits for the implemented legacy orchestration starter.

## Operation

```
POST /api/orchestrators/report-automation
```

**Status:** Implemented in repository code.

**Contract status:** Provisional because no reviewed OpenAPI specification exists.

## Request body

| Field | Type | Required by code | Notes |
| - | - | - | - |
| `client` | object | Yes | Must contain `username` and `password`. |
| `client.name` | string | Used | Used in the PDF filename. |
| `client.logo` | string | Used | Inserted into report HTML as an image URL. |
| `url` | string | Yes | Target portal URL. |
| `devices` | array | Yes | Must be non-empty, but only the first item is processed. |
| `devices[0].device_id` | string | Used | Portal search value and report identifier. |
| `devices[0].temp_threshold.min` | number | Used | Low-alarm threshold. |
| `devices[0].temp_threshold.max` | number | Used | High-alarm threshold. |
| `fromDate` | value accepted by portal input | Yes | Formal format is not validated by application code. |
| `toDate` | value accepted by portal input | Yes | Formal format is not validated by application code. |
| `sentTo` | array of strings | Yes | Joined into the email recipient field. |

## SAMPLE ONLY request

```json theme={null}
{
  "client": {
    "name": "Example Client",
    "username": "sample-user",
    "password": "sample-password",
    "logo": "https://example.invalid/logo.png"
  },
  "url": "https://example.invalid/device-portal",
  "devices": [
    {
      "device_id": "SAMPLE-DEVICE-001",
      "temp_threshold": {
        "min": 2,
        "max": 8
      }
    }
  ],
  "fromDate": "2026-10-01",
  "toDate": "2026-10-02",
  "sentTo": [
    "recipient@example.invalid"
  ]
}
```

## Response

The handler returns the Durable Functions check-status response created by `client.createCheckStatusResponse`.

The exact response schema is runtime-owned and is not defined in this repository.

A successful start normally provides an instance identifier and management URLs, but deployed behavior must be verified before documenting an exact contract.

## Errors

The repository does not define HTTP validation error responses.

Input errors occur later in the report-generation activity and affect orchestration state.

Caller-visible error codes and payloads remain `TBD`.

## Security warning

The request carries portal credentials.

Do not send it without an approved authenticated transport and server-side caller authorization.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.