Skip to main content

Activity Logs API

Overview

The Activity Logs API provides endpoints to retrieve and view user activity logs. All user actions (resource creation, updates, deletions, invocations, etc.) are automatically logged with timestamps, IP addresses, and metadata.

Base Endpoint

All endpoints require authentication.

Get User Activity Logs

Retrieve activity logs for the authenticated user. Endpoint: GET /api/activities Authentication: Required Query Parameters:
  • limit (optional): Number of activities to return (default: 100, max: 1000)
  • offset (optional): Number of activities to skip for pagination (default: 0)
  • projectSlug (optional): Filter activities by project slug. If provided, environmentSlug can also be specified to filter by both project and environment.
  • environmentSlug (optional): Filter activities by environment slug. Requires projectSlug to be specified.
  • resourceType (optional): Filter activities by resource type (e.g., function, instance, database, terminal)
  • action (optional): Filter activities by action type (e.g., create, update, delete, invoke)
Example Request:
Example Response:
Error Responses:
  • 401 Unauthorized: Missing or invalid authentication token
  • 500 Internal Server Error: Failed to retrieve activities

Get Project/Environment Activity Logs

Retrieve activity logs for a specific project and environment. Endpoint: GET /api/activities/:projectSlug/:environmentSlug Authentication: Required Query Parameters:
  • limit (optional): Number of logs to return (default: 100, max: 1000)
  • offset (optional): Number of logs to skip for pagination (default: 0)
  • resourceType (optional): Filter logs by resource type
  • action (optional): Filter logs by action type
Example Request:
Example Response:
Error Responses:
  • 401 Unauthorized: Missing or invalid authentication token
  • 404 Not Found: Project or environment not found
  • 500 Internal Server Error: Failed to retrieve activities

Get Specific Activity Entry

Retrieve details of a specific activity entry. Endpoint: GET /api/activities/:id Authentication: Required Example Request:
Example Response:
Error Responses:
  • 400 Bad Request: Invalid activity ID
  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Activity entry does not belong to the authenticated user
  • 404 Not Found: Activity entry not found
  • 500 Internal Server Error: Failed to retrieve activity

Activity Entry Structure

Each activity entry contains the following fields: Note: The user, project, and environment fields may be null if the related entity doesn’t exist or was deleted.

Action Types

Common action types that are logged:
  • create: Resource creation (functions, instances, databases, etc.)
  • update: Resource updates (code changes, configuration changes, etc.)
  • delete: Resource deletion
  • invoke: Function invocation
  • sync: Resource synchronization with cloud provider
  • connect: Resource connection creation
  • disconnect: Resource connection deletion

Resource Types

Common resource types that are logged:
  • function: Serverless functions (Lambda)
  • instance: EC2 instances
  • database: RDS databases
  • storage_bucket: S3 buckets
  • static_website: Static websites
  • firewall: Security groups
  • cache_server: ElastiCache servers

Filtering Examples

Get all create actions

Get activities for a specific project

Get activities for a specific project and environment

Combine multiple filters


Pagination

The activities API supports pagination using limit and offset parameters:
  • limit: Maximum number of logs to return (default: 100, max: 1000)
  • offset: Number of logs to skip (default: 0)
The response includes pagination metadata:
  • total: Total number of logs matching the filters
  • limit: Number of logs returned in this response
  • offset: Offset used for this request
  • hasMore: Boolean indicating if there are more logs available
Example:

Automatic Logging

The following actions are automatically logged:

Functions

  • ✅ Function creation
  • ✅ Function updates (code, handler, description)
  • ✅ Function deletion
  • ✅ Function invocation
  • ✅ Function synchronization

Other Resources

Logging for other resource types (instances, databases, etc.) can be added by importing and using the activity logger utility in their respective route files.

Notes

  • Activities are stored permanently and are not automatically deleted
  • Users can only view their own activities
  • Activities include IP addresses and user agents for security auditing
  • Metadata field contains JSON data with action-specific information
  • Activities are ordered by creation time (newest first) by default