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

# Get User Sessions

> Retrieve user session data with filtering and pagination options.

## Get User Sessions

Retrieve user session data with filtering and pagination options.

### Endpoint

```http theme={null}
POST /user-sessions
```

### Headers

```json theme={null}
{
  "publisher-authentication-key": "your_project_secret_key"
}
```

> **Note:** The `publisher-authentication-key` header corresponds to your **Secret Key**. The `authorizationKey` in the request body corresponds to your **Web API Key**.

### Request Body

```json theme={null}
{
  "authorizationKey": "your web api key",
  "rows": 100,
  "page": 1,
  "sessionType": 0,
  "status": "completed",
  "startDate": "2025-11-24",
  "endDate": "2025-12-24"
}
```

#### Request Body Parameters

| Parameter          | Type    | Required | Default    | Description                                                           |
| ------------------ | ------- | -------- | ---------- | --------------------------------------------------------------------- |
| `authorizationKey` | string  | Yes      | -          | Publisher's project web API key                                       |
| `rows`             | integer | No       | 100        | Number of records per page. Min: 1, Max: 500.                         |
| `page`             | integer | No       | 1          | The page number for pagination.                                       |
| `sessionType`      | integer | No       | 0          | 0 = Live, 1 = Test.                                                   |
| `status`           | string  | No       | "all"      | Enum: all, completed, overquota, terminated, securityDrop, prescreen. |
| `startDate`        | string  | No       | Last Month | ISO Date format (YYYY-MM-DD). Defaults to 30 days ago.                |
| `endDate`          | string  | No       | Today      | ISO Date format (YYYY-MM-DD). Defaults to current date.               |

### Response

```json theme={null}
{
  "success": true,
  "message": "User sessions fetched successfully",
  "organisation": "Organisation Name",
  "project": "Project Name",
  "data": [
    {
      "rid": "c339b91cf474987f12aa43015b436f15",
      "clientStatus": {
        "title": "Survey completed",
        "description": "A survey has been completed by a user",
        "code": 10
      },
      "miratsStatus": {
        "title": "Redirected to client survey",
        "description": "The user has been redirected to the client survey",
        "code": 3
      },
      "surveyNumber": 1759222310541001,
      "OS": "Mac OS X",
      "IP": "159.253.79.204",
      "browser": "Chrome",
      "device": "Desktop",
      "duration": "00:19:07",
      "country": "GB",
      "timezone": "Europe/London",
      "startTime": "2025-10-01T04:11:21.819Z",
      "endTime": "2025-10-01T04:30:29.007Z",
      "reconciliationStatus": "Approved"
    }
  ],
  "pagination": {
    "totalDocument": 59,
    "rows": 500,
    "page": 1,
    "totalPages": 1
  }
}
```

### Error Response

```json theme={null}
{
  "message": "internal server error",
  "code": 500,
  "success": false
}
```


## OpenAPI

````yaml POST /user-sessions
openapi: 3.0.0
info:
  title: Mirats Quanto Publisher API
  description: API documentation for Mirats Quanto Publisher services
  version: 1.0.0
servers:
  - url: https://api.publisher.miratsquanto.com/api/v1/publisher
    description: Publisher API Base URL
security:
  - publisher-authentication-key: []
paths:
  /user-sessions:
    post:
      tags:
        - User Sessions
      summary: Get User Sessions
      description: Retrieve user session data with filtering and pagination options.
      operationId: getUserSessions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetUserSessionsRequest'
      responses:
        '200':
          description: Successful response with user sessions data
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: User sessions fetched successfully
                  organisation:
                    type: string
                    example: Organisation Name
                  project:
                    type: string
                    example: Project Name
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/UserSession'
                  pagination:
                    $ref: '#/components/schemas/UserSessionsPagination'
                required:
                  - success
                  - message
                  - data
                  - pagination
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    GetUserSessionsRequest:
      type: object
      description: >-
        Payload for retrieving user sessions. Includes your Web API Key plus
        optional filtering criteria.
      properties:
        authorizationKey:
          type: string
          description: Publisher's project web API key
          example: DqcInvhIFAl5WtUNwihFUIgUH77EL2hTNRU
        rows:
          type: integer
          description: 'Number of records per page. Min: 1, Max: 500.'
          minimum: 1
          maximum: 500
          default: 100
          example: 100
        page:
          type: integer
          description: The page number for pagination.
          minimum: 1
          default: 1
          example: 1
        sessionType:
          type: integer
          description: 0 = Live, 1 = Test.
          enum:
            - 0
            - 1
          default: 0
          example: 0
        status:
          type: string
          description: Session status filter
          enum:
            - all
            - completed
            - overquota
            - terminated
            - securityDrop
            - prescreen
          default: all
          example: completed
        startDate:
          type: string
          format: date
          description: ISO Date format (YYYY-MM-DD). Defaults to 30 days ago.
          example: '2025-11-24'
        endDate:
          type: string
          format: date
          description: ISO Date format (YYYY-MM-DD). Defaults to current date.
          example: '2025-12-24'
      required:
        - authorizationKey
    UserSession:
      type: object
      properties:
        rid:
          type: string
          example: c339b91cf474987f12aa43015b436f15
        clientStatus:
          type: object
          properties:
            title:
              type: string
              example: Survey completed
            description:
              type: string
              example: A survey has been completed by a user
            code:
              type: integer
              example: 10
          required:
            - title
            - description
            - code
        miratsStatus:
          type: object
          properties:
            title:
              type: string
              example: Redirected to client survey
            description:
              type: string
              example: The user has been redirected to the client survey
            code:
              type: integer
              example: 3
          required:
            - title
            - description
            - code
        surveyNumber:
          type: integer
          example: 1759222310541001
        OS:
          type: string
          example: Mac OS X
        IP:
          type: string
          example: 159.253.79.204
        browser:
          type: string
          example: Chrome
        device:
          type: string
          example: Desktop
        duration:
          type: string
          example: '00:19:07'
        country:
          type: string
          example: GB
        timezone:
          type: string
          example: Europe/London
        startTime:
          type: string
          format: date-time
          example: '2025-10-01T04:11:21.819Z'
        endTime:
          type: string
          format: date-time
          example: '2025-10-01T04:30:29.007Z'
        reconciliationStatus:
          type: string
          example: Approved
      required:
        - rid
        - surveyNumber
    UserSessionsPagination:
      type: object
      properties:
        totalDocument:
          type: integer
          example: 59
        rows:
          type: integer
          example: 500
        page:
          type: integer
          example: 1
        totalPages:
          type: integer
          example: 1
      required:
        - totalDocument
        - rows
        - page
        - totalPages
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          example: internal server error
        code:
          type: integer
          example: 500
        success:
          type: boolean
          example: false
      required:
        - message
        - code
        - success
  securitySchemes:
    publisher-authentication-key:
      type: apiKey
      in: header
      name: publisher-authentication-key
      description: >-
        Send your Secret Key using the `publisher-authentication-key` header.
        This header is required for every request.

````