# Automated Reports

**Summary:** Endpoints for Automated Reports

- Role: [Developers](https://www.subrite.no/developers)
- Source: https://www.subrite.no/developers/automated-reports
- Updated: 2026-10-13
- Markdown index: https://www.subrite.no/developers/llms.txt

<a id="get-api-v1-automated-reports"></a>
## Get all automated reports

`GET /api/v1/automated-reports`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"` · Default: `"createdAt"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |
| `status` | query | `string` | Allowed values: `"active"`, `"draft"` |
| `frequency` | query | `string` | Allowed values: `"monthly"`, `"weekly"`, `"daily"` |

### Responses

#### 200

Content type: `application/json` · `AutomatedReportResponseDtoPaginated`

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of AutomatedReportResponseDto` |   |
| `items[].id` (Required when parent is present) | `string` |   |
| `items[].name` (Required when parent is present) | `string` |   |
| `items[].status` (Required when parent is present) | `AutomatedReportStatus` | Allowed values: `"active"`, `"draft"` |
| `items[].frequency` (Required when parent is present) | `AutomatedReportFrequency` | Allowed values: `"monthly"`, `"weekly"`, `"daily"` |
| `items[].cronExpression` (Required when parent is present) | `string` |   |
| `items[].schedule` | `object` | Can be null |
| `items[].sendTime` (Required when parent is present) | `string` |   |
| `items[].recipientUserIds` | `array of string` | Can be null |
| `items[].externalEmails` | `array of string` | Can be null |
| `items[].selectedSections` (Required when parent is present) | `array of AutomatedReportSection` | Allowed values: `"sales_statistics"`, `"sales_by_reference"`, `"mrr"`, `"subscriptions"`, `"cashflow"`, `"consents"`, `"consent_changes"` |
| `items[].includeDashboardLink` (Required when parent is present) | `boolean` |   |
| `items[].lastSent` | `string (date-time)` | Can be null |
| `items[].nextScheduledAt` | `string (date-time)` | Can be null |
| `items[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].recipientCount` (Required when parent is present) | `number` | Total number of recipients (users + external emails) |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 401

unauthorized

### Example request

```bash
curl https://api.subrite.no/api/v1/automated-reports \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "items": [
    {
      "schedule": {},
      "recipientUserIds": [],
      "externalEmails": [],
      "selectedSections": []
    }
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="post-api-v1-automated-reports"></a>
## Create a new automated report

`POST /api/v1/automated-reports`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `CreateAutomatedReportDto`

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` | Name of the report |
| `status` | `string` | Allowed values: `"active"`, `"draft"` · Default: `"draft"` |
| `frequency` (Required) | `string` | Allowed values: `"monthly"`, `"weekly"`, `"daily"` · Default: `"monthly"` |
| `sendTime` | `string` | Send time in HH:mm format · Default: `"09:00"` · `pattern`: `/^([01]?[0-9]\|2[0-3]):[0-5][0-9]$/` |
| `recipientUserIds` | `array of string` | Array of user IDs to receive the report |
| `externalEmails` | `array of string (email)` | Array of external email addresses |
| `selectedSections` (Required) | `array of string` | Sections to include in the report · Allowed values: `"sales_statistics"`, `"sales_by_reference"`, `"mrr"`, `"subscriptions"`, `"cashflow"`, `"consents"`, `"consent_changes"` |
| `includeDashboardLink` | `boolean` | Include link to dashboard · Default: `true` |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "sendTime": "09:00",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "user@example.com"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true
}
```

### Responses

#### 201

Content type: `application/json` · `AutomatedReportResponseDto`

| Name | Type | Description |
| --- | --- | --- |
| `id` (Required) | `string` |   |
| `name` (Required) | `string` |   |
| `status` (Required) | `AutomatedReportStatus` | Allowed values: `"active"`, `"draft"` |
| `frequency` (Required) | `AutomatedReportFrequency` | Allowed values: `"monthly"`, `"weekly"`, `"daily"` |
| `cronExpression` (Required) | `string` |   |
| `schedule` | `object` | Can be null |
| `sendTime` (Required) | `string` |   |
| `recipientUserIds` | `array of string` | Can be null |
| `externalEmails` | `array of string` | Can be null |
| `selectedSections` (Required) | `array of AutomatedReportSection` | Allowed values: `"sales_statistics"`, `"sales_by_reference"`, `"mrr"`, `"subscriptions"`, `"cashflow"`, `"consents"`, `"consent_changes"` |
| `includeDashboardLink` (Required) | `boolean` |   |
| `lastSent` | `string (date-time)` | Can be null |
| `nextScheduledAt` | `string (date-time)` | Can be null |
| `createdAt` (Required) | `string (date-time)` |   |
| `updatedAt` (Required) | `string (date-time)` |   |
| `recipientCount` (Required) | `number` | Total number of recipients (users + external emails) |

#### 400

Content type: `application/json` · `ErrorResponse`

atLeastOneSectionMustBeSelected

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` |   |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

### Example request

```bash
curl https://api.subrite.no/api/v1/automated-reports \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "sendTime": "09:00",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "user@example.com"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true
}'
```

### Example response

201 · `application/json`

```json
{
  "id": "string",
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "cronExpression": "string",
  "schedule": {},
  "sendTime": "string",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "string"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true,
  "lastSent": "2019-08-24T14:15:22Z",
  "nextScheduledAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "recipientCount": 0
}
```

<a id="get-api-v1-automated-reports-id"></a>
## Get automated report by ID

`GET /api/v1/automated-reports/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `string` |   |

