> ## 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.

# List Sessions with Productivity

> Syteca Data Connector REST API endpoint to retrieve sessions with full productivity details — duration, idle time, productive time, user name — with pagination support.

Returns sessions with detailed productivity information — duration, idle time, productive time, plus the user name and Client name in the response. **Paginated** with up to 1000 sessions per request. This is the endpoint to use for productivity dashboards and time-tracking analytics.

```http theme={"system"}
POST https://<hostname>/ekranapi/sessions
```

## 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`. See [Time parameter conventions](/docs/api/data-connector/api-reference#time-parameter-conventions).
</ParamField>

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

<ParamField query="sessionCount" type="int32" default="1000">
  Number of sessions to return per request.

  Default: `1000`. Maximum: `1000`.
</ParamField>

<ParamField query="pageIndex" type="int32" default="0">
  Page index for pagination — starts at `0`. Use this to retrieve the next 1000 sessions after the first request.
</ParamField>

<Warning>
  Requesting more than 1000 sessions (`sessionCount > 1000`) returns **HTTP 400 Bad Request**.
</Warning>

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

## Response (200 OK)

<ResponseField name="sessions" type="array">
  Array of session objects with the following per-session fields:

  <Expandable title="Session object">
    <ResponseField name="duration" type="timespan">
      Total duration of the session — format `hh:mm:ss.fffffff`.
    </ResponseField>

    <ResponseField name="idleTime" type="timespan">
      Total time the user was not active.
    </ResponseField>

    <ResponseField name="productivityTime" type="timespan">
      Total time the user was active.
    </ResponseField>

    <ResponseField name="clientGuid" type="string">
      The GUID of the Client.
    </ResponseField>

    <ResponseField name="clientName" type="string">
      The display name of the Client.
    </ResponseField>

    <ResponseField name="loginDate" type="date-time">
      When the session started.
    </ResponseField>

    <ResponseField name="logoutDate" type="date-time">
      When the session ended.
    </ResponseField>

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

    <ResponseField name="userName" type="string">
      The user name.
    </ResponseField>

    <ResponseField name="userId" type="int32">
      The ID of the user.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="totalCount" type="int32">
  Total number of sessions matching the filter (across all pages — useful for displaying "1–1000 of N" in your UI).
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST "https://<hostname>/ekranapi/sessions?start=2021-04-01&end=2021-04-30&sessionCount=1000&pageIndex=0" \
    -H "ApiKey: xJ)tsCNcpj)l+]}(@_|lt!t………"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
    "sessions": [
      {
        "duration": "20:20:40.0020000",
        "idleTime": "12:57:42.3480000",
        "productivityTime": "07:22:57.6540000",
        "clientGuid": "5d4fe546-8aff-4510-a814-f6a8ee14effq",
        "clientName": "clientname1",
        "logoutDate": "2000-01-23T04:56:07.000+00:00",
        "loginDate": "2000-01-23T04:56:07.000+00:00",
        "sessionId": 613,
        "userName": "username1",
        "userId": 19
      },
      {
        "duration": "8:12:25.7950000",
        "idleTime": "11:55:42.3480000",
        "productivityTime": "11:22:66.6540000",
        "clientGuid": "qi4fe546-8aff-4513-a814-f6a8ee14effq",
        "clientName": "clientname2",
        "logoutDate": "2000-01-23T04:56:07.000+00:00",
        "loginDate": "2000-01-23T04:56:07.000+00:00",
        "sessionId": 16,
        "userName": "username2",
        "userId": 7
      }
    ],
    "totalCount": 4
  }
  ```
</ResponseExample>

## Errors

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

* **400 Bad Request** — invalid time format, or `sessionCount > 1000`.
* **403 Forbidden** — Data Connector not registered. See [Deactivate](/docs/api/data-connector/manage#deactivate-the-data-connector).

## Related

<CardGroup cols={2}>
  <Card title="List sessions (GET)" icon="list" href="/docs/api/data-connector/endpoints/get-sessions">
    Same endpoint, GET method — returns basic info only, no productivity, no pagination.
  </Card>

  <Card title="User productivity" icon="user-check" href="/docs/api/data-connector/endpoints/get-user-productivity">
    Aggregate productivity across users, by hour of day.
  </Card>

  <Card title="Power BI example" icon="bar-chart" href="/docs/api/data-connector/power-bi-example">
    The Power BI use case calls this endpoint to populate productivity dashboards.
  </Card>

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