# Preview a report schedule — API reference

> Calculates the next run and reporting range for the supplied schedule settings.

Source: https://upfour.io/docs/api/reports/preview-a-report-schedule

[Developers](https://upfour.io/docs/api.md)/[Reports](https://upfour.io/docs/api/reports.md)

Calculates the next run and reporting range for the supplied schedule settings.

POST https://app.upfour.io/v1/reports/schedules/preview

scope report.read stable [Idempotency-Key supported](https://upfour.io/docs/api/idempotency.md) returns 200

## Body

`application/json` required 13 fields

cadencestring (required)

weeklymonthly

namestring (required)

1 to 200 characters without line breaks.

recipientsstring (email)[] (required)

1 to 50 distinct email addresses.

report_typestring (required)

executive_summarysummarymonitor_reportmonitorsmonitor_slaslaincident_analyticsincidentsresponse_timeresponse-timedowntime_ledgerdowntime-ledgertrends

All other fields9 fields

client_iduuid · nullable

Report on one client; omitted means the Company level. On update, omitting it keeps the schedule's client.

day_of_monthinteger · nullable

Required for monthly: 1 to 28.

day_of_weekinteger · nullable

Required for weekly: 1 (Monday) to 7 (Sunday).

enabledboolean · nullable

true when omitted, on update too.

formatstring

Defaults to pdf.

csvjsonpdfxlsx

languagestring · nullable

en or de (a region such as de-DE or the language name is accepted); null or empty inherits from the client, then the Company.

paramsobjectfree-form keys

Frozen report parameters: preset, from and to (the window, as in the query of the report endpoints), target (SLA target in percent, above 0 up to 100) and filters (monitor, severity and search narrowing; region, tag and group filters are refused). Without a window a weekly schedule reports the last 7 days and a monthly one the previous month.

send_hourinteger

Hour of the day, 0 to 23, in timezone. 0 when omitted.

timezonestring

IANA time zone; UTC when omitted.

## Returns

A successful request returns `200` with application/json.

Response fields 1 top-level fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | ReportSchedulePreview | |
| ReportSchedulePreview · 8 fields FieldTypeDescription `next_run_at` string (date-time) `period` string The window the next run would report, as text. `range` ReportRange ReportRange · 5 fields FieldTypeDescription `from` string (date-time) `to` string (date-time) `clamped` boolean true when the window was cut to the plan's history. `preset` string one of`24h` `1d` `7d` `30d` `90d` `mtd` `last_month` `qtd` `ytd` `timezone` string | | |

## Errors

Only the errors this operation can return. Every error uses the [same envelope](https://upfour.io/docs/api/responses.md).

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | [bad_request](https://upfour.io/docs/api/errors#code-bad_request) | The request is malformed or fails validation. |
| 403 | [permission_denied](https://upfour.io/docs/api/errors#code-permission_denied) | The credentials do not permit this action. |

Every call can also return `unauthorized` (401), `rate_limit_exceeded` (429) or `internal_error` (500 / 502). See [Responses and errors](https://upfour.io/docs/api/responses.md).

[PreviousCreate a report schedule](https://upfour.io/docs/api/reports/create-a-report-schedule.md) [NextGet a report schedule](https://upfour.io/docs/api/reports/get-a-report-schedule.md)

## Request

### cURL

```bash
curl -s -X POST "https://app.upfour.io/v1/reports/schedules/preview" \
  -H "Authorization: Bearer $UP4_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cadence": "weekly",
    "day_of_week": 1,
    "enabled": true,
    "format": "pdf",
    "language": "en",
    "name": "Weekly summary",
    "recipients": [
      "anna@example.com"
    ],
    "report_type": "summary",
    "send_hour": 8,
    "timezone": "Europe/Berlin"
  }'
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/reports/schedules/preview", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UP4_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    cadence: "weekly",
    day_of_week: 1,
    enabled: true,
    format: "pdf",
    language: "en",
    name: "Weekly summary",
    recipients: ["anna@example.com"],
    report_type: "summary",
    send_hour: 8,
    timezone: "Europe/Berlin",
  }),
});
console.log(res.status, await res.json());
```

### Python

```python
import os
import requests

res = requests.post(
    "https://app.upfour.io/v1/reports/schedules/preview",
    headers={"Authorization": f"Bearer {os.environ['UP4_API_KEY']}"},
    json={
        "cadence": "weekly",
        "day_of_week": 1,
        "enabled": True,
        "format": "pdf",
        "language": "en",
        "name": "Weekly summary",
        "recipients": ["anna@example.com"],
        "report_type": "summary",
        "send_hour": 8,
        "timezone": "Europe/Berlin",
    },
)
print(res.status_code, res.json())
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "cadence": "weekly",
  "day_of_week": 1,
  "enabled": true,
  "format": "pdf",
  "language": "en",
  "name": "Weekly summary",
  "recipients": [
    "anna@example.com"
  ],
  "report_type": "summary",
  "send_hour": 8,
  "timezone": "Europe/Berlin"
}`)
	req, _ := http.NewRequest("POST", "https://app.upfour.io/v1/reports/schedules/preview", payload)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("UP4_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(res.StatusCode, string(out))
}
```

### PHP

```php
<?php
$payload = <<<'JSON'
{
  "cadence": "weekly",
  "day_of_week": 1,
  "enabled": true,
  "format": "pdf",
  "language": "en",
  "name": "Weekly summary",
  "recipients": [
    "anna@example.com"
  ],
  "report_type": "summary",
  "send_hour": 8,
  "timezone": "Europe/Berlin"
}
JSON;

$ch = curl_init("https://app.upfour.io/v1/reports/schedules/preview");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("UP4_API_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), " ", $response, "\n";
curl_close($ch);
```

## Response

### 200

```json
{
  "data": {
    "next_run_at": "2026-11-01T23:55:00Z",
    "period": "26 Oct 2026 00:55:00 - 2 Nov 2026 00:55:00 (end exclusive) · Europe/Berlin",
    "range": {
      "from": "2026-10-25T23:55:00Z",
      "preset": "7d",
      "timezone": "Europe/Berlin",
      "to": "2026-11-01T23:55:00Z"
    }
  }
}
```

### 400

```json
{
  "error": {
    "code": "bad_request",
    "message": "The request is malformed or fails validation.",
    "request_id": "req_…"
  }
}
```

### 403

```json
{
  "error": {
    "code": "permission_denied",
    "message": "The credentials do not permit this action.",
    "request_id": "req_…"
  }
}
```
