Athena
Home
Environments
Environments
  • Development Server
  • Production
Home
Environments
Environments
  • Development Server
  • Production
  1. Workspace
  • Getting Started
    • Start Guide
  • Installation & Setup
    • Windows
  • Architecture
  • Guide
    • Bundles
      • Backend
    • Permissions
      • Frontend
    • Developers
      • Commit Lint
      • RESTful API
    • Workflows
      • Workflow Variables
  • API Reference
    • Authentication
      • Sign In
      • Logout
    • User
      • Get Authenticated User using Multiplai App Access Token
      • Get Authenticated User using Basic Token
    • Workspace
      • Get Workspaces Metrics
        GET
      • Get Workspaces
        GET
      • Update a Workspace
        PUT
      • Retrieve a workspace
        GET
      • Delete a Workspace
        DELETE
    • Provider
      • Get Providers
      • Retrieve a Provider
      • Update a Provider
      • Create a Provider
      • Delete a Provider
    • Account
      • Get Accounts
      • Update an Account
      • Create an Account
      • Delete an Account
      • Retrieve an Account
    • Agent
      • Get Agents
      • Update an Agent
      • Create an Agent
      • Delete an Agent
      • Retrieve an Agent
      • Run an Agent
      • Train an Agent
      • Generate an Agent
      • Share Agent
      • Get Agent Leaderboard
    • Workflow
      • Get Workflows
      • Create a Workflow
      • Retrieve a Workflow
      • Update a Workflow
      • Delete a Workflow
      • Trigger a webhook
      • Share Workflow
      • Generate Workflow
    • Workflow Execution
      • Get Workflow Executions
      • Get Workflow Execution Counts
      • Retrieve a Workflow Execution
      • Delete a Workflow Execution
    • Prompt
      • Get Prompts
      • Create a Prompt
      • Retrieve a Prompt
      • Update a Prompt
      • Delete a Prompt
      • Run a prompt
    • Memory
      • Get Memories
      • Retrieve a Memory
      • Update a Memory
      • Delete a Memory
    • Thread
      • Get Threads
      • Retrieve a Thread
      • Update a Thread
      • Delete a Thread
      • Create a Thread
      • Run a Thread
      • Generate Thread Name
    • Message
      • Get Messages
      • Retrieve a Message
      • Update a Message
      • Delete a Message
      • Create a Message
    • Large Language Model
      • Get Large Language Models
      • Retrieve a Large Language Model
    • Command Room Task
      • Store Command Room Task
      • Remove Command Room Task
    • Metrics
      • Get Agents Metrics
      • Get Workflows Metrics
      • Get Threads Metrics
      • Get Messages Metrics
      • Get Workflow Executions Metrics
  • Schemas
    • Resources
      • User
      • Workspace
      • Provider
      • Account
      • Agent
      • Workflow
      • Share
      • WorkflowExecution
      • WorkflowExecutionData
      • Prompt
      • Memory
      • Thread
      • Attachment
      • Media
      • Tool
      • Message
      • LargeLanguageModel
      • AgentLeaderboard
    • Utils
      • Pagination
        • PaginationMeta
        • PaginationLinks
      • Provider
        • AuthenticationConfig
      • Profile
        • ProfilePhotoConfig
      • Workflow
        • WorkflowExecutionDataWorkflowData
        • Node
        • Edge
  1. Workspace

Get Workspaces Metrics

Local
https://localhost
Local
https://localhost
GET
/api/v1/workspaces/metrics

Workspace Metrics API#

Overview#

The Workspace Metrics API provides on-demand usage analytics for workspace owners. It supports multiple metric types with flexible filtering, grouping, and aggregation capabilities to power dashboard visualizations.

Authentication#

This endpoint requires authentication via the standard API authentication middleware. Only workspace owners can access metrics for their workspace.

Quick Start#

Get a Simple Count (Stat Card)#

