{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grepr/json-schema/grepr-read-datadog-schema.json",
  "title": "ReadDatadog",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grepr-datadog-integration-api-openapi.yml#/components/schemas/ReadDatadog",
  "properties": {
    "createdAt": {
      "description": "Timestamp when the integration was created.",
      "format": "date-time",
      "readOnly": true,
      "type": "string"
    },
    "id": {
      "description": "The integration id",
      "type": "string"
    },
    "jobIds": {
      "description": "List of job IDs associated with the integration.",
      "items": {
        "description": "List of job IDs associated with the integration.",
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    },
    "name": {
      "description": "Name of the integration.",
      "pattern": "[a-zA-Z0-9 _-]{1,128}",
      "type": "string"
    },
    "organizationId": {
      "description": "Organization ID of the integration.",
      "type": "string"
    },
    "payload": {
      "$ref": "#/$defs/Datadog"
    },
    "teamIds": {
      "description": "The team IDs that this integration is associated with.",
      "items": {
        "description": "The team IDs that this integration is associated with.",
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    },
    "type": {
      "description": "The type of the integration. This is used to determine the payload type.",
      "enum": [
        "datadog"
      ],
      "type": "string"
    },
    "updatedAt": {
      "description": "Timestamp when the integration was last updated.",
      "format": "date-time",
      "readOnly": true,
      "type": "string"
    },
    "version": {
      "description": "Version of the integration. Should be increased by one for every new update in order for the write to succeed. Otherwise, a '409 Conflict' will be returned.",
      "format": "int32",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "createdAt",
    "id",
    "jobIds",
    "name",
    "organizationId",
    "payload",
    "type",
    "updatedAt",
    "version"
  ],
  "type": "object",
  "$defs": {
    "AndEventPredicate": {
      "properties": {
        "queries": {
          "default": [],
          "description": "List of predicates that must all match for this predicate to match.",
          "items": {
            "$ref": "#/$defs/EventPredicate"
          },
          "maxItems": 2147483647,
          "minItems": 1,
          "title": "Child predicates",
          "type": "array"
        },
        "type": {
          "description": "A predicate that matches when every child predicate matches.",
          "enum": [
            "and-predicate"
          ],
          "type": "string"
        }
      },
      "required": [
        "queries",
        "type"
      ],
      "type": "object"
    },
    "Datadog": {
      "description": "The payload containing integration data.",
      "properties": {
        "additionalTags": {
          "default": [],
          "description": "Tags to add when writing data to Datadog",
          "items": {
            "description": "Tags to add when writing data to Datadog",
            "type": "string"
          },
          "maxItems": 10,
          "minItems": 0,
          "type": "array"
        },
        "apiKey": {
          "description": "Masked API key for Datadog",
          "readOnly": true,
          "type": "string"
        },
        "apiKeys": {
          "description": "The API keys configured for this integration (masked).",
          "items": {
            "$ref": "#/$defs/IngestKeyView"
          },
          "readOnly": true,
          "type": "array"
        },
        "appKey": {
          "description": "Masked App key for Datadog",
          "readOnly": true,
          "type": "string"
        },
        "clientToken": {
          "description": "Client token for Datadog",
          "readOnly": true,
          "type": "string"
        },
        "dashboardFreshnessWindow": {
          "description": "The active dashboard threshold: only dashboards viewed within it are imported as parsed queries. When unset, every dashboard is imported. Minimum one day.",
          "format": "ISO-8601",
          "type": "string"
        },
        "exceptions": {
          "additionalProperties": {
            "$ref": "#/$defs/VendorImportedException"
          },
          "description": "The imported exceptions from Datadog. This is a map from the vendor resource Id to the exception.",
          "readOnly": true,
          "type": "object"
        },
        "filterQuery": {
          "default": "",
          "description": "Filter to apply when reading any data from the Datadog API",
          "maxLength": 1024,
          "minLength": 0,
          "type": "string"
        },
        "includeNeverViewedDashboards": {
          "default": true,
          "description": "When the active dashboard threshold is set, whether dashboards that were never viewed are still imported. Unset means they are.",
          "type": "boolean"
        },
        "sendKeyId": {
          "description": "Identifier of the API key used to send data back to Datadog. Defaults to the only key when unset.",
          "maxLength": 64,
          "minLength": 0,
          "type": "string"
        },
        "site": {
          "description": "Datadog site URL",
          "maxLength": 255,
          "minLength": 0,
          "type": "string"
        },
        "validateKeysOnSave": {
          "default": true,
          "description": "Indicates whether to validate the API and App keys when saving the keys.",
          "type": "boolean"
        }
      },
      "required": [
        "additionalTags",
        "filterQuery",
        "site"
      ],
      "type": "object",
      "x-type": {
        "type": "datadog"
      }
    },
    "DatadogQueryPredicate": {
      "properties": {
        "query": {
          "default": "",
          "description": "The datadog query used by the predicate. See https://docs.datadoghq.com/tracing/trace_explorer/query_syntax",
          "type": "string"
        },
        "type": {
          "description": "A predicate that checks if an event matches a datadog query.",
          "enum": [
            "datadog-query"
          ],
          "type": "string"
        }
      },
      "required": [
        "query",
        "type"
      ],
      "type": "object"
    },
    "EventPredicate": {
      "description": "Predicate applied to rows before analytical aggregation.",
      "oneOf": [
        {
          "$ref": "#/$defs/AndEventPredicate"
        },
        {
          "$ref": "#/$defs/DatadogQueryPredicate"
        },
        {
          "$ref": "#/$defs/MetricEventPredicate"
        },
        {
          "$ref": "#/$defs/NewRelicQueryPredicate"
        },
        {
          "$ref": "#/$defs/NrqlQueryPredicate"
        }
      ],
      "properties": {
        "query": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "IngestKeyView": {
      "description": "The API keys configured for this integration (masked).",
      "properties": {
        "keyId": {
          "description": "Opaque identifier of the API key",
          "type": "string"
        },
        "label": {
          "description": "User-supplied display name for the key, purely informational",
          "type": "string"
        },
        "maskedValue": {
          "description": "Masked value of the API key",
          "type": "string"
        },
        "sendKey": {
          "description": "Whether this key is used to send data back to the vendor",
          "type": "boolean"
        }
      },
      "readOnly": true,
      "type": "object"
    },
    "MetricEventPredicate": {
      "properties": {
        "filterTags": {
          "additionalProperties": {
            "default": {},
            "description": "The set of tags to query for. If unspecified, all tags are queried.",
            "items": {
              "default": "{}",
              "description": "The set of tags to query for. If unspecified, all tags are queried.",
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "default": {},
          "description": "The set of tags to query for. If unspecified, all tags are queried.",
          "type": "object"
        },
        "metricNames": {
          "default": [],
          "description": "The names of the metrics to query. Must not be empty.",
          "items": {
            "description": "The names of the metrics to query. Must not be empty.",
            "type": "string"
          },
          "maxItems": 2147483647,
          "minItems": 1,
          "type": "array"
        },
        "query": {
          "type": "string"
        },
        "type": {
          "description": "A predicate that checks if an event matches a metrics query.",
          "enum": [
            "metric-predicate"
          ],
          "type": "string"
        }
      },
      "required": [
        "metricNames",
        "query",
        "type"
      ],
      "type": "object"
    },
    "NewRelicQueryPredicate": {
      "properties": {
        "query": {
          "default": "",
          "description": "The New Relic query used by the predicate. See https://docs.newrelic.com/docs/logs/ui-data/query-syntax-logs/ ",
          "type": "string"
        },
        "type": {
          "description": "A predicate that checks if an event matches a New Relic query.",
          "enum": [
            "newrelic-query"
          ],
          "type": "string"
        }
      },
      "required": [
        "query",
        "type"
      ],
      "type": "object"
    },
    "NrqlQueryPredicate": {
      "properties": {
        "query": {
          "default": "",
          "description": "The Nrql query used by the predicate. See https://docs.newrelic.com/docs/nrql",
          "type": "string"
        },
        "strict": {
          "default": true,
          "description": "Whether the query should be parsed in strict mode.",
          "type": "boolean"
        },
        "type": {
          "description": "A predicate that checks if an event matches an NRQL query.",
          "enum": [
            "nrql-query"
          ],
          "type": "string"
        }
      },
      "required": [
        "query",
        "type"
      ],
      "type": "object"
    },
    "ParseResult": {
      "properties": {
        "errorMessage": {
          "type": "string"
        },
        "parseable": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "VendorImportedException": {
      "description": "Exception that was imported from a vendor integration like Datadog, Splunk etc.",
      "properties": {
        "accountGroup": {
          "description": "Account group hash identifying the vendor account",
          "readOnly": true,
          "type": "string"
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "eventPredicate": {
          "$ref": "#/$defs/EventPredicate"
        },
        "eventPredicateHash": {
          "description": "Hash of the event predicate for deduplication",
          "readOnly": true,
          "type": "string"
        },
        "exceptionType": {
          "enum": [
            "DATADOG_MONITOR",
            "DATADOG_DASHBOARD",
            "DATADOG_LOG_BASED_METRICS",
            "SPLUNK_MONITOR",
            "NEW_RELIC_MONITOR",
            "NEW_RELIC_DASHBOARD"
          ],
          "type": "string"
        },
        "integrationId": {
          "type": "string"
        },
        "parseResult": {
          "$ref": "#/$defs/ParseResult"
        },
        "sourceUri": {
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        },
        "vendorResourceId": {
          "type": "string"
        },
        "vendorResourceName": {
          "type": "string"
        }
      },
      "readOnly": true,
      "required": [
        "vendorResourceId"
      ],
      "type": "object"
    }
  }
}