---
title: "POST /v1b3/projects/{projectId}/locations/{location}/flexTemplates:launch"
method: POST
path: "/v1b3/projects/{projectId}/locations/{location}/flexTemplates:launch"
tags: ["projects"]
---

# POST /v1b3/projects/{projectId}/locations/{location}/flexTemplates:launch

`POST /v1b3/projects/{projectId}/locations/{location}/flexTemplates:launch`

Launch a job with a FlexTemplate.

## Path parameters

- `projectId` string, required
- `location` string, required

## Request body

- LaunchFlexTemplateRequest — A request to launch a Cloud Dataflow job from a FlexTemplate.
  - `launchParameter` LaunchFlexTemplateParameter — Launch FlexTemplate Parameter.
    - `parameters` object — The parameters for FlexTemplate. Ex. {"num_workers":"5"}
    - `containerSpec` ContainerSpec — Container Spec.
      - `metadata` TemplateMetadata — Metadata describing a template.
        - `defaultStreamingMode` string — Optional. Indicates the default streaming mode for a streaming template. Only valid if both supports_at_least_once and supports_exactly_once are true. Possible values: UNSPECIFIED, EXACTLY_ONCE and AT_LEAST_ONCE
        - `streaming` boolean — Optional. Indicates if the template is streaming or not.
        - `supportsAtLeastOnce` boolean — Optional. Indicates if the streaming template supports at least once mode.
        - `name` string — Required. The name of the template.
        - `description` string — Optional. A description of the template.
        - `supportsExactlyOnce` boolean — Optional. Indicates if the streaming template supports exactly once mode.
        - `yamlDefinition` string — Optional. For future use.
        - `parameters` ParameterMetadata[] — The parameters for the template.
          - `name` string — Required. The name of the parameter.
          - `paramType` 'DEFAULT' | 'TEXT' | 'GCS_READ_BUCKET' | 'GCS_WRITE_BUCKET' | 'GCS_READ_FILE' | 'GCS_WRITE_FILE' | 'GCS_READ_FOLDER' | 'GCS_WRITE_FOLDER' | 'PUBSUB_TOPIC' | 'PUBSUB_SUBSCRIPTION' | 'BIGQUERY_TABLE' | 'JAVASCRIPT_UDF_FILE' | 'SERVICE_ACCOUNT' | 'MACHINE_TYPE' | 'KMS_KEY_NAME' | 'WORKER_REGION' | 'WORKER_ZONE' | 'BOOLEAN' | 'ENUM' | 'NUMBER' | 'KAFKA_TOPIC' | 'KAFKA_READ_TOPIC' | 'KAFKA_WRITE_TOPIC' — Optional. The type of the parameter. Used for selecting input picker.
          - `regexes` string[] — Optional. Regexes that the parameter must match.
          - `parentName` string — Optional. Specifies the name of the parent parameter. Used in conjunction with 'parent_trigger_values' to make this parameter conditional (will only be rendered conditionally). Should be mappable to a ParameterMetadata.name field.
          - `customMetadata` object — Optional. Additional metadata for describing this parameter.
          - `helpText` string — Required. The help text to display for the parameter.
          - `parentTriggerValues` string[] — Optional. The value(s) of the 'parent_name' parameter which will trigger this parameter to be shown. If left empty, ANY non-empty value in parent_name will trigger this parameter to be shown. Only considered when this parameter is conditional (when 'parent_name' has been provided).
          - `enumOptions` ParameterMetadataEnumOption[] — Optional. The options shown when ENUM ParameterType is specified.
            - `value` string — Required. The value of the enum option.
            - `label` string — Optional. The label to display for the enum option.
            - `description` string — Optional. The description to display for the enum option.
          - `label` string — Required. The label to display for the parameter.
          - `hiddenUi` boolean — Optional. Whether the parameter should be hidden in the UI.
          - `groupName` string — Optional. Specifies a group name for this parameter to be rendered under. Group header text will be rendered exactly as specified in this field. Only considered when parent_name is NOT provided.
          - `defaultValue` string — Optional. The default values will pre-populate the parameter with the given value from the proto. If default_value is left empty, the parameter will be populated with a default of the relevant type, e.g. false for a boolean.
          - `isOptional` boolean — Optional. Whether the parameter is optional. Defaults to false.
      - `sdkInfo` SDKInfo — SDK Information.
        - `version` string — Optional. The SDK version.
        - `language` 'UNKNOWN' | 'JAVA' | 'PYTHON' | 'GO' | 'YAML' — Required. The SDK Language.
      - `image` string — Name of the docker container image. E.g., gcr.io/project/some-image
      - `defaultEnvironment` FlexTemplateRuntimeEnvironment — The environment values to be set at runtime for flex template.
        - `enableLauncherVmSerialPortLogging` boolean — If true serial port logging will be enabled for the launcher VM.
        - `launcherMachineType` string — The machine type to use for launching the job. If not set, Dataflow will select a default machine type.
        - `sdkContainerImage` string — Docker registry location of container image to use for the 'worker harness. Default is the container for the version of the SDK. Note this field is only valid for portable pipelines.
        - `diskSizeGb` integer — Worker disk size, in gigabytes.
        - `flexrsGoal` 'FLEXRS_UNSPECIFIED' | 'FLEXRS_SPEED_OPTIMIZED' | 'FLEXRS_COST_OPTIMIZED' — Set FlexRS goal for the job. https://cloud.google.com/dataflow/docs/guides/flexrs
        - `network` string — Network to which VMs will be assigned. If empty or unspecified, the service will use the network "default".
        - `maxWorkers` integer — The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to 1000.
        - `machineType` string — The machine type to use for the job. Defaults to the value from the template if not specified.
        - `kmsKeyName` string — Name for the Cloud KMS key for the job. Key format is: projects//locations//keyRings//cryptoKeys/
        - `serviceAccountEmail` string — The email address of the service account to run the job as.
        - `tempLocation` string — The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with `gs://`.
        - `additionalUserLabels` object — Additional user labels to be specified for the job. Keys and values must follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) page. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1kg", "count": "3" }.
        - `dumpHeapOnOom` boolean — If true, when processing time is spent almost entirely on garbage collection (GC), saves a heap dump before ending the thread or process. If false, ends the thread or process without saving a heap dump. Does not save a heap dump when the Java Virtual Machine (JVM) has an out of memory error during processing. The location of the heap file is either echoed back to the user, or the user is given the opportunity to download the heap file.
        - `numWorkers` integer — The initial number of Google Compute Engine instances for the job.
        - `zone` string — The Compute Engine [availability zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) for launching worker instances to run your pipeline. In the future, worker_zone will take precedence.
        - `stagingLocation` string — The Cloud Storage path for staging local files. Must be a valid Cloud Storage URL, beginning with `gs://`.
        - `streamingMode` 'STREAMING_MODE_UNSPECIFIED' | 'STREAMING_MODE_EXACTLY_ONCE' | 'STREAMING_MODE_AT_LEAST_ONCE' — Optional. Specifies the Streaming Engine message processing guarantees. Reduces cost and latency but might result in duplicate messages committed to storage. Designed to run simple mapping streaming ETL jobs at the lowest cost. For example, Change Data Capture (CDC) to BigQuery is a canonical use case. For more information, see [Set the pipeline streaming mode](https://cloud.google.com/dataflow/docs/guides/streaming-modes).
        - `additionalPipelineOptions` string[] — Optional. Additional pipeline option flags for the job.
        - `ipConfiguration` 'WORKER_IP_UNSPECIFIED' | 'WORKER_IP_PUBLIC' | 'WORKER_IP_PRIVATE' — Configuration for VM IPs.
        - `additionalExperiments` string[] — Additional experiment flags for the job.
        - `autoscalingAlgorithm` 'AUTOSCALING_ALGORITHM_UNKNOWN' | 'AUTOSCALING_ALGORITHM_NONE' | 'AUTOSCALING_ALGORITHM_BASIC' — The algorithm to use for autoscaling
        - `subnetwork` string — Subnetwork to which VMs will be assigned, if desired. You can specify a subnetwork using either a complete URL or an abbreviated path. Expected to be of the form "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in a Shared VPC network, you must use the complete URL.
        - `enableStreamingEngine` boolean — Whether to enable Streaming Engine for the job.
        - `saveHeapDumpsToGcsPath` string — Cloud Storage bucket (directory) to upload heap dumps to. Enabling this field implies that `dump_heap_on_oom` is set to true.
        - `workerZone` string — The Compute Engine zone (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1-a". Mutually exclusive with worker_region. If neither worker_region nor worker_zone is specified, a zone in the control plane's region is chosen based on available capacity. If both `worker_zone` and `zone` are set, `worker_zone` takes precedence.
        - `workerRegion` string — The Compute Engine region (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1". Mutually exclusive with worker_zone. If neither worker_region nor worker_zone is specified, default to the control plane's region.
      - `imageRepositoryCertPath` string — Cloud Storage path to self-signed certificate of private registry.
      - `imageRepositoryUsernameSecretId` string — Secret Manager secret id for username to authenticate to private registry.
      - `imageRepositoryPasswordSecretId` string — Secret Manager secret id for password to authenticate to private registry.
    - `update` boolean — Set this to true if you are sending a request to update a running streaming job. When set, the job name should be the same as the running job.
    - `environment` FlexTemplateRuntimeEnvironment — The environment values to be set at runtime for flex template.
      - `enableLauncherVmSerialPortLogging` boolean — If true serial port logging will be enabled for the launcher VM.
      - `launcherMachineType` string — The machine type to use for launching the job. If not set, Dataflow will select a default machine type.
      - `sdkContainerImage` string — Docker registry location of container image to use for the 'worker harness. Default is the container for the version of the SDK. Note this field is only valid for portable pipelines.
      - `diskSizeGb` integer — Worker disk size, in gigabytes.
      - `flexrsGoal` 'FLEXRS_UNSPECIFIED' | 'FLEXRS_SPEED_OPTIMIZED' | 'FLEXRS_COST_OPTIMIZED' — Set FlexRS goal for the job. https://cloud.google.com/dataflow/docs/guides/flexrs
      - `network` string — Network to which VMs will be assigned. If empty or unspecified, the service will use the network "default".
      - `maxWorkers` integer — The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to 1000.
      - `machineType` string — The machine type to use for the job. Defaults to the value from the template if not specified.
      - `kmsKeyName` string — Name for the Cloud KMS key for the job. Key format is: projects//locations//keyRings//cryptoKeys/
      - `serviceAccountEmail` string — The email address of the service account to run the job as.
      - `tempLocation` string — The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with `gs://`.
      - `additionalUserLabels` object — Additional user labels to be specified for the job. Keys and values must follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) page. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1kg", "count": "3" }.
      - `dumpHeapOnOom` boolean — If true, when processing time is spent almost entirely on garbage collection (GC), saves a heap dump before ending the thread or process. If false, ends the thread or process without saving a heap dump. Does not save a heap dump when the Java Virtual Machine (JVM) has an out of memory error during processing. The location of the heap file is either echoed back to the user, or the user is given the opportunity to download the heap file.
      - `numWorkers` integer — The initial number of Google Compute Engine instances for the job.
      - `zone` string — The Compute Engine [availability zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) for launching worker instances to run your pipeline. In the future, worker_zone will take precedence.
      - `stagingLocation` string — The Cloud Storage path for staging local files. Must be a valid Cloud Storage URL, beginning with `gs://`.
      - `streamingMode` 'STREAMING_MODE_UNSPECIFIED' | 'STREAMING_MODE_EXACTLY_ONCE' | 'STREAMING_MODE_AT_LEAST_ONCE' — Optional. Specifies the Streaming Engine message processing guarantees. Reduces cost and latency but might result in duplicate messages committed to storage. Designed to run simple mapping streaming ETL jobs at the lowest cost. For example, Change Data Capture (CDC) to BigQuery is a canonical use case. For more information, see [Set the pipeline streaming mode](https://cloud.google.com/dataflow/docs/guides/streaming-modes).
      - `additionalPipelineOptions` string[] — Optional. Additional pipeline option flags for the job.
      - `ipConfiguration` 'WORKER_IP_UNSPECIFIED' | 'WORKER_IP_PUBLIC' | 'WORKER_IP_PRIVATE' — Configuration for VM IPs.
      - `additionalExperiments` string[] — Additional experiment flags for the job.
      - `autoscalingAlgorithm` 'AUTOSCALING_ALGORITHM_UNKNOWN' | 'AUTOSCALING_ALGORITHM_NONE' | 'AUTOSCALING_ALGORITHM_BASIC' — The algorithm to use for autoscaling
      - `subnetwork` string — Subnetwork to which VMs will be assigned, if desired. You can specify a subnetwork using either a complete URL or an abbreviated path. Expected to be of the form "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in a Shared VPC network, you must use the complete URL.
      - `enableStreamingEngine` boolean — Whether to enable Streaming Engine for the job.
      - `saveHeapDumpsToGcsPath` string — Cloud Storage bucket (directory) to upload heap dumps to. Enabling this field implies that `dump_heap_on_oom` is set to true.
      - `workerZone` string — The Compute Engine zone (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1-a". Mutually exclusive with worker_region. If neither worker_region nor worker_zone is specified, a zone in the control plane's region is chosen based on available capacity. If both `worker_zone` and `zone` are set, `worker_zone` takes precedence.
      - `workerRegion` string — The Compute Engine region (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1". Mutually exclusive with worker_zone. If neither worker_region nor worker_zone is specified, default to the control plane's region.
    - `transformNameMappings` object — Use this to pass transform_name_mappings for streaming update jobs. Ex:{"oldTransformName":"newTransformName",...}'
    - `launchOptions` object — Launch options for this flex template job. This is a common set of options across languages and templates. This should not be used to pass job parameters.
    - `jobName` string — Required. The job name to use for the created job. For update job request, job name should be same as the existing running job.
    - `containerSpecGcsPath` string — Cloud Storage path to a file with json serialized ContainerSpec as content.
  - `validateOnly` boolean — If true, the request is validated but not actually executed. Defaults to false.

## Response `200`

Successful response

---

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