- [HTTP request](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#body.aspect)
- [Try it!](https://docs.cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/retry#try-it)

Creates a new build based on the specified build.

Note: This method only creates builds in the "global" region when using the legacy resource path projects/{projectId}/builds/{id}:retry. For all regions, use the regional resource path: `projects/{projectId}/locations/{location}/builds/{id}:retry`.

This method creates a new build using the original build request, which may or may not result in an identical build.

For triggered builds:

- Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.

For non-triggered builds that specify `RepoSource`:

- If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build.
- If the original build specified a commit sha or revision ID, the retried build will use the identical source.

For builds that specify `StorageSource`:

- If the original build pulled source from Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source.
- If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.

### HTTP request

Choose an endpoint:
global africa-south1 asia-east1 asia-east2 asia-northeast1 asia-northeast2 asia-northeast3 asia-south1 asia-south2 asia-southeast1 asia-southeast2 asia-southeast3 australia-southeast1 australia-southeast2 europe-central2 europe-north1 europe-north2 europe-southwest1 europe-west1 europe-west10 europe-west12 europe-west2 europe-west3 europe-west4 europe-west6 europe-west8 europe-west9 europe-west15 me-central1 me-central2 me-west1 northamerica-northeast1 northamerica-northeast2 northamerica-south1 southamerica-east1 southamerica-west1 us-central1 us-central2 us-east1 us-east4 us-east5 us-east7 us-south1 us-west1 us-west2 us-west3 us-west4 us-west8   
`POST https://cloudbuild.googleapis.com/v1/{name=projects/*/locations/*/builds/*}:retry`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` The name of the `Build` to retry. Format: `projects/{project}/locations/{location}/builds/{build}` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "projectId": string, "id": string } ``` |

| Fields ||
|---|---|
| `projectId` | `string` Required. ID of the project. Authorization requires one or more of the following [IAM](https://cloud.google.com/iam/docs/) permissions on the specified resource `projectId`: - `cloudbuild.builds.get` - `cloudbuild.builds.create` |
| `id` | `string` Required. Build ID of the original build. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/build/docs/api/reference/rest/v1/operations#Operation`.

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).