---
title: "Create a new batch report task."
method: POST
path: "/orgs/{orgId}/tasks/reports"
tags: ["orgs/tasks"]
---

# Create a new batch report task.

`POST /orgs/{orgId}/tasks/reports`

The report's time filter can be specified either via the `relativeTime` field or via the `filter` field.<br/><br/>The `relativeTime` field supports these possible values: today, thisWeek, thisMonth, thisQuarter, thisYear, lastHour, last4Hours, last12Hours, last24Hours, last7Days, last30Days, yesterday, lastFullWeek, lastFullMonth, lastFullQuarter, lastFullYear, last6FullMonths, last12FullMonths.<br/><br/>The `options` field supports `withWeekends` which is used for `occupancyOrg` reports.The `filter` field specifies the report date and time range and other filters. It uses the same syntax and field names from the `/orgs/{orgId}/reports/activity` API. Example: `"filter": "time:(1609459200--1612137600)"` means filter to all records with a `/orgs/{orgId}/reports/activity` `time` field value of `Jan 1, 2021 00:00:00 UTC` inclusive to `Feb 1, 2021 00:00:00 UTC` inclusive. If you also wanted to filter for `sideIds`, you would specify `"filter": "time:(1609459200--1612137600) siteId:(123,456,789)"`. That will return results for that same date range plus filtering for `siteIds` 123, 456, or 789.<br/><br/>The `columns` field is an in-order list of CSV columns to output. Possible values depend on the report type: For activityLogsOrg, the possible values are `time`, `category`, `subCategory`, `result`, `device`, `deviceDetail`, `deviceDetailName`, `deviceTimezone`, `deviceTime`, `user`, `userEmail`, `userOrg`, `userIdpName`, `userExternalId`, `initialCredentialTypeName`, `initialCredentialDetail`, `credentialTypeName`, `credentialDetail`, `target`, `initialRequest`, `request`, `location`, `entryName`, `entryName2`, `zoneName`, `zoneName2`, `siteName`, `siteName2`, `source`, `deniedReason`, `requestId`. For alarmsOrg, the possible values are `alarmId`, `alarmConfigName`, `time`, `eventName`, `siteName2`, `zoneName2`, `entryName2`, `alarmActionName`, `userName`, `assignee`, `alarmStatusName`, `acuName`, `readerName`, `note`. For occupancyOrg, the possible values are `user`, `userEmail`, `userGroups`. Include a `customFieldIdx#` column name to specify `customFieldIds` column placement. Example: where `customFieldId` for id `49` has a name of `Department` and the payload is `..., "columns": ["time", "category", "customFieldIdx0"], "customFieldIds": [49], ...` means output `"time", "category", "Department"` column headers and subsequent lines with respective values in that `columns` specified order. In this example, customFieldIdx0 is the 0th index in the `customFieldsIds` array.<br/><br/>The difference between entryName, zoneName, and siteName vs. entryName2, zoneName2, and siteName2 is that the `*Name2` fields can potentially return "Multiple" as the name. This occurs when there are multiple unique ids for that resource type. Whereas the entryId, entryName, zoneId, zoneName, siteId, and siteName values always equal the first entry's values (entries[0]).<br/><br/>The expiresAfter specification can be specified either via a concrete date in `expiresAfter` or via a relative number of days from the `expiresAfterDays` field.<br/><br/>__JWT is required for this endpoint with at least one of the following scopes__: o{params.orgId}-rpt:w,o{params.orgId}-rptGeneral:w,o-support:w,o:w,s-o:w<br/><br/>__Endpoint name__: createTasksReport

## Path parameters

- `orgId` integer, required

## Request body

- object
  - `executionType` 'immediate' | 'scheduled'
  - `options` string, nullable
  - `expiresAfter` string, date
  - `type` 'activityLogsOrg' | 'alarmsOrg' | 'occupancyOrg' | 'auditLogsOrg', required
  - `name` string, required
  - `filter` string, nullable
  - `relativeTime` 'today' | 'thisWeek' | 'thisMonth' | 'thisQuarter' | 'thisYear' | 'yesterday' | 'lastFullWeek' | 'lastFullMonth' | 'lastFullQuarter' | 'last6FullMonths' | 'last12FullMonths'
  - `customFieldIds` integer[], nullable
  - `destinationEmails` string[], nullable
  - `timeZone` string, nullable
  - `columns` string[], nullable
  - `expiresAfterDays` integer

