> ## Documentation Index
> Fetch the complete documentation index at: https://syteca.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Application Statistics

> Syteca Data Connector REST API endpoint returning the total time spent using each application during each hour of each session — useful for productivity dashboards.

Returns time spent in each application broken down by hour and session — useful for "which apps did the user spend the most time in this morning?" style analytics. Each result is a `(sessionId, hour, application → duration)` triple.

```http theme={"system"}
GET https://<hostname>/ekranapi/statistics/getapp
```

## Authentication

<ParamField header="ApiKey" type="string" required>
  Your Active API Key from the Management Tool.
</ParamField>

## Query parameters

<ParamField query="start" type="string">
  Sessions that were started or finished **after this time** are included.

  Accepted formats: `2021-04-01`, `2021-04-01T12:00`, `2021-04-01T12:00:00`.
</ParamField>

<ParamField query="end" type="string">
  Sessions that were started or finished **before this time** are included.
</ParamField>

<Note>
  If both `start` and `end` are omitted, statistics for all sessions in the database are returned. See [Time parameter conventions](/docs/api/data-connector/api-reference#time-parameter-conventions) for full rules and boundary clipping behavior.
</Note>

## Response (200 OK)

The response is an array of `(session, hour)` blocks. Each block has a `data` array — one entry per application — plus `sessionId` and `timeOfDay` fields.

<ResponseField name="data" type="array">
  Array of per-application time records for this `(session, hour)`:

  <Expandable title="Per-application record">
    <ResponseField name="duration" type="timespan">
      Total time spent in this application during this hour of this session — format `hh:mm:ss.fffffff`.
    </ResponseField>

    <ResponseField name="key" type="string">
      The name of the application (e.g. `chrome.exe`, `explorer.exe`, `cmd.exe`, or `Idle` for idle time).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="sessionId" type="int32">
  The ID of the session this block belongs to.
</ResponseField>

<ResponseField name="timeOfDay" type="date-time">
  The hour of the day (ISO 8601 with hour granularity).
</ResponseField>

<Note>
  The application name `Idle` appears alongside real application names — it represents the time the user was inactive during the hour. Filter it out client-side if you only want active-app time.
</Note>

## Example

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X GET "https://<hostname>/ekranapi/statistics/getapp?start=2021-09-01&end=2021-09-02" \
    -H "ApiKey: xJ)tsCNcpj)l+]}(@_|lt!t………"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"system"}
  [
    {
      "data": [
        {
          "duration": "00:02:50.3010000",
          "key": "explorer.exe"
        },
        {
          "duration": "00:02:50.3010000",
          "key": "chrome.exe"
        }
      ],
      "sessionId": 134,
      "timeOfDay": "2021-09-01T17:00:00+03:00"
    },
    {
      "data": [
        {
          "duration": "01:02:50.3010000",
          "key": "cmd.exe"
        },
        {
          "duration": "00:01:00.3010000",
          "key": "Idle"
        }
      ],
      "sessionId": 431,
      "timeOfDay": "2022-02-01T17:00:00+07:00"
    }
  ]
  ```
</ResponseExample>

## Errors

See [Status codes](/docs/api/data-connector/api-reference#status-codes). Common errors:

* **400 Bad Request** — invalid `start` or `end` format.
* **403 Forbidden** — Data Connector not registered.

## Related

<CardGroup cols={2}>
  <Card title="URL statistics" icon="globe" href="/docs/api/data-connector/endpoints/get-url-statistics">
    Same shape, but for URLs instead of applications.
  </Card>

  <Card title="User productivity" icon="user-check" href="/docs/api/data-connector/endpoints/get-user-productivity">
    Aggregate active time per user per hour — complements per-application data.
  </Card>

  <Card title="List sessions with productivity" icon="bar-chart-3" href="/docs/api/data-connector/endpoints/post-sessions">
    Get sessions with overall duration and productivity time.
  </Card>

  <Card title="API reference" icon="square-code" href="/docs/api/data-connector/api-reference">
    Base URL, authentication, status codes.
  </Card>
</CardGroup>
