# Environment management

Use this endpoint to monitor user activities within a customer workspace through activity audit log records.

# Quick reference

Type Resource Description
GET /api/managed_users/:id/activity_logs Gets activity audit log records in a customer workspace.

# Get activity audit log

Retrieves detailed information about activities within a specific environment of a customer workspace.

GET /api/managed_users/:id/activity_logs

The response includes two primary elements:

Element Description
data An array of objects, each representing a log entry. These entries include the event's unique identifier, timestamp, type, and details about the customer workspace, user, and resource involved.
total The total number of log entries returned.

Each log entry in the data array contains the following objects:

Object Description
workspace This object includes the customer workspace ID, name, email, and environment.
user This object includes the user ID, name, and email.
details This object provides additional information about the request. The request object contains the IP address and user agent. The activity field describes the specific action performed.
resource This object describes the resource involved, including its ID, name, type, email, and email_confirmed_at timestamp if applicable.

USE WORKSPACE ID TO ACCESS DIFFERENT ENVIRONMENT LOGS

You must specify the relevant workspace ID for each environment in the id URL parameter to obtain logs from different customer environments.

# URL parameters

Name Type Description
id string
required
Embedded customer ID/external ID.
The External ID must be URL encoded and prefixed with an E (for example, EA2300).

# Query parameters

Name Type Description
page[after] integer
optional
Specify the starting point for the next set of results based on the last result of the current page.
page[size] integer
optional
Specify the number of results per page. The default and maximum number of records is 100.
from string
optional
Specify the start of the time range for which to retrieve audit logs. Provide in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.SSSZ).
to string
optional
Specify the end of the time range for which to retrieve audit logs. Provide in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.SSSZ).
users_ids[] array of integers
optional
Filter logs to include activities performed by specified user IDs.
include_resource_types[] array of strings
optional
Filter logs to include activities related to specified resource types.
exclude_resource_types[] array of strings
optional
Exclude activities related to specified resource types.
include_event_types[] array of strings
optional
Filter logs to include activities of specified event types.
exclude_event_types[] array of strings
optional
Exclude activities of the specified event types.

TIMEZONE

All data centers use the system timezone, Pacific Daylight Time (PDT). When you specify a timezone in the from and to query parameters, the system converts it to and displays it as PDT.

# Sample requests

# Request 1: Without query parameters

The following example request returns a list of all activities for the customer workspace associated with the id URL parameter:

curl  -X GET "https://www.workato.com/api/managed_users/19029/activity_logs" \
      -H "Authorization: Bearer <api_token>"
Response 1: Without query parameters
{
    "data": [
        {
            "id": 1234567,
            "timestamp": "2024-06-18 19:17:31 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "password_login"
            },
            "resource": {
                "id": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {...}
    ],
    "total": 65
}

# Request 2: Get the last three records

The following example request retrieves the three most recent activity log entries. This request returns activities for the customer workspace associated with the id URL parameter:

curl  -X GET "https://www.workato.com/api/managed_users/19029/activity_logs?page%5Bsize%5D=3" \
      -H "Authorization: Bearer <api_token>"
Response 2: Get the last three records
{
    "data": [
        {
            "id": 3674006,
            "timestamp": "2024-06-26 15:56:07 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "password_login"
            },
            "resource": {
                "id": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3670909,
            "timestamp": "2024-06-25 16:38:11 UTC",
            "event_type": "recipe_created",
            "workspace": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 289287,
                "name": "My new recipe",
                "path": "Home/Demos",
                "type": "Flow",
                "folder_id": 46319
            }
        },
        {
            "id": 3668492,
            "timestamp": "2024-06-24 15:52:23 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "password_login"
            },
            "resource": {
                "id": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        }
    ],
    "total": 65
}

# Request 3: Get the activities of one day for two users

The following example request retrieves the activities of two users on June 30, 2024. This request returns activities for the customer workspace associated with the id URL parameter:

curl  -X GET "https://www.workato.com/api/managed_users/19029/activity_logs?from=2024-06-30T00:00:00Z&to=2024-06-30T23:59:59Z&users_ids[]=54321&users_ids[]=12345" \
      -H "Authorization: Bearer <api_token>"

DATE AND TIME FORMAT

Ensure that the from and to query parameters use the YYYY-MM-DD format, in which the month is listed before the day. Using the YYYY-DD-MM format causes a 500 Server error.

