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

# POST /v1/{+parent}/builds

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

Creates a new build for a backend.

## Path parameters

- `parent` string, required

## Query parameters

- `buildId` string
- `requestId` string
- `validateOnly` boolean

## Request body

- Build — A single build for a backend, at a specific point codebase reference tag and point in time. Encapsulates several resources, including an Artifact Registry container image, a Cloud Build invocation that built the image, and the Cloud Run revision that uses that image.
  - `labels` object — Optional. Unstructured key value map that can be used to organize and categorize objects.
  - `reconciling` boolean — Output only. A field that, if true, indicates that the build has an ongoing LRO.
  - `source` BuildSource — The source for the build.
    - `container` ContainerSource — The URI of an Artifact Registry [container image](https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.dockerImages) to use as the build source.
      - `image` string — Required. A URI representing a container for the backend to use.
    - `archive` ArchiveSource — The URI of an storage archive or a signed URL to use as the build source.
      - `externalSignedUri` string — Signed URL to an archive in a storage bucket.
      - `userStorageUri` string — URI to an archive in Cloud Storage. The object must be a zipped (.zip) or gzipped archive file (.tar.gz) containing source to deploy.
      - `description` string — Optional. An optional message that describes the uploaded version of the source code.
      - `rootDirectory` string — Optional. The directory relative to the root of the archive to use as the root for the deployed web app. Defaults to use the root of the repository if not provided. If deploying a [monorepo](https://firebase.google.com/docs/app-hosting/monorepos), this should be the directory that contains the `package.json` or `apphosting.yaml` file.
      - `author` SourceUserMetadata — Deprecated: Not used. Metadata for the user who started the build.
        - `displayName` string — Output only. Deprecated: Not used. The user-chosen displayname. May be empty.
        - `imageUri` string — Output only. Deprecated: Not used. The URI of a profile photo associated with the user who created the build.
        - `email` string — Output only. Deprecated: Not used. The account email linked to the EUC that created the build. May be a service account or other robot account.
    - `codebase` CodebaseSource — A codebase source, representing the state of the codebase that the build will be created at.
      - `commitMessage` string — Output only. The message of a codebase change.
      - `displayName` string — Output only. The human-friendly name to use for this Codebase when displaying a build. We use the first eight characters of the SHA-1 hash for GitHub.com.
      - `repository` string — Output only. The resource name for the Developer Connect [`gitRepositoryLink`](https://cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks) used for this build, in the format: `projects/{project}/locations/{location}/connections/{connection}/gitRepositoryLinks/{repositoryLink}`
      - `author` UserMetadata — Version control metadata for a user associated with a resolved codebase. Currently assumes a Git user.
        - `email` string — Output only. The 'email' field in a Git user's git.config, if available.
        - `displayName` string — Output only. The 'name' field in a Git user's git.config. Required by Git.
        - `imageUri` string — Output only. The URI of an image file associated with the user's account in an external source control provider, if available.
      - `hash` string — Output only. The full SHA-1 hash of a Git commit, if available.
      - `branch` string — The branch in the codebase to build from, using the latest commit.
      - `commitTime` string, google-datetime — Output only. The time the change was made.
      - `commit` string — The commit in the codebase to build from.
      - `uri` string — Output only. A URI linking to the codebase on an hosting provider's website. May not be valid if the commit has been rebased or force-pushed out of existence in the linked repository.
  - `environment` string — Output only. The environment name of the backend when this build was created.
  - `name` string — Identifier. The resource name of the build. Format: `projects/{project}/locations/{locationId}/backends/{backendId}/builds/{buildId}`.
  - `uid` string — Output only. System-assigned, unique identifier.
  - `buildLogsUri` string — Output only. The location of the [Cloud Build logs](https://cloud.google.com/build/docs/view-build-results) for the build process.
  - `errors` Error[] — Output only. A list of all errors that occurred during an App Hosting build.
    - `error` Status — 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).
      - `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.
      - `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.
    - `cloudResource` string — Output only. Resource link
    - `errorSource` 'ERROR_SOURCE_UNSPECIFIED' | 'CLOUD_BUILD' | 'CLOUD_RUN' — Output only. The source of the error for the build, if in a `FAILED` state.
  - `updateTime` string, google-datetime — Output only. Time at which the build was last updated.
  - `annotations` object — Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
  - `createTime` string, google-datetime — Output only. Time at which the build was created.
  - `config` Config — Additional configuration of the backend for this build.
    - `effectiveEnv` EnvironmentVariable[] — Output only. [OUTPUT_ONLY] This field represents all environment variables employed during both the build and runtime. This list reflects the result of merging variables from all sources (Backend.override_env, Build.Config.env, YAML, defaults, system). Each variable includes its `origin`
      - `secret` string — A fully qualified secret version. The value of the secret will be accessed once while building the application and once per cold start of the container at runtime. The service account used by Cloud Build and by Cloud Run must each have the `secretmanager.versions.access` permission on the secret.
      - `variable` string — Required. The name of the environment variable. The environment variables reserved by [Cloud Run](https://docs.cloud.google.com/run/docs/configuring/services/environment-variables#reserved) should not be set. Additionally, variable names cannot start with "X_FIREBASE_".
      - `availability` string[] — Optional. Where this variable should be made available. If left unspecified, will be available in both BUILD and BACKEND.
      - `originFileName` string — Output only. Specific detail about the source. For APPHOSTING_YAML origins, this will contain the exact filename, such as "apphosting.yaml" or "apphosting.staging.yaml".
      - `value` string — A plaintext value. This value is encrypted at rest, but all project readers can view the value when reading your backend configuration.
      - `origin` 'ORIGIN_UNSPECIFIED' | 'BACKEND_OVERRIDES' | 'BUILD_CONFIG' | 'APPHOSTING_YAML' | 'FIREBASE_SYSTEM' — Output only. The high-level origin category of the environment variable.
    - `runConfig` RunConfig — Configuration applied to the Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service).
      - `maxInstances` integer — Optional. Number of Cloud Run instances to maintain at maximum for each revision. By default, each Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service) scales out to Cloud Run's default of a maximum of 100 instances. The maximum max_instances limit is based on your quota. See https://cloud.google.com/run/docs/configuring/max-instances#limits.
      - `memoryMib` integer — Optional. Amount of memory allocated for each serving instance in MiB. By default, memory defaults to the Cloud Run's default where each instance is allocated 512 MiB of memory. Memory can be set to any integer value between 128 to 32768. Increasing memory limit may require increase in CPUs limits: - Over 4 GiB: at least 2 CPUs - Over 8 GiB: at least 4 CPUs - Over 16 GiB: at least 6 CPUs - Over 24 GiB: at least 8 CPUs
      - `minInstances` integer — Optional. Number of Cloud Run instances to maintain at minimum for each Cloud Run Service. By default, there are no minimum. Even if the service splits traffic across multiple revisions, the total number of instances for a service will be capped at this value.
      - `concurrency` integer — Optional. Maximum number of requests that each Cloud Run instance can receive. By default, each instance can receive Cloud Run's default of up to 80 requests at the same time. Concurrency can be set to any integer value up to 1000.
      - `cpu` number, float — Optional. Number of CPUs used for each serving instance. By default, cpu defaults to the Cloud Run's default of 1.0. CPU can be set to value 1, 2, 4, 6, or 8 CPUs, and for less than 1 CPU, a value from 0.08 to less than 1.00, in increments of 0.01. If you set a value of less than 1 CPU, you must set concurrency to 1, and CPU will only be allocated during request processing. Increasing CPUs limit may require increase in memory limits: - 4 CPUs: at least 2 GiB - 6 CPUs: at least 4 GiB - 8 CPUs: at least 4 GiB
    - `env` EnvironmentVariable[] — Optional. Supplied environment variables for a specific build. Provided at Build creation time and immutable afterwards. This field is only applicable for Builds using a build image - (e.g., ContainerSource or ArchiveSource with locally_built_source) Attempts to set this for other build types will result in an error
      - `secret` string — A fully qualified secret version. The value of the secret will be accessed once while building the application and once per cold start of the container at runtime. The service account used by Cloud Build and by Cloud Run must each have the `secretmanager.versions.access` permission on the secret.
      - `variable` string — Required. The name of the environment variable. The environment variables reserved by [Cloud Run](https://docs.cloud.google.com/run/docs/configuring/services/environment-variables#reserved) should not be set. Additionally, variable names cannot start with "X_FIREBASE_".
      - `availability` string[] — Optional. Where this variable should be made available. If left unspecified, will be available in both BUILD and BACKEND.
      - `originFileName` string — Output only. Specific detail about the source. For APPHOSTING_YAML origins, this will contain the exact filename, such as "apphosting.yaml" or "apphosting.staging.yaml".
      - `value` string — A plaintext value. This value is encrypted at rest, but all project readers can view the value when reading your backend configuration.
      - `origin` 'ORIGIN_UNSPECIFIED' | 'BACKEND_OVERRIDES' | 'BUILD_CONFIG' | 'APPHOSTING_YAML' | 'FIREBASE_SYSTEM' — Output only. The high-level origin category of the environment variable.
  - `displayName` string — Optional. Human-readable name. 63 character limit.
  - `image` string — Output only. The Artifact Registry [container image](https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.dockerImages) URI, used by the Cloud Run [`revision`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services.revisions) for this build.
  - `deleteTime` string, google-datetime — Output only. Time at which the build was deleted.
  - `state` 'STATE_UNSPECIFIED' | 'BUILDING' | 'BUILT' | 'DEPLOYING' | 'READY' | 'FAILED' | 'SKIPPED' | 'EXPIRED' — Output only. The state of the build.
  - `etag` string — Output only. Server-computed checksum based on other values; may be sent on update or delete to ensure operation is done on expected resource.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/firebaseapphosting.md) · [All operations](https://skmtc.dev/google/apis/firebaseapphosting/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/firebaseapphosting/revisions/487a88f26666/schema)
