---
title: "Generate ad-hoc report"
method: POST
path: "/reports/{reportId}/files"
tags: ["reports"]
---

# Generate ad-hoc report

`POST /reports/{reportId}/files`

## Request

- Base URL: `https://api.smartrecruiters.com/reporting-api/v201804`
- URL: `https://api.smartrecruiters.com/reporting-api/v201804/reports/{reportId}/files`
- Auth: one of:
  - API key in header `x-smarttoken`
  - OAuth 2
    - Authorization code: `https://www.smartrecruiters.com/identity/oauth/allow`
    - Client credentials
    - Token URL: `https://api.smartrecruiters.com/identity/oauth/token` scopes: `reporting_write`

Use this endpoint to generate ad-hoc report.
NOTE: Report files are generated asynchronously. Ensure the report file status is: COMPLETED before fetching the data. To check the report file status use the GET /reports/{reportId}/files/recent endpoint.

## Path parameters

- `reportId` string, required

## Response `200`

Successful response.

- ApiReportFileResponse
  - `reportFileId` string
  - `reportId` string
  - `reportFileStatus` 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED'
  - `scheduleType` 'AD_HOC' | 'SCHEDULED'
  - `schedulingDate` string, date-time
  - `generationDate` string, date-time
  - `requestorId` string
  - `accessGroupId` string
  - `systemRoleId` string
  - `rowEntityTypeId` string
  - `rowEntityInstanceId` string
  - `columns` ApiColumnResponse[]
    - `entityTypeId` string
    - `entityInstanceId` string
    - `dataPointId` string
    - `dataPointInstanceId` string
    - `dataPointInstanceName` string
    - `dataPointName` string
    - `dataPointType` 'ID' | 'DATE' | 'NUMBER' | 'TEXT' | 'ENUM' | 'BOOLEAN' | 'DECIMAL'
  - `filters` ApiFilterResponse[]
    - `column` ApiColumnResponse
      - `entityTypeId` string
      - `entityInstanceId` string
      - `dataPointId` string
      - `dataPointInstanceId` string
      - `dataPointInstanceName` string
      - `dataPointName` string
      - `dataPointType` 'ID' | 'DATE' | 'NUMBER' | 'TEXT' | 'ENUM' | 'BOOLEAN' | 'DECIMAL'
    - `dateRange` ApiDateRange
      - `from` string, date-time
      - `to` string, date-time
    - `datePeriod` ApiDatePeriod
      - `period` integer, required
      - `unit` 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS', required
      - `fullPeriod` boolean
    - `rowValues` ApiRowValues
      - `noneValue` boolean
      - `values` string[], required
    - `booleanValue` ApiBooleanValue
      - `value` boolean
  - `errorReason` 'UNKNOWN' | 'MISSING_ACCESS_GROUP' | 'ACCESS_GROUP_MISMATCH' | 'MISSING_SYSTEM_ROLE' | 'SYSTEM_ROLE_MISMATCH' | 'REPORTING_AREA_RESTRICTED' | 'INCORRECT_ACCESS_CONFIGURATION' | 'MISSING_REPORT_CREATOR_EMPLOYEE' | 'MAX_REPORT_FILE_SIZE_EXCEEDED'
  - `details` ApiReportFileDetailsResponse
    - `size` integer
    - `numberOfRows` integer

## Other responses

- `400`: Returned when the report ID or the identity is invalid or the report is already pending generation.
- `401`: Returned when a request was not authenticated.
- `403`: Returned when a caller is not authorized to perform the request.
- `404`: Returned when there is no report with the given ID.
- `409`: Returned when the report was modified concurrently.

---

[API](https://skmtc.dev/smartrecruiters/apis/reporting-api.md) - [All operations](https://skmtc.dev/smartrecruiters/apis/reporting-api/llms.txt) - [OpenAPI document](https://skmtc.dev/smartrecruiters/apis/reporting-api/revisions/c6a3adb80a12?raw)