Response 3: Get the activities of one day for two users
{
    "data": [
        {
            "id": 3649152,
            "timestamp": "2024-06-30 23:09:51 UTC",
            "event_type": "connector_deleted",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 7321,
                "name": "New Connector 1",
                "type": "CustomAdapter"
            }
        },
        {
            "id": 3649149,
            "timestamp": "2024-06-30 23:07:33 UTC",
            "event_type": "connector_created",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 7321,
                "name": "New Connector 1",
                "type": "CustomAdapter"
            }
        },
        {
            "id": 3649129,
            "timestamp": "2024-06-30 22:34:36 UTC",
            "event_type": "user_logout",
            "workspace": {
                "id": 19029,
                "name": "Jie",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 54321,
                "name": "Jie",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "192.0.2.1",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "switch_team"
            },
            "resource": {
                "id": 19029,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3649127,
            "timestamp": "2024-06-30 22:32:43 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 19029,
                "name": "Jie",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 54321,
                "name": "Jie",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "192.0.2.1",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "switch_team"
            },
            "resource": {
                "id": 19029,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3649124,
            "timestamp": "2024-06-30 22:32:16 UTC",
            "event_type": "user_logout",
            "workspace": {
                "id": 19029,
                "name": "Jie",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 54321,
                "name": "Jie",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "192.0.2.1",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "switch_team"
            },
            "resource": {
                "id": 19029,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3649123,
            "timestamp": "2024-06-30 22:32:00 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 19029,
                "name": "Jie",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 54321,
                "name": "Jie",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "192.0.2.1",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                },
                "activity": "switch_team"
            },
            "resource": {
                "id": 19029,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        }
    ],
    "total": 6
}

# Request 4: Include activities with specific resource_types and event_types

The following example request includes activities with the resource_type ApiPrivilegeGroup and event_type api_privilege_group_updated. This request returns activities for the customer workspace associated with the id URL parameter:

curl  -X GET "https://www.workato.com/api/managed_users/19029/activity_logs?include_resource_types[]=ApiPrivilegeGroup&include_event_types[]=api_privilege_group_updated" \
      -H "Authorization: Bearer <api_token>"
Response 4: Include activities with specific resource_types and event_types
{
    "data": [
        {
            "id": 3661175,
            "timestamp": "2024-06-18 17:38:33 UTC",
            "event_type": "api_privilege_group_updated",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 40327,
                "name": "Recipe Operator",
                "type": "ApiPrivilegeGroup"
            }
        },
        {
            "id": 3644097,
            "timestamp": "2024-06-04 21:37:12 UTC",
            "event_type": "api_privilege_group_updated",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 40327,
                "name": "Recipe Operator",
                "type": "ApiPrivilegeGroup"
            }
        },
        {
            "id": 3643744,
            "timestamp": "2024-06-04 16:24:44 UTC",
            "event_type": "api_privilege_group_updated",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 40327,
                "name": "Recipe Operator",
                "type": "ApiPrivilegeGroup"
            }
        }
    ],
    "total": 3
}

# Request 5: Exclude activities with specific resource_types and event_types

The following example request excludes activities with the resource_type User and event_type user_logout. This request returns activities for the customer workspace associated with the id URL parameter:

curl  -X GET "https://www.workato.com/api/managed_users/19029/activity_logs?exclude_resource_types[]=User&exclude_event_types[]=user_logout" \
      -H "Authorization: Bearer <api_token>"
Response 5: Exclude activities with specific resource_types and event_types
{
    "data": [
        {
            "id": 3670909,
            "timestamp": "2024-06-25 16:38:11 UTC",
            "event_type": "recipe_created",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 289287,
                "name": "My new recipe",
                "path": "Home/Demos",
                "type": "Flow",
                "folder_id": 46319
            }
        },
        {
            "id": 3665078,
            "timestamp": "2024-06-20 20:00:36 UTC",
            "event_type": "connection_updated",
            "workspace": {
                "id": 19029,
                "name": "Alex",
                "email": "[email protected]",
                "environment": "dev"
            },
            "user": {
                "id": 12345,
                "name": "Alex",
                "email": "[email protected]"
            },
            "details": {
                "request": {
                    "ip_address": "60.160.90.91",
                    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
                }
            },
            "resource": {
                "id": 66196,
                "name": "My RecipeOps by Workato account",
                "path": "Home/Demos",
                "type": "SharedAccount",
                "provider": "workato_app",
                "folder_id": 46319,
                "authorized": true
            }
        },
        {...}
    ],
    "total": 42
}

# Request 6: Get activities with a non-existent event type or user ID

The following example request attempts to retrieve the activities of a non-existent event type and user ID. Filtering activities by a non-existent event type or user ID results in an empty array:

curl  -X GET "https://www.workato.com/api/managed_users/19029/activity_logs?users_ids[]=67890&include_event_types[]=nonexistent_event_type" \
      -H "Authorization: Bearer <api_token>"
Response 6: Get activities with a non-existent event type or user ID
{
    "data": [],
    "total": 0
}


Last updated: 9/16/2024, 3:38:37 PM