---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/endpoints/{endpointsId}:explain"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/endpoints/{endpointsId}:explain"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/endpoints/{endpointsId}:explain

`POST /v1/projects/{projectsId}/locations/{locationsId}/endpoints/{endpointsId}:explain`

## Request

- Base URL: `https://aiplatform.googleapis.com`
- URL: `https://aiplatform.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/endpoints/{endpointsId}:explain`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/aiplatform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/aiplatform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform.read-only`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform.read-only`

Perform an online explanation. If deployed_model_id is specified, the corresponding DeployModel must have explanation_spec populated. If deployed_model_id is not specified, all DeployedModels must have explanation_spec populated.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `endpointsId` string, required

## Request body

- GoogleCloudAiplatformV1ExplainRequest: Request message for PredictionService.Explain.
  - `deployedModelId` string: If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding Endpoint.traffic_split.
  - `explanationSpecOverride` GoogleCloudAiplatformV1ExplanationSpecOverride: The ExplanationSpec entries that can be overridden at online explanation time.
    - `examplesOverride` GoogleCloudAiplatformV1ExamplesOverride: Overrides for example-based explanations.
      - `crowdingCount` integer: The number of neighbors to return that have the same crowding tag.
      - `dataFormat` 'DATA_FORMAT_UNSPECIFIED' | 'INSTANCES' | 'EMBEDDINGS': The format of the data being provided with each call.
      - `neighborCount` integer: The number of neighbors to return.
      - `restrictions` GoogleCloudAiplatformV1ExamplesRestrictionsNamespace[]: Restrict the resulting nearest neighbors to respect these constraints.
        - `allow` string[]: The list of allowed tags.
        - `deny` string[]: The list of deny tags.
        - `namespaceName` string: The namespace name.
      - `returnEmbeddings` boolean: If true, return the embeddings instead of neighbors.
    - `metadata` GoogleCloudAiplatformV1ExplanationMetadataOverride: The ExplanationMetadata entries that can be overridden at online explanation time.
      - `inputs` object: Required. Overrides the input metadata of the features. The key is the name of the feature to be overridden. The keys specified here must exist in the input metadata to be overridden. If a feature is not specified here, the corresponding feature's input metadata is not overridden.
    - `parameters` GoogleCloudAiplatformV1ExplanationParameters: Parameters to configure explaining for Model's predictions.
      - `examples` GoogleCloudAiplatformV1Examples: Example-based explainability that returns the nearest neighbors from the provided dataset.
        - `exampleGcsSource` GoogleCloudAiplatformV1ExamplesExampleGcsSource: The Cloud Storage input instances.
          - `dataFormat` 'DATA_FORMAT_UNSPECIFIED' | 'JSONL': The format in which instances are given, if not specified, assume it's JSONL format. Currently only JSONL format is supported.
          - `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.
        - `nearestNeighborSearchConfig` unknown
        - `neighborCount` integer: The number of neighbors to return when querying for examples.
        - `presets` GoogleCloudAiplatformV1Presets: Preset configuration for example-based explanations
          - `modality` 'MODALITY_UNSPECIFIED' | 'IMAGE' | 'TEXT' | 'TABULAR': The modality of the uploaded model, which automatically configures the distance measurement and feature normalization for the underlying example index and queries. If your model does not precisely fit one of these types, it is okay to choose the closest type.
          - `query` 'PRECISE' | 'FAST': Preset option controlling parameters for speed-precision trade-off when querying for examples. If omitted, defaults to `PRECISE`.
      - `integratedGradientsAttribution` GoogleCloudAiplatformV1IntegratedGradientsAttribution: An attribution method that computes the Aumann-Shapley value taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1703.01365
        - `blurBaselineConfig` GoogleCloudAiplatformV1BlurBaselineConfig: Config for blur baseline. When enabled, a linear path from the maximally blurred image to the input image is created. Using a blurred baseline instead of zero (black image) is motivated by the BlurIG approach explained here: https://arxiv.org/abs/2004.03383
          - `maxBlurSigma` number, float: The standard deviation of the blur kernel for the blurred baseline. The same blurring parameter is used for both the height and the width dimension. If not set, the method defaults to the zero (i.e. black for images) baseline.
        - `smoothGradConfig` GoogleCloudAiplatformV1SmoothGradConfig: Config for SmoothGrad approximation of gradients. When enabled, the gradients are approximated by averaging the gradients from noisy samples in the vicinity of the inputs. Adding noise can help improve the computed gradients. Refer to this paper for more details: https://arxiv.org/pdf/1706.03825.pdf
          - `featureNoiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigma: Noise sigma by features. Noise sigma represents the standard deviation of the gaussian kernel that will be used to add noise to interpolated inputs prior to computing gradients.
            - `noiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigmaNoiseSigmaForFeature[]: Noise sigma per feature. No noise is added to features that are not set.
              - …
          - `noiseSigma` number, float: This is a single float value and will be used to add noise to all the features. Use this field when all features are normalized to have the same distribution: scale to range [0, 1], [-1, 1] or z-scoring, where features are normalized to have 0-mean and 1-variance. Learn more about [normalization](https://developers.google.com/machine-learning/data-prep/transform/normalization). For best results the recommended value is about 10% - 20% of the standard deviation of the input feature. Refer to section 3.2 of the SmoothGrad paper: https://arxiv.org/pdf/1706.03825.pdf. Defaults to 0.1. If the distribution is different per feature, set feature_noise_sigma instead for each feature.
          - `noisySampleCount` integer: The number of gradient samples to use for approximation. The higher this number, the more accurate the gradient is, but the runtime complexity increases by this factor as well. Valid range of its value is [1, 50]. Defaults to 3.
        - `stepCount` integer: Required. The number of steps for approximating the path integral. A good value to start is 50 and gradually increase until the sum to diff property is within the desired error range. Valid range of its value is [1, 100], inclusively.
      - `outputIndices` unknown[]: If populated, only returns attributions that have output_index contained in output_indices. It must be an ndarray of integers, with the same shape of the output it's explaining. If not populated, returns attributions for top_k indices of outputs. If neither top_k nor output_indices is populated, returns the argmax index of the outputs. Only applicable to Models that predict multiple outputs (e,g, multi-class Models that predict multiple classes).
        - unknown
      - `sampledShapleyAttribution` GoogleCloudAiplatformV1SampledShapleyAttribution: An attribution method that approximates Shapley values for features that contribute to the label being predicted. A sampling strategy is used to approximate the value rather than considering all subsets of features.
        - `pathCount` integer: Required. The number of feature permutations to consider when approximating the Shapley values. Valid range of its value is [1, 50], inclusively.
      - `topK` integer: If populated, returns attributions for top K indices of outputs (defaults to 1). Only applies to Models that predicts more than one outputs (e,g, multi-class Models). When set to -1, returns explanations for all outputs.
      - `xraiAttribution` GoogleCloudAiplatformV1XraiAttribution: An explanation method that redistributes Integrated Gradients attributions to segmented regions, taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1906.02825 Supported only by image Models.
        - `blurBaselineConfig` GoogleCloudAiplatformV1BlurBaselineConfig: Config for blur baseline. When enabled, a linear path from the maximally blurred image to the input image is created. Using a blurred baseline instead of zero (black image) is motivated by the BlurIG approach explained here: https://arxiv.org/abs/2004.03383
          - `maxBlurSigma` number, float: The standard deviation of the blur kernel for the blurred baseline. The same blurring parameter is used for both the height and the width dimension. If not set, the method defaults to the zero (i.e. black for images) baseline.
        - `smoothGradConfig` GoogleCloudAiplatformV1SmoothGradConfig: Config for SmoothGrad approximation of gradients. When enabled, the gradients are approximated by averaging the gradients from noisy samples in the vicinity of the inputs. Adding noise can help improve the computed gradients. Refer to this paper for more details: https://arxiv.org/pdf/1706.03825.pdf
          - `featureNoiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigma: Noise sigma by features. Noise sigma represents the standard deviation of the gaussian kernel that will be used to add noise to interpolated inputs prior to computing gradients.
            - `noiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigmaNoiseSigmaForFeature[]: Noise sigma per feature. No noise is added to features that are not set.
              - …
          - `noiseSigma` number, float: This is a single float value and will be used to add noise to all the features. Use this field when all features are normalized to have the same distribution: scale to range [0, 1], [-1, 1] or z-scoring, where features are normalized to have 0-mean and 1-variance. Learn more about [normalization](https://developers.google.com/machine-learning/data-prep/transform/normalization). For best results the recommended value is about 10% - 20% of the standard deviation of the input feature. Refer to section 3.2 of the SmoothGrad paper: https://arxiv.org/pdf/1706.03825.pdf. Defaults to 0.1. If the distribution is different per feature, set feature_noise_sigma instead for each feature.
          - `noisySampleCount` integer: The number of gradient samples to use for approximation. The higher this number, the more accurate the gradient is, but the runtime complexity increases by this factor as well. Valid range of its value is [1, 50]. Defaults to 3.
        - `stepCount` integer: Required. The number of steps for approximating the path integral. A good value to start is 50 and gradually increase until the sum to diff property is met within the desired error range. Valid range of its value is [1, 100], inclusively.
  - `instances` unknown[]: Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' Model's PredictSchemata's instance_schema_uri.
    - unknown
  - `parameters` unknown

## Response `200`

Successful response

- GoogleCloudAiplatformV1ExplainResponse: Response message for PredictionService.Explain.
  - `deployedModelId` string: ID of the Endpoint's DeployedModel that served this explanation.
  - `explanations` GoogleCloudAiplatformV1Explanation[]: The explanations of the Model's PredictResponse.predictions. It has the same number of elements as instances to be explained.
    - `attributions` GoogleCloudAiplatformV1Attribution[]: Output only. Feature attributions grouped by predicted outputs. For Models that predict only one output, such as regression Models that predict only one score, there is only one attibution that explains the predicted output. For Models that predict multiple outputs, such as multiclass Models that predict multiple classes, each element explains one specific item. Attribution.output_index can be used to identify which output this attribution is explaining. By default, we provide Shapley values for the predicted class. However, you can configure the explanation request to generate Shapley values for any other classes too. For example, if a model predicts a probability of `0.4` for approving a loan application, the model's decision is to reject the application since `p(reject) = 0.6 > p(approve) = 0.4`, and the default Shapley values would be computed for rejection decision and not approval, even though the latter might be the positive class. If users set ExplanationParameters.top_k, the attributions are sorted by instance_output_value in descending order. If ExplanationParameters.output_indices is specified, the attributions are stored by Attribution.output_index in the same order as they appear in the output_indices.
      - `approximationError` number, double: Output only. Error of feature_attributions caused by approximation used in the explanation method. Lower value means more precise attributions. * For Sampled Shapley attribution, increasing path_count might reduce the error. * For Integrated Gradients attribution, increasing step_count might reduce the error. * For XRAI attribution, increasing step_count might reduce the error. See [this introduction](/vertex-ai/docs/explainable-ai/overview) for more information.
      - `baselineOutputValue` number, double: Output only. Model predicted output if the input instance is constructed from the baselines of all the features defined in ExplanationMetadata.inputs. The field name of the output is determined by the key in ExplanationMetadata.outputs. If the Model's predicted output has multiple dimensions (rank > 1), this is the value in the output located by output_index. If there are multiple baselines, their output values are averaged.
      - `featureAttributions` unknown
      - `instanceOutputValue` number, double: Output only. Model predicted output on the corresponding explanation instance. The field name of the output is determined by the key in ExplanationMetadata.outputs. If the Model predicted output has multiple dimensions, this is the value in the output located by output_index.
      - `outputDisplayName` string: Output only. The display name of the output identified by output_index. For example, the predicted class name by a multi-classification Model. This field is only populated iff the Model predicts display names as a separate field along with the explained output. The predicted display name must has the same shape of the explained output, and can be located using output_index.
      - `outputIndex` integer[]: Output only. The index that locates the explained prediction output. If the prediction output is a scalar value, output_index is not populated. If the prediction output has multiple dimensions, the length of the output_index list is the same as the number of dimensions of the output. The i-th element in output_index is the element index of the i-th dimension of the output vector. Indices start from 0.
      - `outputName` string: Output only. Name of the explain output. Specified as the key in ExplanationMetadata.outputs.
    - `neighbors` GoogleCloudAiplatformV1Neighbor[]: Output only. List of the nearest neighbors for example-based explanations. For models deployed with the examples explanations feature enabled, the attributions field is empty and instead the neighbors field is populated.
      - `neighborDistance` number, double: Output only. The neighbor distance.
      - `neighborId` string: Output only. The neighbor id.
  - `predictions` unknown[]: The predictions that are the output of the predictions call. Same as PredictResponse.predictions.
    - unknown

## Changes

- **2026-11-06** `3aca3b348f0c`: 4 info
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform.read-only` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform.read-only` was removed from the endpoint's security scheme `Oauth2c`
- **2026-10-30** `34fcc627b062`: 4 info
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform.read-only` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform.read-only` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/aiplatform/changes/v1/projects/:projectsId/locations/:locationsId/endpoints/:endpointsId:explain/post.md)

---

[API](https://skmtc.dev/google/apis/aiplatform.md) - [All operations](https://skmtc.dev/google/apis/aiplatform/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/aiplatform/revisions/3aca3b348f0c?raw)
