---
title: List historical jobs
description: List historical jobs.
breadcrumbs: Documentation > API > List historical jobs
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# List historical jobs

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in beta and may be subject to changes.
Please check the documentation regularly for updates.
{% /alert %}

| Datadog site      | API endpoint                                                             |
| ----------------- | ------------------------------------------------------------------------ |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/siem-historical-detections/jobs     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/siem-historical-detections/jobs |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/siem-historical-detections/jobs |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/siem-historical-detections/jobs      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/siem-historical-detections/jobs |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/siem-historical-detections/jobs |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/siem-historical-detections/jobs |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/siem-historical-detections/jobs      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/siem-historical-detections/jobs  |

### Overview

List historical jobs.

### Arguments

#### Query Strings

| Field         | Type    | Description                                                                          |
| ------------- | ------- | ------------------------------------------------------------------------------------ |
| page[size]    | integer | Number of items to return per page. The maximum allowed value is 100. Default: `10`. |
| page[number]  | integer | Specific page number to return. Default: `0`.                                        |
| sort          | string  | The order of the jobs in results.                                                    |
| filter[query] | string  | Query used to filter items from the fetched list.                                    |

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
List of historical jobs.

| Parent field             | Field                               | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------------ | ----------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                          | data                                | [object] | Array containing the list of historical jobs.                                                                                                                                                                                                                                                                                                                                                                    |
| data                     | attributes                          | object   | Historical job attributes.                                                                                                                                                                                                                                                                                                                                                                                       |
| attributes               | createdAt                           | string   | Time when the job was created.                                                                                                                                                                                                                                                                                                                                                                                   |
| attributes               | createdByHandle                     | string   | The handle of the user who created the job.                                                                                                                                                                                                                                                                                                                                                                      |
| attributes               | createdByName                       | string   | The name of the user who created the job.                                                                                                                                                                                                                                                                                                                                                                        |
| attributes               | createdFromRuleId                   | string   | ID of the rule used to create the job (if it is created from a rule).                                                                                                                                                                                                                                                                                                                                            |
| attributes               | failure                             | object   | Details about why the job failed. Only present when the job has failed and won't be retried.                                                                                                                                                                                                                                                                                                                     |
| failure                  | hint                                | string   | A suggestion to fix the failure.                                                                                                                                                                                                                                                                                                                                                                                 |
| failure                  | reason                              | enum     | The reason why the job failed. Allowed enum values: `rule_configuration`, `query_too_expensive`, `internal_error`.                                                                                                                                                                                                                                                                                               |
| attributes               | jobDefinition                       | object   | Definition of a historical job.                                                                                                                                                                                                                                                                                                                                                                                  |
| jobDefinition            | calculatedFields                    | [object] | Calculated fields.                                                                                                                                                                                                                                                                                                                                                                                               |
| calculatedFields         | expression [*required*]             | string   | Expression.                                                                                                                                                                                                                                                                                                                                                                                                      |
| calculatedFields         | name [*required*]                   | string   | Field name.                                                                                                                                                                                                                                                                                                                                                                                                      |
| jobDefinition            | cases [*required*]                  | [object] | Cases used for generating job results. Up to 10 cases are allowed.                                                                                                                                                                                                                                                                                                                                               |
| cases                    | actions                             | [object] | Action to perform for each rule case.                                                                                                                                                                                                                                                                                                                                                                            |
| actions                  | options                             | object   | Options for the rule action                                                                                                                                                                                                                                                                                                                                                                                      |
| options                  | duration                            | int64    | Duration of the action in seconds. 0 indicates no expiration.                                                                                                                                                                                                                                                                                                                                                    |
| options                  | flaggedIPType                       | enum     | Used with the case action of type 'flag_ip'. The value specified in this field is applied as a flag to the IP addresses. Allowed enum values: `SUSPICIOUS`, `FLAGGED`.                                                                                                                                                                                                                                           |
| options                  | userBehaviorName                    | string   | Used with the case action of type 'user_behavior'. The value specified in this field is applied as a risk tag to all users affected by the rule.                                                                                                                                                                                                                                                                 |
| actions                  | type                                | enum     | The action type. Allowed enum values: `block_ip`, `block_user`, `user_behavior`, `flag_ip`.                                                                                                                                                                                                                                                                                                                      |
| cases                    | condition                           | string   | A case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated based on the event counts in the previously defined queries.                                                                                                                                                                                                                                              |
| cases                    | customStatus                        | enum     | Severity of the Security Signal. Allowed enum values: `info`, `low`, `medium`, `high`, `critical`.                                                                                                                                                                                                                                                                                                               |
| cases                    | name                                | string   | Name of the case.                                                                                                                                                                                                                                                                                                                                                                                                |
| cases                    | notifications                       | [string] | Notification targets.                                                                                                                                                                                                                                                                                                                                                                                            |
| cases                    | status [*required*]                 | enum     | Severity of the Security Signal. Allowed enum values: `info`, `low`, `medium`, `high`, `critical`.                                                                                                                                                                                                                                                                                                               |
| jobDefinition            | from [*required*]                   | int64    | Starting time of data analyzed by the job.                                                                                                                                                                                                                                                                                                                                                                       |
| jobDefinition            | groupSignalsBy                      | [string] | Additional grouping to perform on top of the existing groups in the query section. Must be a subset of the existing groups.                                                                                                                                                                                                                                                                                      |
| jobDefinition            | index [*required*]                  | string   | Index used to load the data.                                                                                                                                                                                                                                                                                                                                                                                     |
| jobDefinition            | isBackfillJob                       | boolean  | Whether the job was run by Datadog to reprocess past data. Read-only.                                                                                                                                                                                                                                                                                                                                            |
| jobDefinition            | isShadowDeployed                    | boolean  | Whether the job is a shadow deployment run by Datadog. Read-only.                                                                                                                                                                                                                                                                                                                                                |
| jobDefinition            | message [*required*]                | string   | Message for generated results.                                                                                                                                                                                                                                                                                                                                                                                   |
| jobDefinition            | name [*required*]                   | string   | Job name.                                                                                                                                                                                                                                                                                                                                                                                                        |
| jobDefinition            | options                             | object   | Job options.                                                                                                                                                                                                                                                                                                                                                                                                     |
| options                  | anomalyDetectionOptions             | object   | Options on anomaly detection method.                                                                                                                                                                                                                                                                                                                                                                             |
| anomalyDetectionOptions  | bucketDuration                      | enum     | Duration in seconds of the time buckets used to aggregate events matched by the rule. Must be greater than or equal to 300. Allowed enum values: `300`, `600`, `900`, `1800`, `3600`, `10800`.                                                                                                                                                                                                                   |
| anomalyDetectionOptions  | detectionTolerance                  | enum     | An optional parameter that sets how permissive anomaly detection is. Higher values require higher deviations before triggering a signal. Allowed enum values: `1`, `2`, `3`, `4`, `5`.                                                                                                                                                                                                                           |
| anomalyDetectionOptions  | instantaneousBaseline               | boolean  | When set to true, Datadog uses previous values that fall within the defined learning window to construct the baseline, enabling the system to establish an accurate baseline more rapidly rather than relying solely on gradual learning over time.                                                                                                                                                              |
| anomalyDetectionOptions  | learningDuration                    | enum     | Learning duration in hours. Anomaly detection waits for at least this amount of historical data before it starts evaluating. Allowed enum values: `1`, `6`, `12`, `24`, `48`, `168`, `336`.                                                                                                                                                                                                                      |
| anomalyDetectionOptions  | learningPeriodBaseline              | int64    | An optional override baseline to apply while the rule is in the learning period. Must be greater than or equal to 0.                                                                                                                                                                                                                                                                                             |
| options                  | complianceRuleOptions               | object   | Options for cloud_configuration rules. Fields `resourceType` and `regoRule` are mandatory when managing custom `cloud_configuration` rules.                                                                                                                                                                                                                                                                      |
| complianceRuleOptions    | complexRule                         | boolean  | Whether the rule is a complex one. Must be set to true if `regoRule.resourceTypes` contains more than one item. Defaults to false.                                                                                                                                                                                                                                                                               |
| complianceRuleOptions    | regoRule                            | object   | Rule details.                                                                                                                                                                                                                                                                                                                                                                                                    |
| regoRule                 | policy [*required*]                 | string   | The policy written in `rego`, see: <https://www.openpolicyagent.org/docs/latest/policy-language/>                                                                                                                                                                                                                                                                                                                |
| regoRule                 | resourceTypes [*required*]          | [string] | List of resource types that will be evaluated upon. Must have at least one element.                                                                                                                                                                                                                                                                                                                              |
| complianceRuleOptions    | resourceType                        | string   | Main resource type to be checked by the rule. It should be specified again in `regoRule.resourceTypes`.                                                                                                                                                                                                                                                                                                          |
| options                  | decreaseCriticalityBasedOnEnv       | boolean  | If true, signals in non-production environments have a lower severity than what is defined by the rule case, which can reduce signal noise. The severity is decreased by one level: `CRITICAL` in production becomes `HIGH` in non-production, `HIGH` becomes `MEDIUM` and so on. `INFO` remains `INFO`. The decrement is applied when the environment tag of the signal starts with `staging`, `test` or `dev`. |
| options                  | detectionMethod                     | enum     | The detection method. Allowed enum values: `threshold`, `new_value`, `anomaly_detection`, `impossible_travel`, `hardcoded`, `third_party`, `anomaly_threshold`, `sequence_detection`.                                                                                                                                                                                                                            |
| options                  | evaluationWindow                    | enum     | A time window is specified to match when at least one of the cases matches true. This is a sliding window and evaluates in real time. For third party detection method, this field is not used. Allowed enum values: `0`, `60`, `300`, `600`, `900`, `1800`, `3600`, `7200`, `10800`, `21600`, `43200`, `86400`.                                                                                                 |
| options                  | hardcodedEvaluatorType              | enum     | Hardcoded evaluator type. Allowed enum values: `log4shell`.                                                                                                                                                                                                                                                                                                                                                      |
| options                  | impossibleTravelOptions             | object   | Options on impossible travel detection method.                                                                                                                                                                                                                                                                                                                                                                   |
| impossibleTravelOptions  | baselineUserLocations               | boolean  | If true, signals are suppressed for the first 24 hours. In that time, Datadog learns the user's regular access locations. This can be helpful to reduce noise and infer VPN usage or credentialed API access.                                                                                                                                                                                                    |
| impossibleTravelOptions  | baselineUserLocationsDuration       | int32    | The duration in days during which Datadog learns the user's regular access locations. After this period, signals are generated for accesses from unknown locations.                                                                                                                                                                                                                                              |
| impossibleTravelOptions  | detectIpTransition                  | boolean  | If true, the rule detects transitions between IP addresses of the same user. At least one of `baselineUserLocations` and `detectIpTransition` must be true.                                                                                                                                                                                                                                                      |
| options                  | keepAlive                           | enum     | Once a signal is generated, the signal will remain "open" if a case is matched at least once within this keep alive window. For third party detection method, this field is not used. Allowed enum values: `0`, `60`, `300`, `600`, `900`, `1800`, `3600`, `7200`, `10800`, `21600`, `43200`, `86400`.                                                                                                           |
| options                  | maxSignalDuration                   | enum     | A signal will "close" regardless of the query being matched once the time exceeds the maximum duration. This time is calculated from the first seen timestamp. Allowed enum values: `0`, `60`, `300`, `600`, `900`, `1800`, `3600`, `7200`, `10800`, `21600`, `43200`, `86400`.                                                                                                                                  |
| options                  | newValueOptions                     | object   | Options on new value detection method.                                                                                                                                                                                                                                                                                                                                                                           |
| newValueOptions          | forgetAfter                         | int32    | The duration in days after which a learned value is forgotten.                                                                                                                                                                                                                                                                                                                                                   |
| newValueOptions          | instantaneousBaseline               | boolean  | When set to true, Datadog uses previous values that fall within the defined learning window to construct the baseline, enabling the system to establish an accurate baseline more rapidly rather than relying solely on gradual learning over time.                                                                                                                                                              |
| newValueOptions          | instantaneousBaselineTimeoutMinutes | int32    | Maximum time in minutes to build the instantaneous baseline. Only used when `instantaneousBaseline` is true.                                                                                                                                                                                                                                                                                                     |
| newValueOptions          | learningDuration                    | int32    | The duration in days during which values are learned, and after which signals will be generated for values that weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned. Default: `0`.                                                                                                                                                                      |
| newValueOptions          | learningMethod                      | enum     | The learning method used to determine when signals should be generated for values that weren't learned. Allowed enum values: `duration`, `threshold`. Default: `duration`.                                                                                                                                                                                                                                       |
| newValueOptions          | learningThreshold                   | enum     | A number of occurrences after which signals will be generated for values that weren't learned. Allowed enum values: `0`, `1`. Default: `0`.                                                                                                                                                                                                                                                                      |
| options                  | sequenceDetectionOptions            | object   | Options on sequence detection method.                                                                                                                                                                                                                                                                                                                                                                            |
| sequenceDetectionOptions | stepTransitions                     | [object] | Transitions defining the allowed order of steps and their evaluation windows.                                                                                                                                                                                                                                                                                                                                    |
| stepTransitions          | child                               | string   | Name of the child step.                                                                                                                                                                                                                                                                                                                                                                                          |
| stepTransitions          | evaluationWindow                    | enum     | A time window is specified to match when at least one of the cases matches true. This is a sliding window and evaluates in real time. For third party detection method, this field is not used. Allowed enum values: `0`, `60`, `300`, `600`, `900`, `1800`, `3600`, `7200`, `10800`, `21600`, `43200`, `86400`.                                                                                                 |
| stepTransitions          | parent                              | string   | Name of the parent step.                                                                                                                                                                                                                                                                                                                                                                                         |
| sequenceDetectionOptions | steps                               | [object] | Steps that define the conditions to be matched in sequence.                                                                                                                                                                                                                                                                                                                                                      |
| steps                    | condition                           | string   | Condition referencing rule queries (e.g., `a > 0`).                                                                                                                                                                                                                                                                                                                                                              |
| steps                    | evaluationWindow                    | enum     | A time window is specified to match when at least one of the cases matches true. This is a sliding window and evaluates in real time. For third party detection method, this field is not used. Allowed enum values: `0`, `60`, `300`, `600`, `900`, `1800`, `3600`, `7200`, `10800`, `21600`, `43200`, `86400`.                                                                                                 |
| steps                    | name                                | string   | Unique name identifying the step.                                                                                                                                                                                                                                                                                                                                                                                |
| options                  | thirdPartyRuleOptions               | object   | Options on third party detection method.                                                                                                                                                                                                                                                                                                                                                                         |
| thirdPartyRuleOptions    | defaultNotifications                | [string] | Notification targets for the logs that do not correspond to any of the cases.                                                                                                                                                                                                                                                                                                                                    |
| thirdPartyRuleOptions    | defaultStatus                       | enum     | Severity of the Security Signal. Allowed enum values: `info`, `low`, `medium`, `high`, `critical`.                                                                                                                                                                                                                                                                                                               |
| thirdPartyRuleOptions    | rootQueries                         | [object] | Queries to be combined with third party case queries. Each of them can have different group by fields, to aggregate differently based on the type of alert.                                                                                                                                                                                                                                                      |
| rootQueries              | groupByFields                       | [string] | Fields to group by.                                                                                                                                                                                                                                                                                                                                                                                              |
| rootQueries              | query                               | string   | Query to run on logs.                                                                                                                                                                                                                                                                                                                                                                                            |
| thirdPartyRuleOptions    | signalTitleTemplate                 | string   | A template for the signal title; if omitted, the title is generated based on the case name.                                                                                                                                                                                                                                                                                                                      |
| jobDefinition            | projectedPerQuery                   | [string] | Fields projected for each query, copied from the rule the job was created from. Read-only.                                                                                                                                                                                                                                                                                                                       |
| jobDefinition            | queries [*required*]                | [object] | Queries for selecting logs analyzed by the job. Up to 10 queries are allowed.                                                                                                                                                                                                                                                                                                                                    |
| queries                  | additionalFilters                   | string   | Additional filters appended to the query at evaluation time.                                                                                                                                                                                                                                                                                                                                                     |
| queries                  | aggregation                         | enum     | The aggregation type. Allowed enum values: `count`, `cardinality`, `sum`, `max`, `new_value`, `geo_data`, `event_count`, `none`.                                                                                                                                                                                                                                                                                 |
| queries                  | correlatedByFields                  | [string] | Fields used to correlate results across queries in sequence detection rules.                                                                                                                                                                                                                                                                                                                                     |
| queries                  | correlatedQueryIndex                | int64    | Zero-based index of the query to correlate with in sequence detection rules. Up to 10 queries are supported, so valid values are 0 to 9.                                                                                                                                                                                                                                                                         |
| queries                  | customQueryExtension                | string   | Custom query extension used to refine the base query.                                                                                                                                                                                                                                                                                                                                                            |
| queries                  | dataSource                          | enum     | Source of events, either logs, audit trail, security signals, or Datadog events. `app_sec_spans` is deprecated in favor of `spans`. Allowed enum values: `logs`, `audit`, `app_sec_spans`, `spans`, `security_runtime`, `network`, `events`, `security_signals`. Default: `logs`.                                                                                                                                |
| queries                  | datasetIds                          | [string] | IDs of reference datasets used by this query.                                                                                                                                                                                                                                                                                                                                                                    |
| queries                  | datasetVersions                     | object   | Version of each dataset used by the job, keyed by dataset ID. Pinned when the job is created. Read-only.                                                                                                                                                                                                                                                                                                         |
| additionalProperties     | <any-key>                           | int64    | Dataset version.                                                                                                                                                                                                                                                                                                                                                                                                 |
| queries                  | distinctFields                      | [string] | Field for which the cardinality is measured. Sent as an array.                                                                                                                                                                                                                                                                                                                                                   |
| queries                  | groupByFields                       | [string] | Fields to group by.                                                                                                                                                                                                                                                                                                                                                                                              |
| queries                  | hasOptionalGroupByFields            | boolean  | When false, events without a group-by value are ignored by the query. When true, events with missing group-by fields are processed with `N/A`, replacing the missing values. Default: `false`.                                                                                                                                                                                                                   |
| queries                  | index                               | string   | Index used to load the data for this query.                                                                                                                                                                                                                                                                                                                                                                      |
| queries                  | indexes                             | [string] | Indexes used to load the data for this query. Mutually exclusive with `index`.                                                                                                                                                                                                                                                                                                                                   |
| queries                  | metric                              | string   | **DEPRECATED**: (Deprecated) The target field to aggregate over when using the sum or max aggregations. Use the `metrics` field instead.                                                                                                                                                                                                                                                                         |
| queries                  | metrics                             | [string] | Group of target fields to aggregate over when using the sum, max, geo data, or new value aggregations. The sum, max, and geo data aggregations only accept one value in this list, whereas the new value aggregation accepts up to five values.                                                                                                                                                                  |
| queries                  | name                                | string   | Name of the query.                                                                                                                                                                                                                                                                                                                                                                                               |
| queries                  | query                               | string   | Query to run on logs.                                                                                                                                                                                                                                                                                                                                                                                            |
| queries                  | queryLanguage                       | string   | Language used to parse the query string.                                                                                                                                                                                                                                                                                                                                                                         |
| jobDefinition            | referenceTables                     | [object] | Reference tables used in the queries.                                                                                                                                                                                                                                                                                                                                                                            |
| referenceTables          | checkPresence                       | boolean  | Whether to include or exclude the matched values.                                                                                                                                                                                                                                                                                                                                                                |
| referenceTables          | columnName                          | string   | The name of the column in the reference table.                                                                                                                                                                                                                                                                                                                                                                   |
| referenceTables          | logFieldPath                        | string   | The field in the log to match against the reference table.                                                                                                                                                                                                                                                                                                                                                       |
| referenceTables          | ruleQueryName                       | string   | The name of the query to apply the reference table to.                                                                                                                                                                                                                                                                                                                                                           |
| referenceTables          | tableName                           | string   | The name of the reference table.                                                                                                                                                                                                                                                                                                                                                                                 |
| jobDefinition            | tags                                | [string] | Tags for generated signals.                                                                                                                                                                                                                                                                                                                                                                                      |
| jobDefinition            | thirdPartyCases                     | [object] | Cases for generating results from third-party detection method. Only available for third-party detection method. Up to 10 cases are allowed.                                                                                                                                                                                                                                                                     |
| thirdPartyCases          | customStatus                        | enum     | Severity of the Security Signal. Allowed enum values: `info`, `low`, `medium`, `high`, `critical`.                                                                                                                                                                                                                                                                                                               |
| thirdPartyCases          | name                                | string   | Name of the case.                                                                                                                                                                                                                                                                                                                                                                                                |
| thirdPartyCases          | notifications                       | [string] | Notification targets for each case.                                                                                                                                                                                                                                                                                                                                                                              |
| thirdPartyCases          | query                               | string   | A query to map a third party event to this case.                                                                                                                                                                                                                                                                                                                                                                 |
| thirdPartyCases          | status [*required*]                 | enum     | Severity of the Security Signal. Allowed enum values: `info`, `low`, `medium`, `high`, `critical`.                                                                                                                                                                                                                                                                                                               |
| jobDefinition            | to [*required*]                     | int64    | Ending time of data analyzed by the job.                                                                                                                                                                                                                                                                                                                                                                         |
| jobDefinition            | type                                | string   | Job type.                                                                                                                                                                                                                                                                                                                                                                                                        |
| attributes               | jobName                             | string   | Job name.                                                                                                                                                                                                                                                                                                                                                                                                        |
| attributes               | jobStatus                           | string   | Job status.                                                                                                                                                                                                                                                                                                                                                                                                      |
| attributes               | modifiedAt                          | string   | Last modification time of the job.                                                                                                                                                                                                                                                                                                                                                                               |
| attributes               | progressRate                        | double   | Job execution progress as a value between 0 and 1. Available for ongoing jobs.                                                                                                                                                                                                                                                                                                                                   |
| attributes               | signalOutput                        | boolean  | Whether the job outputs signals.                                                                                                                                                                                                                                                                                                                                                                                 |
| data                     | id                                  | string   | ID of the job.                                                                                                                                                                                                                                                                                                                                                                                                   |
| data                     | type                                | enum     | Type of payload. Allowed enum values: `historicalDetectionsJob`.                                                                                                                                                                                                                                                                                                                                                 |
|                          | meta                                | object   | Metadata about the list of jobs.                                                                                                                                                                                                                                                                                                                                                                                 |
| meta                     | totalCount                          | int32    | Number of jobs in the list.                                                                                                                                                                                                                                                                                                                                                                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "createdAt": "string",
        "createdByHandle": "string",
        "createdByName": "string",
        "createdFromRuleId": "string",
        "failure": {
          "hint": "Narrow the time range or reduce the data scanned.",
          "reason": "query_too_expensive"
        },
        "jobDefinition": {
          "calculatedFields": [
            {
              "expression": "@request_end_timestamp - @request_start_timestamp",
              "name": "response_time"
            }
          ],
          "cases": [
            {
              "actions": [
                {
                  "options": {
                    "duration": 0,
                    "flaggedIPType": "FLAGGED",
                    "userBehaviorName": "string"
                  },
                  "type": "string"
                }
              ],
              "condition": "string",
              "customStatus": "critical",
              "name": "string",
              "notifications": [],
              "status": "critical"
            }
          ],
          "from": 1729843470000,
          "groupSignalsBy": [
            "service"
          ],
          "index": "cloud_siem",
          "isBackfillJob": false,
          "isShadowDeployed": false,
          "message": "A large number of failed login attempts.",
          "name": "Excessive number of failed attempts.",
          "options": {
            "anomalyDetectionOptions": {
              "bucketDuration": 300,
              "detectionTolerance": 5,
              "instantaneousBaseline": false,
              "learningDuration": "integer",
              "learningPeriodBaseline": "integer"
            },
            "complianceRuleOptions": {
              "complexRule": false,
              "regoRule": {
                "policy": "package datadog\n\nimport data.datadog.output as dd_output\nimport future.keywords.contains\nimport future.keywords.if\nimport future.keywords.in\n\neval(resource) = \"skip\" if {\n  # Logic that evaluates to true if the resource should be skipped\n  true\n} else = \"pass\" {\n  # Logic that evaluates to true if the resource is compliant\n  true\n} else = \"fail\" {\n  # Logic that evaluates to true if the resource is not compliant\n  true\n}\n\n# This part remains unchanged for all rules\nresults contains result if {\n  some resource in input.resources[input.main_resource_type]\n  result := dd_output.format(resource, eval(resource))\n}",
                "resourceTypes": [
                  "gcp_iam_service_account",
                  "gcp_iam_policy"
                ]
              },
              "resourceType": "aws_acm"
            },
            "decreaseCriticalityBasedOnEnv": false,
            "detectionMethod": "string",
            "evaluationWindow": "integer",
            "hardcodedEvaluatorType": "string",
            "impossibleTravelOptions": {
              "baselineUserLocations": true,
              "baselineUserLocationsDuration": "integer",
              "detectIpTransition": false
            },
            "keepAlive": "integer",
            "maxSignalDuration": "integer",
            "newValueOptions": {
              "forgetAfter": "integer",
              "instantaneousBaseline": false,
              "instantaneousBaselineTimeoutMinutes": "integer",
              "learningDuration": "integer",
              "learningMethod": "string",
              "learningThreshold": "integer"
            },
            "sequenceDetectionOptions": {
              "stepTransitions": [
                {
                  "child": "string",
                  "evaluationWindow": "integer",
                  "parent": "string"
                }
              ],
              "steps": [
                {
                  "condition": "string",
                  "evaluationWindow": "integer",
                  "name": "string"
                }
              ]
            },
            "thirdPartyRuleOptions": {
              "defaultNotifications": [],
              "defaultStatus": "critical",
              "rootQueries": [
                {
                  "groupByFields": [],
                  "query": "source:cloudtrail"
                }
              ],
              "signalTitleTemplate": "string"
            }
          },
          "projectedPerQuery": [],
          "queries": [
            {
              "additionalFilters": "string",
              "aggregation": "string",
              "correlatedByFields": [],
              "correlatedQueryIndex": "integer",
              "customQueryExtension": "string",
              "dataSource": "logs",
              "datasetIds": [],
              "datasetVersions": {
                "<any-key>": "integer"
              },
              "distinctFields": [],
              "groupByFields": [],
              "hasOptionalGroupByFields": false,
              "index": "string",
              "indexes": [],
              "metric": "string",
              "metrics": [],
              "name": "string",
              "query": "a > 3",
              "queryLanguage": "string"
            }
          ],
          "referenceTables": [
            {
              "checkPresence": false,
              "columnName": "string",
              "logFieldPath": "string",
              "ruleQueryName": "string",
              "tableName": "string"
            }
          ],
          "tags": [],
          "thirdPartyCases": [
            {
              "customStatus": "critical",
              "name": "string",
              "notifications": [],
              "query": "string",
              "status": "critical"
            }
          ],
          "to": 1729847070000,
          "type": "string"
        },
        "jobName": "string",
        "jobStatus": "string",
        "modifiedAt": "string",
        "progressRate": "number",
        "signalOutput": false
      },
      "id": "string",
      "type": "string"
    }
  ],
  "meta": {
    "totalCount": "integer"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Not Authorized

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/siem-historical-detections/jobs" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}

{% tab label="Go" %}
```go
// List historical jobs returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.ListHistoricalJobs", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSecurityMonitoringApi(apiClient)
	resp, r, err := api.ListHistoricalJobs(ctx, *datadogV2.NewListHistoricalJobsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.ListHistoricalJobs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.ListHistoricalJobs`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// List historical jobs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.ListHistoricalJobsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    defaultClient.setUnstableOperationEnabled("v2.listHistoricalJobs", true);
    SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

    try {
      ListHistoricalJobsResponse result = apiInstance.listHistoricalJobs();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SecurityMonitoringApi#listHistoricalJobs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
List historical jobs returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["list_historical_jobs"] = True
with ApiClient(configuration) as api_client:
    api_instance = SecurityMonitoringApi(api_client)
    response = api_instance.list_historical_jobs()

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# List historical jobs returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
  config.unstable_operations["v2.list_historical_jobs".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
p api_instance.list_historical_jobs()
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// List historical jobs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::ListHistoricalJobsOptionalParams;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;

#[tokio::main]
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.list_historical_jobs", true);
    let api = SecurityMonitoringAPI::with_config(configuration);
    let resp = api
        .list_historical_jobs(ListHistoricalJobsOptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * List historical jobs returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
configuration.unstableOperations["v2.listHistoricalJobs"] = true;
const apiInstance = new v2.SecurityMonitoringApi(configuration);

apiInstance
  .listHistoricalJobs()
  .then((data: v2.ListHistoricalJobsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"
```
{% /tab %}
{% /tabs %}
