# Dynamic Report API

Use the Dynamic Report API to fetch employee activity and attendance analytics in JSON format.

It supports explicit field selection. It also supports pagination and filters.

## Overview

* Base URL: `https://api.in.we360.ai`
* Base path: `/query/external/reports/dynamic_report`
* Method: `POST`
* Response type: `application/json`

## Authentication

Send this header with every request:

* `Authorization: Bearer ${access_token}`

Get the token from [OAuth for Direct API Access](/deployment-and-it-ops/readme/integrations/oauth-for-direct-api-access.md).

## Request body

```json
{
  "start_date": "2026-04-01T00:00:00",
  "end_date": "2026-04-07T23:59:59",
  "mode": "detailed",
  "columns": [
    "attendance_date",
    "identity_id",
    "employee_id",
    "first_name",
    "last_name",
    "email",
    "group_name",
    "active_duration",
    "productive_percent"
  ],
  "page": 1,
  "limit": 50,
  "group_id": "",
  "user_id": "",
  "shift": []
}
```

### Parameters

| Parameter    | Required | Description                              |
| ------------ | -------- | ---------------------------------------- |
| `start_date` | Yes      | Start of the ISO datetime range.         |
| `end_date`   | Yes      | End of the ISO datetime range.           |
| `mode`       | Yes      | `summary` or `detailed`.                 |
| `columns`    | Yes      | Explicit list of fields to return.       |
| `page`       | No       | Page number. Default is `1`.             |
| `limit`      | No       | Page size. Use `0` to fetch all records. |
| `group_id`   | No       | Comma-separated group UUID list.         |
| `user_id`    | No       | Comma-separated user UUID list.          |
| `shift`      | No       | List of shift UUIDs.                     |

## Response format

```json
{
  "data": [
    {
      "attendance_date": "2026-04-02",
      "identity_id": "f9c8f8f8-1111-2222-3333-444455556666",
      "employee_id": "EMP-1024",
      "first_name": "Ava",
      "last_name": "Sharma",
      "email": "ava@example.com",
      "group_name": "Engineering",
      "active_duration": "07:42:15",
      "productive_percent": 78.45
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total_records": 312,
    "total_pages": 7,
    "has_next": true,
    "has_previous": false
  },
  "meta": {
    "mode": "detailed",
    "selected_columns": [
      "attendance_date",
      "identity_id",
      "employee_id",
      "first_name",
      "last_name",
      "email",
      "group_name",
      "active_duration",
      "productive_percent"
    ]
  }
}
```

## Quick cURL example

```bash
curl -X POST "https://api.in.we360.ai/query/external/reports/dynamic_report" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${access_token}" \
  -d '{
    "start_date": "2026-04-01T00:00:00",
    "end_date": "2026-04-07T23:59:59",
    "mode": "summary",
    "columns": [
      "identity_id",
      "employee_id",
      "first_name",
      "last_name",
      "email",
      "group_name",
      "online_duration",
      "active_duration",
      "productive_percent"
    ],
    "page": 1,
    "limit": 25
  }'
```

## Full fields cURL example

```bash
curl -X POST "https://api.in.we360.ai/query/external/reports/dynamic_report" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${access_token}" \
  -d '{
    "start_date": "2026-04-01T00:00:00",
    "end_date": "2026-04-07T23:59:59",
    "mode": "detailed",
    "columns": [
      "attendance_date","identity_id","employee_id","first_name","last_name","email","secondary_email",
      "gender","designation","phone_number","date_of_joining","date_of_birth","created_date","c_bool1",
      "c_bool2","c_int1","c_int2","c_int3","c_string1","c_string2","c_string3","punch_in","punch_out",
      "punch_in_location","punch_out_location","shift_name","shift_start_dt","shift_end_dt","punch_date",
      "punch_duration","online_duration","active_duration","active_percent","idle_duration","mouse_clicks",
      "key_presses","break_duration","productive_duration","unproductive_duration","neutral_duration",
      "manager","group_name","idle_percent","productive_percent","top_application_used",
      "top_application_duration","top_url_used","top_url_duration"
    ],
    "page": 1,
    "limit": 50
  }'
```

## Error handling

* Invalid `columns` returns a validation error.
* Empty access scope returns success with empty `data` and pagination metadata.
* Invalid filter IDs in `group_id`, `user_id`, or `shift` return a filter validation error.

## Best practices

* Request only the `columns` you need.
* Use `page` and `limit` for large date ranges.
* Use `summary` mode for dashboards.
* Use `detailed` mode for drill-down and export workflows.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.we360.ai/deployment-and-it-ops/readme/integrations/oauth-for-direct-api-access/dynamic-report-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