To get the total count of agents created in the last 30 days:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "agents",
  "metric": "created",
  "aggregation": "count"
}

Get a Leaderboard (Top Users)#

To get the top 10 users by workflow executions:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "workflows",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "user",
  "order_by": "value",
  "order_dir": "desc",
  "limit": 10
}

Get Time Series Data (Line Chart)#

To get daily agent executions for the last 30 days:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "agents",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "date",
  "granularity": "daily",
  "filters": {
    "period": "30d"
  }
}

Supported Entities#

EntityDescription
agentsAI Agents created in the workspace
workflowsAutomation workflows

Supported Metrics#

MetricAgentsWorkflowsDescription
executions✅✅Number of times the entity was run
created✅✅Number of entities created
copies✅✅Number of entities cloned from templates
shares✅✅Number of entities shared with others
avg_duration❌✅Average execution time (milliseconds)
Note: The avg_duration metric is only available for workflows and does not support grouping.

Grouping Options#

No Grouping (Total Only)#

When group_by is not provided, the API returns only the total value:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "agents",
  "metric": "created",
  "aggregation": "count"
}
Response:
{
  "data": {
    "entity": "agents",
    "metric": "created",
    "aggregation": "count",
    "group_by": null,
    "granularity": null,
    "total": 47,
    "results": []
  }
}

Group by User#

Returns a breakdown by user, perfect for leaderboards:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "workflows",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "user",
  "limit": 5
}
Response:
{
  "data": {
    "entity": "workflows",
    "metric": "executions",
    "aggregation": "count",
    "group_by": "user",
    "total": 890,
    "results": [
      { "user_id": "user-uuid-1", "user_name": "John Doe", "value": 150 },
      { "user_id": "user-uuid-2", "user_name": "Jane Smith", "value": 120 }
    ]
  }
}

Group by Date#

Returns time series data. Requires the granularity parameter:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "agents",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "date",
  "granularity": "daily"
}
Response:
{
  "data": {
    "entity": "agents",
    "metric": "executions",
    "aggregation": "count",
    "group_by": "date",
    "granularity": "daily",
    "total": 1250,
    "results": [
      { "date": "2026-01-01", "value": 45 },
      { "date": "2026-01-02", "value": 52 }
    ]
  }
}

Granularity Options#

ValueFormatExample
dailyYYYY-MM-DD2026-01-15
weeklyYYYY-WW2026-03 (year-week)
monthlyYYYY-MM2026-01

Filtering#

Filter by Period#

Use filters.period to specify the time range:
ValueDescription
7dLast 7 days
30dLast 30 days (default)
90dLast 90 days
allAll time
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "agents",
  "metric": "executions",
  "aggregation": "count",
  "filters": {
    "period": "7d"
  }
}

Filter by User#

To get metrics for a specific user, use filters.user_id:
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "agents",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "date",
  "granularity": "daily",
  "filters": {
    "period": "30d",
    "user_id": 123
  }
}

Sorting and Limiting#

Order By#

ValueDescription
valueSort by metric value (default)
nameSort by user name
dateSort by date

Order Direction#

ValueDescription
descDescending order (default)
ascAscending order

Limit#

Control the number of results returned (1-100, default: 10):
{
  "workspace_uuid": "your-workspace-uuid",
  "entity": "workflows",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "user",
  "order_by": "value",
  "order_dir": "desc",
  "limit": 5
}

Use Case Examples#

Dashboard Stat Cards#

Get individual totals for each stat card:
Total Agents Created:
{
  "workspace_uuid": "uuid",
  "entity": "agents",
  "metric": "created",
  "aggregation": "count",
  "filters": { "period": "30d" }
}
Total Workflow Executions:
{
  "workspace_uuid": "uuid",
  "entity": "workflows",
  "metric": "executions",
  "aggregation": "count",
  "filters": { "period": "30d" }
}
Average Workflow Duration:
{
  "workspace_uuid": "uuid",
  "entity": "workflows",
  "metric": "avg_duration",
  "aggregation": "avg",
  "filters": { "period": "30d" }
}

