# Environment management

The following endpoints enable you to manage and secure your environments by providing tools for working with external secrets managers and monitoring user activities with audit log records.

# Quick reference

Type Resource Description
POST /api/secrets_management/clear_cache Clears the secrets management cache.
GET /api/activity_logs Gets audit log records.

# Clear secrets management cache

Clears the secrets management cache to retrieve the latest available credentials from an external secrets manager. You don't need to disconnect and reconnect the connection for the refreshed credentials to take effect.

For example, when you update a secret in your external secrets manager, you can send a request to the Workato API simultaneously to clear the secrets management cache. This ensures that Workato retrieves the latest secret when required. This allows you to programmatically sync secrets with Workato every time they're changed as part of the secrets rotation process.

Note that the request doesn't require a body.

POST /api/secrets_management/clear_cache

# Sample request

curl  -X POST "https://www.workato.com/api/secrets_management/clear_cache" \
      -H "Authorization: Bearer <api_token>"

# Sample response

{
  "success": true
}

# Get audit log

Retrieves detailed information on activities within a specific environment. Each log entry includes the event's unique identifier, timestamp, type, and details about the workspace, user, and resource involved:

  • The workspace object contains the workspace ID, name, email, and environment.
  • The user object includes the user ID, name, and email.
  • The details object provides additional information about the request, including the IP address, user agent, and the specific activity performed.
  • The resource object describes the resource involved, including its ID, name, type, and associated email if applicable.

CREATE SEPARATE API CLIENTS FOR EACH ENVIRONMENT ACTIVITY LOGS

To obtain logs from different environments, create separate API clients for each environment and combine the data as required for your use case.

The following environments can appear in your response, depending on the API client associated with your environment:

  • dev (Development)
  • sandbox (Sandbox)
  • test (Test)
  • stage (Staging)
  • uat (User Acceptance Testing)
  • preprod (Pre-Production)
  • prod (Production)

# 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.
to string
optional
Specify the end of the time range for which to retrieve audit logs. Provide in ISO 8601 format.
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 in the environment associated with the API client:

curl  -X GET "https://www.workato.com/api/activity_logs" \
      -H "Authorization: Bearer <api_token>" \
      -H "Content-Type: application/json"
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"
            }
        },
        [...]
    ]
}

# 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 environment associated with the API client:

curl  -X GET "https://www.workato.com/api/activity_logs?page%5Bsize%5D=3" \
      -H "Authorization: Bearer <api_token>" \
      -H "Content-Type: application/json"
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"
            }
        }
    ]
}

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

The following example request retrieves the activities of two users on June 6, 2024. This request returns activities for the environment associated with the API client:

curl  -X GET "https://www.workato.com/api/activity_logs?from=2024-06-06T00:00:00Z&to=2024-06-06T23:59:59Z&users_ids[]=54321&users_ids[]=12345" \
      -H "Authorization: Bearer <api_token>" \
      -H "Content-Type: application/json"
Response 3: Get the activities of one day for two users
{
    "data": [
        {
            "id": 3649152,
            "timestamp": "2024-06-06 23:09:51 UTC",
            "event_type": "connector_deleted",
            "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": 7321,
                "name": "New Connector 1",
                "type": "CustomAdapter"
            }
        },
        {
            "id": 3649149,
            "timestamp": "2024-06-06 23:07:33 UTC",
            "event_type": "connector_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": 7321,
                "name": "New Connector 1",
                "type": "CustomAdapter"
            }
        },
        {
            "id": 3649129,
            "timestamp": "2024-06-06 22:34:36 UTC",
            "event_type": "user_logout",
            "workspace": {
                "id": 54321,
                "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": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3649127,
            "timestamp": "2024-06-06 22:32:43 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 54321,
                "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": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3649124,
            "timestamp": "2024-06-06 22:32:16 UTC",
            "event_type": "user_logout",
            "workspace": {
                "id": 54321,
                "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": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        },
        {
            "id": 3649123,
            "timestamp": "2024-06-06 22:32:00 UTC",
            "event_type": "user_login",
            "workspace": {
                "id": 54321,
                "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": 12345,
                "name": "Alex",
                "type": "Workspace",
                "email": "[email protected]",
                "email_confirmed_at": "2024-04-24 14:23:03 -0700"
            }
        }
    ]
}

# 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 environment associated with the API client:

curl  -X GET "https://www.workato.com/api/activity_logs?include_resource_types[]=ApiPrivilegeGroup&include_event_types[]=api_privilege_group_updated" \
      -H "Authorization: Bearer <api_token>" \
      -H "Content-Type: application/json"
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": 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": 40327,
                "name": "Recipe Operator",
                "type": "ApiPrivilegeGroup"
            }
        },
        {
            "id": 3644097,
            "timestamp": "2024-06-04 21:37:12 UTC",
            "event_type": "api_privilege_group_updated",
            "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": 40327,
                "name": "Recipe Operator",
                "type": "ApiPrivilegeGroup"
            }
        },
        {
            "id": 3643744,
            "timestamp": "2024-06-04 16:24:44 UTC",
            "event_type": "api_privilege_group_updated",
            "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": 40327,
                "name": "Recipe Operator",
                "type": "ApiPrivilegeGroup"
            }
        }
    ]
}

# 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 environment associated with the API client:

curl  -X GET "https://www.workato.com/api/activity_logs?exclude_resource_types[]=User&exclude_event_types[]=user_logout" \
      -H "Authorization: Bearer <api_token>" \
      -H "Content-Type: application/json"
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": 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": 3665078,
            "timestamp": "2024-06-20 20:00:36 UTC",
            "event_type": "connection_updated",
            "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": 66196,
                "name": "My RecipeOps by Workato account",
                "path": "Home/Demos",
                "type": "SharedAccount",
                "provider": "workato_app",
                "folder_id": 46319,
                "authorized": true
            }
        },
        [...]
    ]
}

# 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/activity_logs?users_ids[]=67890&include_event_types[]=nonexistent_event_type" \
      -H "Authorization: Bearer <api_token>" \
      -H "Content-Type: application/json"
Response 6: Get activities with a non-existent event type or user ID
{
    "data": []
}


Last updated: 7/17/2024, 2:59:59 PM