---
title: "Rebuild every function in a project"
method: POST
path: "/projects/v1/{project_id}/functions/rebuild"
tags: ["Functions"]
---

# Rebuild every function in a project

`POST /projects/v1/{project_id}/functions/rebuild`

## Request

- Base URL: `https://api.run402.com`
- URL: `https://api.run402.com/projects/v1/{project_id}/functions/rebuild`
- Auth: API key in header `SIGN-IN-WITH-X`

Re-bundles ALL functions in the project from their stored source with the same wrapper-only guarantee as the single-function rebuild (deps pinned to recorded versions; source `code_hash` unchanged; no new release). Per-function failures are isolated (`Promise.allSettled`) and never abort the batch — a function that cannot be rebuilt keeps its old artifact and is reported in `results[]`. Strictly opt-in. Wallet-authed and ownership-checked; identity only — NO active tier is required, so it works during billing grace.

## Path parameters

- `project_id` string, required: Run402 project ID. Public IDs are not UUIDs.

## Response `200`

Batch rebuild summary. Always 200 even when individual functions failed — inspect `results[]` and `rebuilt_count`.

- object
  - `rebuilt_count` integer: Number of functions successfully rebuilt.
  - `total` integer: Total functions attempted.
  - `results` object[]: Per-function outcome. A success entry is the single-function rebuild record; a failure entry is `{ name, rebuilt: false, error, code? }` and never aborts the batch.
    - `name` string, required
    - `rebuilt` boolean, required
    - `old_fingerprint` unknown
    - `new_fingerprint` string
    - `runtime_version_before` unknown
    - `runtime_version_after` unknown
    - `code_hash` string
    - `error` string: Present only on a failed entry.
    - `code` string: Structured error code on a failed entry (e.g. `CANNOT_REBUILD_UNLOCKED_DEPS`).

## Other responses

- `401`: Missing or invalid authentication. Run402-originated JSON bodies use the canonical ErrorEnvelope.
- `403`: Caller is not the project owner. Run402-originated JSON bodies use the canonical ErrorEnvelope.
- `404`: Project not found. Run402-originated JSON bodies use the canonical ErrorEnvelope.

---

[API](https://skmtc.dev/run402/apis/run402-api.md) · [All operations](https://skmtc.dev/run402/apis/run402-api/llms.txt) · [OpenAPI document](https://skmtc.dev/run402/apis/run402-api/revisions/893607557f50?raw)