### Responses

#### 200

Content type: `application/json` · `AutomatedReportResponseDto`

Same fields as [Create a new automated report (201)](https://www.subrite.no/developers/automated-reports?md=true#post-api-v1-automated-reports).

#### 401

unauthorized

#### 404

Report not found

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automated-reports/{id}' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "id": "string",
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "cronExpression": "string",
  "schedule": {},
  "sendTime": "string",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "string"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true,
  "lastSent": "2019-08-24T14:15:22Z",
  "nextScheduledAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "recipientCount": 0
}
```

<a id="put-api-v1-automated-reports-id"></a>
## Update an automated report

`PUT /api/v1/automated-reports/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `string` |   |

### Request body

Content type: `application/json` · Required · `UpdateAutomatedReportDto`

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | Name of the report |
| `status` | `string` | Allowed values: `"active"`, `"draft"` · Default: `"draft"` |
| `frequency` | `string` | Allowed values: `"monthly"`, `"weekly"`, `"daily"` · Default: `"monthly"` |
| `sendTime` | `string` | Send time in HH:mm format · Default: `"09:00"` · `pattern`: `/^([01]?[0-9]\|2[0-3]):[0-5][0-9]$/` |
| `recipientUserIds` | `array of string` | Array of user IDs to receive the report |
| `externalEmails` | `array of string (email)` | Array of external email addresses |
| `selectedSections` | `array of string` | Sections to include in the report · Allowed values: `"sales_statistics"`, `"sales_by_reference"`, `"mrr"`, `"subscriptions"`, `"cashflow"`, `"consents"`, `"consent_changes"` |
| `includeDashboardLink` | `boolean` | Include link to dashboard · Default: `true` |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "sendTime": "09:00",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "user@example.com"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true
}
```

### Responses

#### 200

Content type: `application/json` · `AutomatedReportResponseDto`

Same fields as [Create a new automated report (201)](https://www.subrite.no/developers/automated-reports?md=true#post-api-v1-automated-reports).

#### 401

unauthorized

#### 404

Report not found

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automated-reports/{id}' \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "sendTime": "09:00",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "user@example.com"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true
}'
```

### Example response

200 · `application/json`

```json
{
  "id": "string",
  "name": "string",
  "status": "active",
  "frequency": "monthly",
  "cronExpression": "string",
  "schedule": {},
  "sendTime": "string",
  "recipientUserIds": [
    "string"
  ],
  "externalEmails": [
    "string"
  ],
  "selectedSections": [
    "sales_statistics"
  ],
  "includeDashboardLink": true,
  "lastSent": "2019-08-24T14:15:22Z",
  "nextScheduledAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "recipientCount": 0
}
```

<a id="delete-api-v1-automated-reports-id"></a>
## Delete an automated report

`DELETE /api/v1/automated-reports/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `string` |   |

### Responses

#### 204

Report deleted

#### 401

unauthorized

#### 404

Report not found

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automated-reports/{id}' \
  --request DELETE \
  --header 'Authorization: Bearer <token>'
```
