---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/notebookRuntimes:assign"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/notebookRuntimes:assign"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/notebookRuntimes:assign

`POST /v1/projects/{projectsId}/locations/{locationsId}/notebookRuntimes:assign`

## Request

- Base URL: `https://aiplatform.googleapis.com`
- URL: `https://aiplatform.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/notebookRuntimes:assign`
- Auth: 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`

Assigns a NotebookRuntime to a user for a particular Notebook file. This method will either returns an existing assignment or generates a new one.

## Path parameters

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

## Request body

- GoogleCloudAiplatformV1AssignNotebookRuntimeRequest: Request message for NotebookService.AssignNotebookRuntime.
  - `notebookRuntime` GoogleCloudAiplatformV1NotebookRuntime: A runtime is a virtual machine allocated to a particular user for a particular Notebook file on temporary basis with lifetime. Default runtimes have a lifetime of 18 hours, while custom runtimes last for 6 months from their creation or last upgrade.
    - `createTime` string, google-datetime: Output only. Timestamp when this NotebookRuntime was created.
    - `dataPersistentDiskSpec` GoogleCloudAiplatformV1PersistentDiskSpec: Represents the spec of persistent disk and hyperdisk options.
      - `diskSizeGb` string, int64: Size in GB of the disk (default is 100GB).
      - `diskType` string: Type of the disk (default is "pd-standard"). Valid values: "pd-ssd" (Persistent Disk Solid State Drive) "pd-standard" (Persistent Disk Hard Disk Drive) "pd-balanced" (Balanced Persistent Disk) "pd-extreme" (Extreme Persistent Disk) "hyperdisk-balanced" (Hyperdisk Balanced) "hyperdisk-extreme" (Hyperdisk Extreme) "hyperdisk-balanced-high-availability" (Hyperdisk Balanced High Availability) "hyperdisk-ml" (Hyperdisk ML) "hyperdisk-throughput" (Hyperdisk Throughput)
    - `description` string: The description of the NotebookRuntime.
    - `displayName` string: Required. The display name of the NotebookRuntime. The name can be up to 128 characters long and can consist of any UTF-8 characters.
    - `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}`.
    - `eucConfig` GoogleCloudAiplatformV1NotebookEucConfig: The euc configuration of NotebookRuntimeTemplate.
      - `bypassActasCheck` boolean: Output only. Whether ActAs check is bypassed for service account attached to the VM. If false, we need ActAs check for the default Compute Engine Service account. When a Runtime is created, a VM is allocated using Default Compute Engine Service Account. Any user requesting to use this Runtime requires Service Account User (ActAs) permission over this SA. If true, Runtime owner is using EUC and does not require the above permission as VM no longer use default Compute Engine SA, but a P4SA.
      - `eucDisabled` boolean: Input only. Whether EUC is disabled in this NotebookRuntimeTemplate. In proto3, the default value of a boolean is false. In this way, by default EUC will be enabled for NotebookRuntimeTemplate.
    - `expirationTime` string, google-datetime: Output only. Timestamp when this NotebookRuntime will be expired: 1. System Predefined NotebookRuntime: 24 hours after creation. After expiration, system predifined runtime will be deleted. 2. User created NotebookRuntime: 6 months after last upgrade. After expiration, user created runtime will be stopped and allowed for upgrade.
    - `healthState` 'HEALTH_STATE_UNSPECIFIED' | 'HEALTHY' | 'UNHEALTHY': Output only. The health state of the NotebookRuntime.
    - `idleShutdownConfig` GoogleCloudAiplatformV1NotebookIdleShutdownConfig: The idle shutdown configuration of NotebookRuntimeTemplate, which contains the idle_timeout as required field.
      - `idleShutdownDisabled` boolean: Whether Idle Shutdown is disabled in this NotebookRuntimeTemplate.
      - `idleTimeout` string, google-duration: Required. Duration is accurate to the second. In Notebook, Idle Timeout is accurate to minute so the range of idle_timeout (second) is: 10 * 60 ~ 1440 * 60.
    - `isUpgradable` boolean: Output only. Whether NotebookRuntime is upgradable.
    - `labels` object: The labels with user-defined metadata to organize your NotebookRuntime. 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. No more than 64 user labels can be associated with one NotebookRuntime (System labels are excluded). See https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable. Following system labels exist for NotebookRuntime: * "aiplatform.googleapis.com/notebook_runtime_gce_instance_id": output only, its value is the Compute Engine instance id. * "aiplatform.googleapis.com/colab_enterprise_entry_service": its value is either "bigquery" or "vertex"; if absent, it should be "vertex". This is to describe the entry service, either BigQuery or Vertex.
    - `machineSpec` GoogleCloudAiplatformV1MachineSpec: Specification of a single machine.
      - `acceleratorCount` integer: The number of accelerators to attach to the machine. For [accelerator optimized machine types](https://cloud.google.com/compute/docs/accelerator-optimized-machines), One may set the accelerator_count from 1 to N for machine with N GPUs. If accelerator_count is less than or equal to N / 2, Agent Platform co-schedules the replicas of the model into the same VM to save cost. For example, if the machine type is a3-highgpu-8g, which has 8 H100 GPUs, one can set accelerator_count to 1 to 8. If accelerator_count is 1, 2, 3, or 4, Agent Platform co-schedules 8, 4, 2, or 2 replicas of the model into the same VM to save cost. When co-scheduling, CPU, memory and storage on the VM will be distributed to replicas on the VM. For example, one can expect a co-scheduled replica requesting 2 GPUs out of a 8-GPU VM will receive 25% of the CPU, memory and storage of the VM. Note that the feature is not compatible with multihost_gpu_node_count. When multihost_gpu_node_count is set, the co-scheduling will not be enabled.
      - `acceleratorType` 'ACCELERATOR_TYPE_UNSPECIFIED' | 'NVIDIA_TESLA_K80' | 'NVIDIA_TESLA_P100' | 'NVIDIA_TESLA_V100' | 'NVIDIA_TESLA_P4' | 'NVIDIA_TESLA_T4' | 'NVIDIA_TESLA_A100' | 'NVIDIA_A100_80GB' | 'NVIDIA_L4' | 'NVIDIA_H100_80GB' | 'NVIDIA_H100_MEGA_80GB' | 'NVIDIA_H200_141GB' | 'NVIDIA_B200' | 'NVIDIA_GB200' | 'NVIDIA_RTX_PRO_6000' | 'TPU_V2' | 'TPU_V3' | 'TPU_V4_POD' | 'TPU_V5_LITEPOD': Immutable. The type of accelerator(s) that may be attached to the machine as per accelerator_count.
      - `gpuPartitionSize` string: Optional. Immutable. The Nvidia GPU partition size. When specified, the requested accelerators will be partitioned into smaller GPU partitions. For example, if the request is for 8 units of NVIDIA A100 GPUs, and gpu_partition_size="1g.10gb", the service will create 8 * 7 = 56 partitioned MIG instances. The partition size must be a value supported by the requested accelerator. Refer to [Nvidia GPU Partitioning](https://cloud.google.com/kubernetes-engine/docs/how-to/gpus-multi#multi-instance_gpu_partitions) for the available partition sizes. If set, the accelerator_count should be set to 1.
      - `machineType` string: Immutable. The type of the machine. See the [list of machine types supported for prediction](https://cloud.google.com/gemini-enterprise-agent-platform/machine-learning/predictions/configure-compute#machine-types) See the [list of machine types supported for custom training](https://cloud.google.com/gemini-enterprise-agent-platform/machine-learning/training/configure-compute#machine-types). For DeployedModel this field is optional, and the default value is `n1-standard-2`. For BatchPredictionJob or as part of WorkerPoolSpec this field is required.
      - `reservationAffinity` GoogleCloudAiplatformV1ReservationAffinity: A ReservationAffinity can be used to configure a Vertex AI resource (e.g., a DeployedModel) to draw its Compute Engine resources from a Shared Reservation, or exclusively from on-demand capacity.
        - `key` string: Optional. Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, use `compute.googleapis.com/reservation-name` as the key and specify the name of your reservation as its value.
        - `reservationAffinityType` 'TYPE_UNSPECIFIED' | 'NO_RESERVATION' | 'ANY_RESERVATION' | 'SPECIFIC_RESERVATION': Required. Specifies the reservation affinity type.
        - `values` string[]: Optional. Corresponds to the label values of a reservation resource. This must be the resource name of the reservation, reservation block, or reservation sub- block.
      - `tpuTopology` string: Immutable. The topology of the TPUs. Corresponds to the TPU topologies available from GKE. (Example: tpu_topology: "2x2x1").
    - `name` string: Output only. The resource name of the NotebookRuntime.
    - `networkSpec` GoogleCloudAiplatformV1NetworkSpec: Network spec.
      - `enableInternetAccess` boolean: Whether to enable public internet access. Default false.
      - `network` string: The full name of the Google Compute Engine [network](https://cloud.google.com//compute/docs/networks-and-firewalls#networks)
      - `subnetwork` string: The name of the subnet that this instance is in. Format: `projects/{project_id_or_number}/regions/{region}/subnetworks/{subnetwork_id}`
    - `networkTags` string[]: Optional. The Compute Engine tags to add to runtime (see [Tagging instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
    - `notebookRuntimeTemplateRef` GoogleCloudAiplatformV1NotebookRuntimeTemplateRef: Points to a NotebookRuntimeTemplateRef.
      - `notebookRuntimeTemplate` string: Immutable. A resource name of the NotebookRuntimeTemplate.
    - `notebookRuntimeType` 'NOTEBOOK_RUNTIME_TYPE_UNSPECIFIED' | 'USER_DEFINED' | 'ONE_CLICK': Output only. The type of the notebook runtime.
    - `proxyUri` string: Output only. The proxy endpoint used to access the NotebookRuntime.
    - `reservationAffinity` GoogleCloudAiplatformV1NotebookReservationAffinity: Notebook Reservation Affinity for consuming Zonal reservation.
      - `consumeReservationType` 'RESERVATION_AFFINITY_TYPE_UNSPECIFIED' | 'RESERVATION_NONE' | 'RESERVATION_ANY' | 'RESERVATION_SPECIFIC': Required. Specifies the type of reservation from which this instance can consume resources: RESERVATION_ANY (default), RESERVATION_SPECIFIC, or RESERVATION_NONE. See Consuming reserved instances for examples.
      - `key` string: Optional. Corresponds to the label key of a reservation resource. To target a RESERVATION_SPECIFIC by name, use compute.googleapis.com/reservation-name as the key and specify the name of your reservation as its value.
      - `values` string[]: Optional. Corresponds to the label values of a reservation resource. This must be the full path name of Reservation.
    - `runtimeState` 'RUNTIME_STATE_UNSPECIFIED' | 'RUNNING' | 'BEING_STARTED' | 'BEING_STOPPED' | 'STOPPED' | 'BEING_UPGRADED' | 'ERROR' | 'INVALID': Output only. The runtime (instance) state of the NotebookRuntime.
    - `runtimeUser` string: Required. The user email of the NotebookRuntime.
    - `satisfiesPzi` boolean: Output only. Reserved for future use.
    - `satisfiesPzs` boolean: Output only. Reserved for future use.
    - `serviceAccount` string: Output only. Deprecated: This field is no longer used and the "Vertex AI Notebook Service Account" (service-PROJECT_NUMBER@gcp-sa-aiplatform-vm.iam.gserviceaccount.com) is used for the runtime workload identity. See https://cloud.google.com/iam/docs/service-agents#vertex-ai-notebook-service-account for more details. The service account that the NotebookRuntime workload runs as.
    - `shieldedVmConfig` GoogleCloudAiplatformV1ShieldedVmConfig: A set of Shielded Instance options. See [Images using supported Shielded VM features](https://cloud.google.com/compute/docs/instances/modifying-shielded-vm).
      - `enableSecureBoot` boolean: Defines whether the instance has [Secure Boot](https://cloud.google.com/compute/shielded-vm/docs/shielded-vm#secure-boot) enabled. Secure Boot helps ensure that the system only runs authentic software by verifying the digital signature of all boot components, and halting the boot process if signature verification fails.
    - `softwareConfig` GoogleCloudAiplatformV1NotebookSoftwareConfig: Notebook Software Config. This is passed to the backend when user makes software configurations in UI.
      - `colabImage` GoogleCloudAiplatformV1ColabImage: Colab image of the runtime.
        - `description` string: Output only. A human-readable description of the specified colab image release, populated by the system. Example: "Python 3.10", "Latest - current Python 3.11"
        - `releaseName` string: Optional. The release name of the NotebookRuntime Colab image, e.g. "py310". If not specified, detault to the latest release.
      - `env` GoogleCloudAiplatformV1EnvVar[]: Optional. Environment variables to be passed to the container. Maximum limit is 100.
        - `name` string: Required. Name of the environment variable. Must be a valid C identifier.
        - `value` string: Required. Variables that reference a $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not.
      - `postStartupScriptConfig` GoogleCloudAiplatformV1PostStartupScriptConfig: Post startup script config.
        - `postStartupScript` string: Optional. Post startup script to run after runtime is started.
        - `postStartupScriptBehavior` 'POST_STARTUP_SCRIPT_BEHAVIOR_UNSPECIFIED' | 'RUN_ONCE' | 'RUN_EVERY_START' | 'DOWNLOAD_AND_RUN_EVERY_START': Optional. Post startup script behavior that defines download and execution behavior.
        - `postStartupScriptUrl` string: Optional. Post startup script url to download. Example: `gs://bucket/script.sh`
    - `updateTime` string, google-datetime: Output only. Timestamp when this NotebookRuntime was most recently updated.
    - `version` string: Output only. The VM os image version of NotebookRuntime.
  - `notebookRuntimeId` string: Optional. User specified ID for the notebook runtime.
  - `notebookRuntimeTemplate` string: Required. The resource name of the NotebookRuntimeTemplate based on which a NotebookRuntime will be assigned (reuse or create a new one).

## Response `200`

Successful response

- GoogleLongrunningOperation: This resource represents a long-running operation that is the result of a network API call.
  - `done` boolean: If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
  - `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.
    - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
    - `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.
  - `metadata` object: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
  - `name` string: The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
  - `response` object: The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.

---

[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)
