> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Get aggregate job metrics

GET http://localhost:3000/workflow_engine/jobs/metrics

Searches aggregate job metrics with options.

Reference: https://docs.itential.com/itential-platform/6/api-reference/workflow-engine/get-job-metrics

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Query parameters

- `order` (enum, optional, default: 1) — order
  - Allowed values: `-1`, `1`
- `sort` (string, optional, default: workflow.name) — sort
- `skip` (integer, optional) — skip
- `limit` (integer, optional) — limit
- `greaterThanEquals` (integer, optional) — Date value to compare with greaterThanEqualsField, in time elapsed (milliseconds) since UNIX epoch.
- `greaterThanEqualsField` (enum, optional) — Date field to compare.
  - Allowed values: `metrics.startDate`
- `contains` (string, optional) — String value to compare with containsField.
- `containsField` (enum, optional) — Field to compare with contains value.
  - Allowed values: `workflow.name`

## Response

### 200

metrics

- `results` (list of object, optional)
  - `_id` (string, required) — String representation of a MongoDB ObjectId
  - `app` (string, required)
  - `name` (string, required)
  - `taskType` (enum, required)
    - Allowed values: `automatic`, `manual`, `operation`
  - `global` (boolean, required) — Global designating if metric is global across automations or per-automation.
  - `metrics` (list of object, required) — Aggregate job metrics collected on a weekly basis
    - `startDate` (string, required) — Metrics are collected on a weekly interval, starting at startDate.
    - `totalSuccesses` (integer, required) — Total number of tasks that ended in status success for the week starting at startDate.
    - `totalSuccessRunTime` (integer, required) — Total run time (milliseconds) for tasks that ended in status success for the week starting at startDate.
    - `totalErrors` (integer, required) — Total number of tasks that ended in status error for the week starting at startDate.
    - `totalErrorRunTime` (integer, required) — Total run time (milliseconds) for tasks that ended in status error for the week starting at startDate.
    - `totalFailures` (integer, required) — Total number of tasks that ended in status failure for the week starting at startDate.
    - `totalFailureRunTime` (integer, required) — Total run time (milliseconds) for tasks that ended in status failure for the week starting at startDate.
    - `slaTargetsMissed` (integer, optional) — Total number of sla targets that were missed for a manual task for the week starting at startDate.
  - `taskId` (string, optional) — Four character hexadecimal task identifier
  - `workflow` (object, optional)
    - `name` (string, optional)
- `skip` (integer, optional) — The number of documents skipped before returning data. When 0, no data is skipped.
- `limit` (integer, optional) — Specifies a limit to the maximum number of data results returned.
- `total` (integer, optional) — The total number of documents returned from a search.

## Errors

### 500 Internal Server Error

Error response from API

- `any`

## Examples

**Response**

```json
{
  "results": [
    {
      "_id": "4321abcdef694aa79dae47ad",
      "app": "WorkflowBuilder",
      "name": "getTime",
      "taskType": "automatic",
      "global": true,
      "metrics": [
        {
          "startDate": "2018-08-02T15:56:12.912Z",
          "totalSuccesses": 5,
          "totalSuccessRunTime": 550,
          "totalErrors": 5,
          "totalErrorRunTime": 550,
          "totalFailures": 5,
          "totalFailureRunTime": 550,
          "slaTargetsMissed": 5
        }
      ],
      "taskId": "12ab",
      "workflow": {
        "name": "exampleAutomationName"
      }
    }
  ],
  "skip": 0,
  "limit": 50,
  "total": 100
}
```

**SDK Code**

```python
import requests

url = "http://localhost:3000/workflow_engine/jobs/metrics"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'http://localhost:3000/workflow_engine/jobs/metrics';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:3000/workflow_engine/jobs/metrics"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:3000/workflow_engine/jobs/metrics")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:3000/workflow_engine/jobs/metrics")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:3000/workflow_engine/jobs/metrics');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:3000/workflow_engine/jobs/metrics");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:3000/workflow_engine/jobs/metrics")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```