---
title: "Update a template function to the latest version"
method: POST
path: "/functions/{id}/template-update"
tags: ["Templates"]
---

# Update a template function to the latest version

`POST /functions/{id}/template-update`

## Request

- Base URL: `https://api.primitive.dev/v1`
- URL: `https://api.primitive.dev/v1/functions/{id}/template-update`
- Auth: HTTP bearer

Re-pull a function installed from a template to the template's current version. Refused for a function whose code was edited after install. The path id is the function id.

## Path parameters

- `id` string, uuid, required

## Headers

- `Idempotency-Key` string

## Response `200`

Update a template function to the latest version

- object
  - `success` true, required
  - `data` UpdateFunctionFromTemplateResult, required
    - `status` 'updated' | 'up_to_date', required
    - `function_id` string, uuid, required
    - `content_sha` string, nullable, required

## Other responses

- `401`: Invalid or missing API key
- `403`: Authenticated caller lacks permission for the operation
- `404`: Resource not found
- `409`: function_forked, not_a_template_install, template_unavailable or update_needs_input: the function cannot be updated from its template as it stands
- `422`: template_not_installable or scaffold_only: the template has no version this function can move to
- `429`: Rate limit exceeded. The `ratelimit-*` headers describe the limiter that rejected this request, with its own limit and window, not the API budget that successful responses report. A limiter that reports only a wait sends `Retry-After` alone.

---

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