> For the complete documentation index, see [llms.txt](https://docs.ibexa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ibexa.ai/developers/rest-api/agents/get-agent-execution-duration-summary.md).

# Get Agent Execution Duration Summary

Get execution duration statistics and a per-user breakdown for an agent.

`overall` aggregates average/min/max duration (in seconds) across every execution of this agent that reached a terminal state with a recorded duration; PENDING/STARTED runs are excluded from both `count` and the average, since neither has a meaningful duration yet. `by_user` breaks the same population down by the user who created each execution — a null `user_id` groups executions with no attributed creator (e.g. scheduler-triggered runs). Pair `by_user` with the credits-per-user breakdown from `GET /credits/usage?dimension=USER&agent_id=...` by matching on `user_id` to build a combined per-user usage table; this endpoint carries no user identity of its own. Optionally narrowed to `daterange`. Requires platform administration role (admin or owner).

```json
{"openapi":"3.1.0","info":{"title":"Ibexa Agentic Marketing Platform","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/api/v1/login/access-token"}}}},"schemas":{"AgentExecutionDurationSummaryResponseSchema":{"properties":{"overall":{"$ref":"#/components/schemas/ExecutionDurationStatsSchema"},"by_user":{"items":{"$ref":"#/components/schemas/AgentExecutionUserDurationSchema"},"type":"array","title":"By User"}},"type":"object","required":["overall","by_user"],"title":"AgentExecutionDurationSummaryResponseSchema","description":"Duration usage summary response for a single agent."},"ExecutionDurationStatsSchema":{"properties":{"count":{"type":"integer","title":"Count","description":"Number of executions with a recorded duration that this average/min/max is computed over — not the total number of executions in the requested scope. PENDING/STARTED runs have no duration yet and are excluded from both."},"average_duration_seconds":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Average Duration Seconds"},"min_duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Duration Seconds"},"max_duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Duration Seconds"}},"type":"object","required":["count","min_duration_seconds","max_duration_seconds"],"title":"ExecutionDurationStatsSchema","description":"Execution duration statistics.\n\nOnly executions with a recorded duration contribute — see\n`count`'s description."},"AgentExecutionUserDurationSchema":{"properties":{"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id","description":"Null groups executions with no attributed creator (e.g. scheduler-triggered runs)."},"execution_count":{"type":"integer","title":"Execution Count"},"average_duration_seconds":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Average Duration Seconds"}},"type":"object","required":["user_id","execution_count"],"title":"AgentExecutionUserDurationSchema","description":"One user's execution count and average duration for an agent."}}},"paths":{"/api/v1/agents/{agent_id}/executions/duration-summary":{"get":{"tags":["agents","public"],"summary":"Get Agent Execution Duration Summary","description":"Get execution duration statistics and a per-user breakdown for an agent.\n\n`overall` aggregates average/min/max duration (in seconds) across every execution\nof this agent that reached a terminal state with a recorded duration;\nPENDING/STARTED runs are excluded from both `count` and the average, since neither\nhas a meaningful duration yet. `by_user` breaks the same population down by the\nuser who created each execution — a null `user_id` groups executions with no\nattributed creator (e.g. scheduler-triggered runs). Pair `by_user` with the\ncredits-per-user breakdown from `GET /credits/usage?dimension=USER&agent_id=...`\nby matching on `user_id` to build a combined per-user usage table; this endpoint\ncarries no user identity of its own. Optionally narrowed to `daterange`. Requires\nplatform administration role (admin or owner).","operationId":"agents-get_agent_execution_duration_summary","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"integer","title":"Agent Id"}},{"name":"daterange","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date range as 'start,end' (ISO 8601 dates). Either part can be omitted, e.g. '2024-01-01,2024-12-31', '2024-01-01,' or ',2024-12-31'. A single date without a comma (e.g. '2024-01-01') is also accepted and sets date_from with an open-ended date_to.","title":"Daterange"},"description":"Date range as 'start,end' (ISO 8601 dates). Either part can be omitted, e.g. '2024-01-01,2024-12-31', '2024-01-01,' or ',2024-12-31'. A single date without a comma (e.g. '2024-01-01') is also accepted and sets date_from with an open-ended date_to."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentExecutionDurationSummaryResponseSchema"}}}},"400":{"description":"Invalid request payload or parameters","content":{"application/json":{}}},"401":{"description":"User not authenticated","content":{"application/json":{}}},"403":{"description":"User lacks permission","content":{"application/json":{}}},"404":{"description":"Resource not found or user has no permission to access it","content":{"application/json":{}}}}}}}}
```