User Activity Chart#

Weekly agent executions per user for the last 90 days:
{
  "workspace_uuid": "uuid",
  "entity": "agents",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "date",
  "granularity": "weekly",
  "filters": { "period": "90d" }
}

Employee Drilldown#

Get a specific user's daily workflow executions:
{
  "workspace_uuid": "uuid",
  "entity": "workflows",
  "metric": "executions",
  "aggregation": "count",
  "group_by": "date",
  "granularity": "daily",
  "filters": {
    "period": "30d",
    "user_id": 123
  }
}

Adoption Metrics#

Agents shared in the last 30 days by user:
{
  "workspace_uuid": "uuid",
  "entity": "agents",
  "metric": "shares",
  "aggregation": "count",
  "group_by": "user",
  "filters": { "period": "30d" },
  "limit": 10
}

Response Structure#

All successful responses follow this structure:
{
  "data": {
    "entity": "string",
    "metric": "string",
    "aggregation": "string",
    "group_by": "string|null",
    "granularity": "string|null",
    "total": "number",
    "results": []
  },
  "meta": {
    "period": {
      "from": "YYYY-MM-DD",
      "to": "YYYY-MM-DD"
    },
    "cached_at": "ISO 8601 timestamp",
    "cache_ttl": 300,
    "unit": "string|null"
  }
}

Response Fields#

data.total - The aggregate value across all results
data.results - Array of grouped results (empty when no group_by)
meta.period - The actual date range used for the query
meta.cached_at - When this response was cached
meta.cache_ttl - Cache time-to-live in seconds (5 minutes)
meta.unit - Unit of measurement (e.g., "milliseconds" for avg_duration)

Caching#

Responses are cached for 5 minutes (300 seconds). The meta.cached_at field indicates when the cached response was generated. Identical requests within the cache window return the same cached data.

Error Handling#

Validation Errors (422)#

Invalid requests return validation errors:
{
  "message": "The entity field is required.",
  "errors": {
    "entity": ["The entity field is required."]
  }
}

Common Validation Rules#

1.
entity is required and must be agents or workflows
2.
metric is required and must be a supported metric for the entity
3.
aggregation is required and must be count, sum, or avg
4.
granularity is required when group_by is date
5.
avg_duration metric does not support group_by
6.
avg_duration metric is only available for workflows

Authorization Errors (403)#

Non-owners attempting to access metrics will receive:
{
  "message": "This action is unauthorized."
}

Not Found (404)#

Invalid workspace UUID:
{
  "error": "Workspace not found"
}

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Header Params

Body Params application/json

Examples

Responses

🟢200Success
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://localhost/api/v1/workspaces/metrics' \
--header 'X-Multiplai-Authorization;' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "workspace_uuid": "8360bf61-4604-4f22-99dc-2afa910fd8c7",
    "entity": "agents",
    "metric": "executions",
    "aggregation": "count",
    "group_by": "user",
    "granularity": "daily",
    "filters": {
        "period": "30d",
        "user_id": 0
    },
    "order_by": "value",
    "order_dir": "desc",
    "limit": 10
}'
Response Response Example
{
    "data": {
        "entity": "agents",
        "metric": "executions",
        "aggregation": "count",
        "group_by": "user",
        "granularity": "daily",
        "total": 0,
        "results": [
            {
                "user_id": "string",
                "user_name": "string",
                "date": "string",
                "value": 0
            }
        ]
    },
    "meta": {
        "period": {
            "from": "2019-08-24",
            "to": "2019-08-24"
        },
        "cached_at": "2019-08-24T14:15:22.123Z",
        "cache_ttl": 300,
        "unit": "string"
    }
}
Modified at 2026-01-28 05:27:44
Previous
Workspace
Next
Get Workspaces
Built with