---
title: "Rebuild one function's runtime from stored source"
method: POST
path: "/projects/v1/{project_id}/functions/{name}/rebuild"
tags: ["Functions"]
---

# Rebuild one function's runtime from stored source

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

## Request

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

Re-bundles a single function from its STORED source against the gateway's current entry wrapper / bundled runtime, with dependencies pinned to the function's exact recorded `deps_resolved` versions — so the only change is the wrapper/runtime (the source `code_hash` is unchanged and no new release is created). Use it to pick up a platform-side wrapper/runtime fix without editing your source. Strictly opt-in — functions are never auto-rebuilt. Wallet-authed and ownership-checked; identity only — NO active tier is required, so it works during billing grace (past_due/frozen/dormant). A failed rebuild leaves the old artifact and DB row intact.

## Path parameters

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

## Response `200`

Rebuild result. The source `code_hash` is unchanged (wrapper-only).

- object
  - `name` string
  - `rebuilt` boolean: True when the function was re-bundled and re-uploaded.
  - `old_fingerprint` unknown
  - `new_fingerprint` string: Current gateway build fingerprint now stamped on the function.
  - `runtime_version_before` unknown
  - `runtime_version_after` unknown
  - `code_hash` string: Hash of the (unchanged) stored source — assert it is stable to confirm the wrapper-only guarantee.

## 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 or function not found. Run402-originated JSON bodies use the canonical ErrorEnvelope.
- `409`: The function has no stored source, or was deployed before dependency locking (`deps_resolved` is null) — redeploy from source to refresh its runtime. Code: `CANNOT_REBUILD_UNLOCKED_DEPS`.

---

[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)
