# Retry a build

> Retry a failed or cancelled build, updating access and authorizing live tests when required.

Source: https://docs.fous.com/api-reference/retryBuild

`POST /v1/builds/{build_id}/retry`

Submits a failed or cancelled build again with the same prompt, optionally with other connections or keys. Live tests can repeat real actions. Show the BuildRiskAcknowledgment notice and obtain fresh explicit authorization. Needs tools:write.

Authentication: `Authorization: Bearer $FOUS_API_KEY`.

## Path parameters

- `build_id` (string, required)

## Headers

- `Idempotency-Key` (string)

## Request body

Required. JSON.

- `risk_acknowledgment` (BuildRiskAcknowledgment): Required once a managed build notice is active. A missing or outdated acknowledgment returns 409 risk_acknowledgment_required with the exact current notice in error.details.notice. Present its full text and affirmation and obtain explicit authorization before each build, edit or user-requested retry, then send its version. Live tests and repairs can perform repeated real actions. Never infer authorization from a request to build a tool.
- `connections` (object)
- `environment` (object)

## Response 202

Admitted

- `success` (true, required)
- `data` (Build, required): A build: from queued through exploring, compiling, verifying and publishing to ready, failed or cancelled. Once ready, api names the tool and method its operation; prepared_request carries an input the builder verified it with.

## Errors

Every error uses the Error schema: branch on `error.code`. Codes are listed at https://docs.fous.com/guides/errors.

- 400
- 401 (headers: WWW-Authenticate)
- 402
- 403
- 404
- 408
- 409
- 410
- 413
- 422
- 429 (headers: Retry-After)
- 500
- 502
- 503 (headers: Retry-After)
- 504

## Example request

```bash
curl 'https://api.fous.com/v1/builds/{build_id}/retry' \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H "Idempotency-Key: $FOUS_IDEMPOTENCY_KEY" \
  -H 'Content-Type: application/json' \
  -d '{}'
```
