---
title: "POST /v1/{+parent}/modelDeploymentMonitoringJobs"
method: POST
path: "/v1/{+parent}/modelDeploymentMonitoringJobs"
tags: ["projects"]
---

# POST /v1/{+parent}/modelDeploymentMonitoringJobs

`POST /v1/{+parent}/modelDeploymentMonitoringJobs`

Creates a ModelDeploymentMonitoringJob. It will run periodically on a configured interval.

## Path parameters

- `parent` string, required

## Request body

- GoogleCloudAiplatformV1ModelDeploymentMonitoringJob — Represents a job that runs periodically to monitor the deployed models in an endpoint. It will analyze the logged training & prediction data to detect any abnormal behaviors.
  - `state` 'JOB_STATE_UNSPECIFIED' | 'JOB_STATE_QUEUED' | 'JOB_STATE_PENDING' | 'JOB_STATE_RUNNING' | 'JOB_STATE_SUCCEEDED' | 'JOB_STATE_FAILED' | 'JOB_STATE_CANCELLING' | 'JOB_STATE_CANCELLED' | 'JOB_STATE_PAUSED' | 'JOB_STATE_EXPIRED' | 'JOB_STATE_UPDATING' | 'JOB_STATE_PARTIALLY_SUCCEEDED' — Output only. The detailed state of the monitoring job. When the job is still creating, the state will be 'PENDING'. Once the job is successfully created, the state will be 'RUNNING'. Pause the job, the state will be 'PAUSED'. Resume the job, the state will return to 'RUNNING'.
  - `createTime` string, google-datetime — Output only. Timestamp when this ModelDeploymentMonitoringJob was created.
  - `statsAnomaliesBaseDirectory` GoogleCloudAiplatformV1GcsDestination — The Google Cloud Storage location where the output is to be written to.
    - `outputUriPrefix` string — Required. Google Cloud Storage URI to output directory. If the uri doesn't end with '/', a '/' will be automatically appended. The directory is created if it doesn't exist.
  - `samplePredictInstance` unknown
  - `enableMonitoringPipelineLogs` boolean — If true, the scheduled monitoring pipeline logs are sent to Google Cloud Logging, including pipeline status and anomalies detected. Please note the logs incur cost, which are subject to [Cloud Logging pricing](https://cloud.google.com/logging#pricing).
  - `loggingSamplingStrategy` GoogleCloudAiplatformV1SamplingStrategy — Sampling Strategy for logging, can be for both training and prediction dataset.
    - `randomSampleConfig` GoogleCloudAiplatformV1SamplingStrategyRandomSampleConfig — Requests are randomly selected.
      - `sampleRate` number, double — Sample rate (0, 1]
  - `modelMonitoringAlertConfig` GoogleCloudAiplatformV1ModelMonitoringAlertConfig — The alert config for model monitoring.
    - `notificationChannels` string[] — Resource names of the NotificationChannels to send alert. Must be of the format `projects//notificationChannels/`
    - `emailAlertConfig` GoogleCloudAiplatformV1ModelMonitoringAlertConfigEmailAlertConfig — The config for email alert.
      - `userEmails` string[] — The email addresses to send the alert.
    - `enableLogging` boolean — Dump the anomalies to Cloud Logging. The anomalies will be put to json payload encoded from proto ModelMonitoringStatsAnomalies. This can be further synced to Pub/Sub or any other services supported by Cloud Logging.
  - `error` GoogleRpcStatus — The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
    - `code` integer — The status code, which should be an enum value of google.rpc.Code.
    - `message` string — A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
    - `details` object[] — A list of messages that carry the error details. There is a common set of message types for APIs to use.
  - `endpoint` string — Required. Endpoint resource name. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
  - `encryptionSpec` GoogleCloudAiplatformV1EncryptionSpec — Represents a customer-managed encryption key specification that can be applied to a Vertex AI resource.
    - `kmsKeyName` string — Required. Resource name of the Cloud KMS key used to protect the resource. The Cloud KMS key must be in the same region as the resource. It must have the format `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
  - `modelDeploymentMonitoringObjectiveConfigs` GoogleCloudAiplatformV1ModelDeploymentMonitoringObjectiveConfig[] — Required. The config for monitoring objectives. This is a per DeployedModel config. Each DeployedModel needs to be configured separately.
    - `deployedModelId` string — The DeployedModel ID of the objective config.
    - `objectiveConfig` GoogleCloudAiplatformV1ModelMonitoringObjectiveConfig — The objective configuration for model monitoring, including the information needed to detect anomalies for one particular model.
      - `trainingDataset` GoogleCloudAiplatformV1ModelMonitoringObjectiveConfigTrainingDataset — Training Dataset information.
        - `dataset` string — The resource name of the Dataset used to train this Model.
        - `targetField` string — The target field name the model is to predict. This field will be excluded when doing Predict and (or) Explain for the training data.
        - `dataFormat` string — Data format of the dataset, only applicable if the input is from Google Cloud Storage. The possible formats are: "tf-record" The source file is a TFRecord file. "csv" The source file is a CSV file. "jsonl" The source file is a JSONL file.
        - `loggingSamplingStrategy` GoogleCloudAiplatformV1SamplingStrategy — Sampling Strategy for logging, can be for both training and prediction dataset.
          - `randomSampleConfig` GoogleCloudAiplatformV1SamplingStrategyRandomSampleConfig — Requests are randomly selected.
            - `sampleRate` number, double — Sample rate (0, 1]
        - `gcsSource` GoogleCloudAiplatformV1GcsSource — The Google Cloud Storage location for the input content.
          - `uris` string[] — Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards.
        - `bigquerySource` GoogleCloudAiplatformV1BigQuerySource — The BigQuery location for the input content.
          - `inputUri` string — Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * BigQuery path. For example: `bq://projectId.bqDatasetId.bqTableId`.
      - `explanationConfig` GoogleCloudAiplatformV1ModelMonitoringObjectiveConfigExplanationConfig — The config for integrating with Vertex Explainable AI. Only applicable if the Model has explanation_spec populated.
        - `enableFeatureAttributes` boolean — If want to analyze the Vertex Explainable AI feature attribute scores or not. If set to true, Vertex AI will log the feature attributions from explain response and do the skew/drift detection for them.
        - `explanationBaseline` GoogleCloudAiplatformV1ModelMonitoringObjectiveConfigExplanationConfigExplanationBaseline — Output from BatchPredictionJob for Model Monitoring baseline dataset, which can be used to generate baseline attribution scores.
          - `gcs` GoogleCloudAiplatformV1GcsDestination — The Google Cloud Storage location where the output is to be written to.
            - `outputUriPrefix` string — Required. Google Cloud Storage URI to output directory. If the uri doesn't end with '/', a '/' will be automatically appended. The directory is created if it doesn't exist.
          - `bigquery` GoogleCloudAiplatformV1BigQueryDestination — The BigQuery location for the output content.
            - `outputUri` string — Required. BigQuery URI to a project or table, up to 2000 characters long. When only the project is specified, the Dataset and Table is created. When the full table reference is specified, the Dataset must exist and table must not exist. Accepted forms: * BigQuery path. For example: `bq://projectId` or `bq://projectId.bqDatasetId` or `bq://projectId.bqDatasetId.bqTableId`.
          - `predictionFormat` 'PREDICTION_FORMAT_UNSPECIFIED' | 'JSONL' | 'BIGQUERY' — The storage format of the predictions generated BatchPrediction job.
      - `trainingPredictionSkewDetectionConfig` GoogleCloudAiplatformV1ModelMonitoringObjectiveConfigTrainingPredictionSkewDetectionConfig — The config for Training & Prediction data skew detection. It specifies the training dataset sources and the skew detection parameters.
        - `skewThresholds` object — Key is the feature name and value is the threshold. If a feature needs to be monitored for skew, a value threshold must be configured for that feature. The threshold here is against feature distribution distance between the training and prediction feature.
        - `attributionScoreSkewThresholds` object — Key is the feature name and value is the threshold. The threshold here is against attribution score distance between the training and prediction feature.
        - `defaultSkewThreshold` GoogleCloudAiplatformV1ThresholdConfig — The config for feature monitoring threshold.
          - `value` number, double — Specify a threshold value that can trigger the alert. If this threshold config is for feature distribution distance: 1. For categorical feature, the distribution distance is calculated by L-inifinity norm. 2. For numerical feature, the distribution distance is calculated by Jensen–Shannon divergence. Each feature must have a non-zero threshold if they need to be monitored. Otherwise no alert will be triggered for that feature.
      - `predictionDriftDetectionConfig` GoogleCloudAiplatformV1ModelMonitoringObjectiveConfigPredictionDriftDetectionConfig — The config for Prediction data drift detection.
        - `driftThresholds` object — Key is the feature name and value is the threshold. If a feature needs to be monitored for drift, a value threshold must be configured for that feature. The threshold here is against feature distribution distance between different time windws.
        - `defaultDriftThreshold` GoogleCloudAiplatformV1ThresholdConfig — The config for feature monitoring threshold.
          - `value` number, double — Specify a threshold value that can trigger the alert. If this threshold config is for feature distribution distance: 1. For categorical feature, the distribution distance is calculated by L-inifinity norm. 2. For numerical feature, the distribution distance is calculated by Jensen–Shannon divergence. Each feature must have a non-zero threshold if they need to be monitored. Otherwise no alert will be triggered for that feature.
        - `attributionScoreDriftThresholds` object — Key is the feature name and value is the threshold. The threshold here is against attribution score distance between different time windows.
  - `logTtl` string, google-duration — The TTL of BigQuery tables in user projects which stores logs. A day is the basic unit of the TTL and we take the ceil of TTL/86400(a day). e.g. { second: 3600} indicates ttl = 1 day.
  - `analysisInstanceSchemaUri` string — YAML schema file uri describing the format of a single instance that you want Tensorflow Data Validation (TFDV) to analyze. If this field is empty, all the feature data types are inferred from predict_instance_schema_uri, meaning that TFDV will use the data in the exact format(data type) as prediction request/response. If there are any data type differences between predict instance and TFDV instance, this field can be used to override the schema. For models trained with Vertex AI, this field must be set as all the fields in predict instance formatted as string.
  - `modelDeploymentMonitoringScheduleConfig` GoogleCloudAiplatformV1ModelDeploymentMonitoringScheduleConfig — The config for scheduling monitoring job.
    - `monitorInterval` string, google-duration — Required. The model monitoring job scheduling interval. It will be rounded up to next full hour. This defines how often the monitoring jobs are triggered.
    - `monitorWindow` string, google-duration — The time window of the prediction data being included in each prediction dataset. This window specifies how long the data should be collected from historical model results for each run. If not set, ModelDeploymentMonitoringScheduleConfig.monitor_interval will be used. e.g. If currently the cutoff time is 2022-01-08 14:30:00 and the monitor_window is set to be 3600, then data from 2022-01-08 13:30:00 to 2022-01-08 14:30:00 will be retrieved and aggregated to calculate the monitoring statistics.
  - `updateTime` string, google-datetime — Output only. Timestamp when this ModelDeploymentMonitoringJob was updated most recently.
  - `labels` object — The labels with user-defined metadata to organize your ModelDeploymentMonitoringJob. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.
  - `name` string — Output only. Resource name of a ModelDeploymentMonitoringJob.
  - `latestMonitoringPipelineMetadata` GoogleCloudAiplatformV1ModelDeploymentMonitoringJobLatestMonitoringPipelineMetadata — All metadata of most recent monitoring pipelines.
    - `runTime` string, google-datetime — The time that most recent monitoring pipelines that is related to this run.
    - `status` GoogleRpcStatus — The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
      - `code` integer — The status code, which should be an enum value of google.rpc.Code.
      - `message` string — A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
      - `details` object[] — A list of messages that carry the error details. There is a common set of message types for APIs to use.
  - `predictInstanceSchemaUri` string — YAML schema file uri describing the format of a single instance, which are given to format this Endpoint's prediction (and explanation). If not set, we will generate predict schema from collected predict requests.
  - `displayName` string — Required. The user-defined name of the ModelDeploymentMonitoringJob. The name can be up to 128 characters long and can consist of any UTF-8 characters. Display name of a ModelDeploymentMonitoringJob.
  - `satisfiesPzi` boolean — Output only. Reserved for future use.
  - `satisfiesPzs` boolean — Output only. Reserved for future use.
  - `scheduleState` 'MONITORING_SCHEDULE_STATE_UNSPECIFIED' | 'PENDING' | 'OFFLINE' | 'RUNNING' — Output only. Schedule state when the monitoring job is in Running state.
  - `nextScheduleTime` string, google-datetime — Output only. Timestamp when this monitoring pipeline will be scheduled to run for the next round.
  - `bigqueryTables` GoogleCloudAiplatformV1ModelDeploymentMonitoringBigQueryTable[] — Output only. The created bigquery tables for the job under customer project. Customer could do their own query & analysis. There could be 4 log tables in maximum: 1. Training data logging predict request/response 2. Serving data logging predict request/response
    - `requestResponseLoggingSchemaVersion` string — Output only. The schema version of the request/response logging BigQuery table. Default to v1 if unset.
    - `logType` 'LOG_TYPE_UNSPECIFIED' | 'PREDICT' | 'EXPLAIN' — The type of log.
    - `bigqueryTablePath` string — The created BigQuery table to store logs. Customer could do their own query & analysis. Format: `bq://.model_deployment_monitoring_._`
    - `logSource` 'LOG_SOURCE_UNSPECIFIED' | 'TRAINING' | 'SERVING' — The source of log.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/aiplatform.md) · [All operations](https://skmtc.net/google/apis/aiplatform/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/aiplatform/versions/b608d71b91f0/schema)