## Response `201`

Created

- object
  - `data` object
    - `executionType` 'immediate' | 'scheduled'
    - `options` string, nullable
    - `expiresAfter` string, date, required
    - `type` 'activityLogsOrg' | 'alarmsOrg' | 'occupancyOrg' | 'auditLogsOrg', required
    - `name` string
    - `filter` string, nullable
    - `relativeTime` 'today' | 'thisWeek' | 'thisMonth' | 'thisQuarter' | 'thisYear' | 'yesterday' | 'lastFullWeek' | 'lastFullMonth' | 'lastFullQuarter' | 'last6FullMonths' | 'last12FullMonths'
    - `customFieldIds` integer[], nullable
    - `destinationEmails` string[], nullable
    - `timeZone` string, nullable
    - `columns` string[], nullable
    - `id` integer, required
    - `org` object, required
      - `id` integer, required
      - `name` string, required
    - `identity` object, required
      - `id` number, required
      - `opal` string
      - `roles` object[]
        - `id` number, required
        - `name` string
        - `description` string
        - `isMfaRequired` boolean
      - `mfaCredentials` object[]
        - `id` number, required
        - `createdAt` string, date
        - `updatedAt` string, date
        - `name` string
        - `status` string
        - `mfaCredentialType` object
          - `id` number, required
          - `name` string
          - `modelName` string
        - `totpSoftDevice` object
          - `id` number, required
      - `firstName` string, nullable
      - `middleName` string, nullable
      - `lastName` string, nullable
      - `fullName` string, nullable
      - `initials` string, nullable
      - `isEmailVerified` boolean
      - `namespace` object
        - `id` integer, required
        - `nickname` string, nullable
        - `namespaceType` object
          - `id` number, required
          - `name` string
          - `modelName` string, nullable
        - `org` object
          - `id` number, required
          - `name` string
        - `identityProvider` object
          - `id` number, required
          - `isSsoEnabled` boolean
          - `isSyncMobilePhoneEnabled` boolean
          - `isRemoveGroupsEnabled` boolean
          - `identityProviderSyncTypeId` integer, nullable
          - `credentials` string, nullable
          - `identityProviderType` object
            - `id` number, required
            - `name` string
          - `org` object
            - `id` number, required
            - `name` string
      - `idpUniqueIdentifier` string
      - `pmsUniqueIdentifier` string, nullable
      - `needsPasswordChange` boolean
      - `nicknames` object[], nullable
        - `nickname` string
      - `email` string
      - `mobilePhone` string, nullable
      - `language` string, nullable
      - `createdAt` string, date
      - `updatedAt` string, date
      - `users` object[]
        - `id` number, required
        - `opal` string
        - `status` string
        - `startDate` string, date, nullable
        - `endDate` string, date, nullable
        - `createdAt` string, date
        - `updatedAt` string, date
        - `org` object
          - `id` number, required
          - `name` string, nullable
    - `statusCode` 'starting' | 'running' | 'completed.success' | 'completed.failed'
    - `statusFailureCode` 'unexpectedException', nullable
    - `statusDetail` string, nullable
    - `numRecordsProcessed` integer, required
    - `numRecordsOutput` integer, required
    - `createdAt` string, date
    - `updatedAt` string, date
  - `meta` object
    - `accessToken` object, nullable
      - `scopeUpdatedAt` string, date
    - `siteSpecificAccess` object, nullable
      - `isSiteSpecific` boolean
      - `siteIds` integer[], nullable
      - `siteIdsByScope` object, nullable
        - `string` integer[], nullable

---

[API](https://skmtc.net/openpath/apis/openpath-api-documentation.md) · [All operations](https://skmtc.net/openpath/apis/openpath-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openpath/openpath-api-documentation/revisions/d8a888c114fa/schema)
