/impersonate/sessions/{session_id}/audit - Get audit logs for specific session

Add MCP server to your AI tool

Allow AI tools and LLMs to interact with the API documentation portal through MCP.

MCP server URL

https://api.my.nethesis.it/mcp

Standard setup for AI tools providing an mcp.json file

mcp.json
{
  "my.nethesis.it MCP server": {
    "url": "https://api.my.nethesis.it/mcp"
  }
}

Close
GET /impersonate/sessions/{session_id}/audit

Retrieves detailed audit logs for a specific impersonation session. Users can only view audit logs for their own sessions (when they were impersonated). The session must belong to the requesting user.

Path parameters

  • session_id string Required

    Impersonation session ID

Query parameters

  • page integer

    Page number

    Minimum value is 1. Default value is 1.

  • page_size integer

    Items per page

    Minimum value is 1, maximum value is 200. Default value is 20.

Responses

  • 200 application/json

    Session audit logs retrieved successfully

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object
      Hide data attributes Show data attributes object
      • session_id string

        Session ID

      • entries array[object]
        Hide entries attributes Show entries attributes object
        • id string

          Audit entry ID

        • session_id string

          Impersonation session ID

        • impersonator_user_id string

          User ID of the person doing the impersonation

        • impersonated_user_id string

          User ID of the person being impersonated

        • impersonator_username string

          Username of the impersonator

        • impersonated_username string

          Username of the impersonated user

        • impersonator_name string

          Full name of the impersonator

        • impersonated_name string

          Full name of the impersonated user

        • action_type string

          Type of action performed

          Values are session_start, session_end, or api_call.

        • api_endpoint string | null

          API endpoint called (only for api_call actions)

        • http_method string | null

          HTTP method used (only for api_call actions)

        • request_data string | null

          Request data (only for api_call actions)

        • response_status integer | null

          HTTP response status (only for api_call actions)

        • timestamp string(date-time)

          When this action occurred

      • pagination object
        Hide pagination attributes Show pagination attributes object
        • page integer

          Current page number

          Minimum value is 1.

        • page_size integer

          Number of items per page

          Minimum value is 1, maximum value is 200.

        • total_count integer

          Total number of items

          Minimum value is 0.

        • total_pages integer

          Total number of pages

          Minimum value is 0.

        • has_next boolean

          Whether there is a next page

        • has_prev boolean

          Whether there is a previous page

        • next_page integer | null

          Next page number if available

        • prev_page integer | null

          Previous page number if available

        • sort_by string | null

          Field used for sorting

        • sort_direction string | null

          Sort direction

          Values are asc or desc.

  • 400 application/json

    Missing or invalid session_id parameter

    Hide response attributes Show response attributes object
    • code integer

      HTTP error code

    • message string

      Error message

    • data object
      Hide data attributes Show data attributes object
      • type string

        Type of error

        Values are validation_error or external_api_error.

      • errors array[object]
        Hide errors attributes Show errors attributes object
        • key string

          Field name that failed validation

        • message string

          Error code or message

        • value string

          Value that failed validation

      • details

        Additional error details

  • 401 application/json

    Unauthorized - invalid or missing token

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
  • 404 application/json

    Session not found or access denied

    Hide response attributes Show response attributes object
    • code integer

      HTTP error code

    • message string

      Error message

    • data object
      Hide data attributes Show data attributes object
      • type string

        Type of error

        Values are validation_error or external_api_error.

      • errors array[object]
        Hide errors attributes Show errors attributes object
        • key string

          Field name that failed validation

        • message string

          Error code or message

        • value string

          Value that failed validation

      • details

        Additional error details

  • 500 application/json

    Internal server error

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
GET /impersonate/sessions/{session_id}/audit
curl \
 --request GET 'https://api.your-domain.com/api/impersonate/sessions/sess_abc123def456/audit' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "code": 200,
  "message": "session audit retrieved successfully",
  "data": {
    "session_id": "sess_abc123def456",
    "entries": [
      {
        "id": "audit_xyz789abc",
        "session_id": "sess_abc123def456",
        "impersonator_user_id": "usr_owner_123",
        "impersonated_user_id": "usr_target_456",
        "impersonator_username": "owner@company.com",
        "impersonated_username": "customer@example.com",
        "impersonator_name": "John Doe",
        "impersonated_name": "Jane Smith",
        "action_type": "api_call",
        "api_endpoint": "/api/users",
        "http_method": "GET",
        "request_data": "{\"limit\": 10}",
        "response_status": 200,
        "timestamp": "2025-09-02T14:32:15Z"
      }
    ],
    "pagination": {
      "page": 1,
      "page_size": 20,
      "total_count": 156,
      "total_pages": 8,
      "has_next": true,
      "has_prev": false,
      "next_page": 2,
      "prev_page": 42,
      "sort_by": "name",
      "sort_direction": "asc"
    }
  }
}
Response examples (400)
{
  "code": 400,
  "message": "session_id parameter is required"
}
Response examples (401)
{
  "code": 401,
  "message": "invalid token",
  "data": {}
}
Response examples (404)
{
  "code": 404,
  "message": "session not found or access denied"
}
Response examples (500)
{
  "code": 500,
  "message": "internal server error",
  "data": {}
}